Package Bugginess
Robert J. Saulnier
robert.j.saulnier at gmail.com
Mon Apr 15 20:17:08 PDT 2013
Ok, I have a class with a print method in one package, and a subclass with
an overloaded print method in another package. I know, bad idea, but I did
it for testing purposes.. yeah that sounds plausible.
So this works fine on Windows 7 with Lambda build 84 (maybe 85, I'll
confirm tomorrow at work), but failed when I tried it on Linux with Lambda
build 84.
The code below spits out the following stack trace:
Exception in thread "main" java.lang.BootstrapMethodError: call site
initialization exception
at java.lang.invoke.CallSite.makeSite(CallSite.java:298)
at
java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:294)
at lambdabug.sub.LambdaBug.print(LambdaBug.java:18)
at lambdabug.sub.LambdaBug.main(LambdaBug.java:12)
Caused by: java.lang.NullPointerException
at java.lang.invoke.MethodHandleInfo.<init>(MethodHandleInfo.java:53)
at
java.lang.invoke.AbstractValidatingLambdaMetafactory.<init>(AbstractValidatingLambdaMetafactory.java:104)
at
java.lang.invoke.InnerClassLambdaMetafactory.<init>(InnerClassLambdaMetafactory.java:108)
at
java.lang.invoke.LambdaMetafactory.metaFactory(LambdaMetafactory.java:188)
at java.lang.invoke.CallSite.makeSite(CallSite.java:283)
... 3 more
Is this known behaviour?
package lambdabug;
public class SuperBug {
protected void print(Integer num) {
System.out.println(num);
}
}
package lambdabug.sub;
import lambdabug.SuperBug;
import java.util.Arrays;
import java.util.List;
public class LambdaBug extends SuperBug {
public static void main(String[] args) {
LambdaBug bug = new LambdaBug();
bug.print("");
}
private void print(String str) {
List<Integer> nums = Arrays.asList(1, 2, 3);
nums.forEach(this::print);
// nums.forEach(num -> print(num));
}
}
More information about the lambda-dev
mailing list