[foreign-jextract] RFR: 8259473: jextract generated code should throw exception for unfound native symbols from calls, variable access, set immediately

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri Jan 8 11:37:10 UTC 2021


On Fri, 8 Jan 2021 11:21:12 GMT, Athijegannathan Sundararajan <sundar at openjdk.org> wrote:

> NPE with proper error message is thrown immediately (on call, variable access/set)

src/jdk.incubator.jextract/share/classes/jdk/internal/jextract/impl/HeaderFileBuilder.java line 110:

> 108:         builder.append("Objects.requireNonNull(");
> 109:         builder.append(methodHandleGetCallString(javaName, nativeName, mtype, desc, varargs));
> 110:         builder.append(", \"no such native function: ");

Nice! I wonder if here we should use "no such" vs. some other form, e.g. "unresolved". I also wonder if NPE is the right exception here - maybe a NoSuchMethodException, or LinkageError might be better?

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/432


More information about the panama-dev mailing list