Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try statement not work correct #717

Open
tangjfn opened this issue Mar 22, 2023 · 1 comment
Open

try statement not work correct #717

tangjfn opened this issue Mar 22, 2023 · 1 comment
Assignees

Comments

@tangjfn
Copy link

tangjfn commented Mar 22, 2023

js version 22.3.1, 21.3.5

// js code
try {
// remove B.class file from the class path, let C can't be loaded
new Packages.test.C();
} finally {
print("not here when load class fail");
}

// java code C.java
package test;
public class C {
public B b;
}

// java code B.java
package test;
public class B {
}

@iamstolis
Copy link
Member

Thank you for the report. I am able to reproduce an internal error in this case:

$ js
> Java.addToClasspath(classpathEntryWithCclass);
> try { new Packages.test.C() } finally { print("caught"); }
org.graalvm.polyglot.PolyglotException: java.lang.NoClassDefFoundError: test/B
	at java.base/java.lang.Class.getDeclaredFields0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3297)
	at java.base/java.lang.Class.privateGetPublicFields(Class.java:3324)
	at java.base/java.lang.Class.getFields(Class.java:1928)
	at com.oracle.truffle.host.HostClassDesc$Members.collectPublicFields(HostClassDesc.java:331)
	at com.oracle.truffle.host.HostClassDesc$Members.<init>(HostClassDesc.java:147)
	at com.oracle.truffle.host.HostClassDesc.getMembers(HostClassDesc.java:514)
	at com.oracle.truffle.host.HostClassDesc.lookupConstructor(HostClassDesc.java:610)
	at com.oracle.truffle.host.HostObject$LookupConstructorNode.doUncached(HostObject.java:3330)
	at com.oracle.truffle.host.HostObjectFactory$LookupConstructorNodeGen$Inlined.executeAndSpecialize(HostObjectFactory.java:723)
	at com.oracle.truffle.host.HostObjectFactory$LookupConstructorNodeGen$Inlined.execute(HostObjectFactory.java:701)
	at com.oracle.truffle.host.HostObject$Instantiate.doObjectCached(HostObject.java:1602)
	at com.oracle.truffle.host.HostObjectGen$InteropLibraryExports$Cached.instantiateAndSpecialize(HostObjectGen.java:3988)
	at com.oracle.truffle.host.HostObjectGen$InteropLibraryExports$Cached.instantiate(HostObjectGen.java:3959)
	at com.oracle.truffle.api.interop.InteropLibraryGen$CachedDispatch.instantiate(InteropLibraryGen.java:7982)
	at com.oracle.truffle.js.nodes.function.JSNewNode.doNewForeignObject(JSNewNode.java:210)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants