-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
7
-
generic
-
generic
InvokeDynamic throws NoClassDefFoundError in the following test:
package test;
import java.dyn.InvokeDynamic;
import java.dyn.InvokeDynamicBootstrapError;
public class Self {
public static void main(String[] args) {
try {
InvokeDynamic.<void>greet(new Self());
} catch ( InvokeDynamicBootstrapError e ) {
System.out.println("TEST PASSED");
} catch ( Throwable t ) {
System.err.println("Oops!");
t.printStackTrace();
}
}
}
...when it is launched with -classpath:
$ java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -classpath bin test.Self
Oops!
java.lang.NoClassDefFoundError: test/Self
at test.Self.main(Self.java:10)
If we replace -classpath with -Xbootclasspath:
$ java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -Xbootclasspath/a:bin test.Self
TEST PASSED
package test;
import java.dyn.InvokeDynamic;
import java.dyn.InvokeDynamicBootstrapError;
public class Self {
public static void main(String[] args) {
try {
InvokeDynamic.<void>greet(new Self());
} catch ( InvokeDynamicBootstrapError e ) {
System.out.println("TEST PASSED");
} catch ( Throwable t ) {
System.err.println("Oops!");
t.printStackTrace();
}
}
}
...when it is launched with -classpath:
$ java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -classpath bin test.Self
Oops!
java.lang.NoClassDefFoundError: test/Self
at test.Self.main(Self.java:10)
If we replace -classpath with -Xbootclasspath:
$ java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -Xbootclasspath/a:bin test.Self
TEST PASSED