Community
Participate
Working Groups
The following: public class Demo { public class Singleton { private static Singleton pinstance = new Singleton(); public static Singleton instance() { return pinstance; } public String message() { return "Hello world!"; } } public static void main(String[] args) { System.out.println(Singleton.instance().message()); } } compiles fine in eclipse but JVM chrashes when the program is run: Exception in thread "main" java.lang.VerifyError: Bad local variable type Exception Details: Location: Demo$Singleton.<clinit>()V @4: aload_1 Reason: Type top (current frame, locals[1]) is not assignable to reference type Current Frame: bci: @4 flags: { } locals: { } stack: { uninitialized 0, uninitialized 0 } Bytecode: 0000000: bb00 0159 2bb7 000c b300 10b1 at Demo.main(Demo.java:15) Oracle's compiler (javac) run from command line correctly reports an error: Demo.java:5: error: non-static variable this cannot be referenced from a static context private static Singleton pinstance = new Singleton(); OS is Linux 5.8.0-50-generic #56~20.04.1-Ubuntu SMP Mon Apr 12 21:46:35 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
keeping in the radar for 4.20
This works in 4.19, so its a regression in 4.20 - marking so.
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/179871
Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/179871 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=d21d83fa5b10b0212b45e0894a4a64a2dd28e947
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/179922
Verified for 4.20 M3 using build I20210517-0600.