Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8163768 | 8u121 | Srikanth Adayapalam | P4 | Resolved | Fixed | b01 |
JDK-8157818 | 8u112 | Srikanth Adayapalam | P4 | Resolved | Fixed | b01 |
JDK-8167935 | emb-8u121 | Srikanth Adayapalam | P4 | Resolved | Fixed | b01 |
Reproduced on all of these:
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
java version "1.9.0-ea"
Java(TM) SE Runtime Environment (build 1.9.0-ea-b57)
Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b57, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7600]
A DESCRIPTION OF THE PROBLEM :
I compile the following class (CompilerBug.java)
public class CompilerBug {
int var = 0;
public static void main(String[] args) {
new CompilerBug().new Inner();
}
public class Inner {
public Inner(Runnable r) {}
public Inner() {
this(() -> {
var = 1;
});
}
}
}
Compilation finishes without errors. However I see a VerifyError when running the compiled CompilerBug.class
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create file CompilerBug.java (see "source code" section):
2. Compile it:
javac CompilerBug.java
3. Run the compiled class:
java CompilerBug
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Compilation error on step 2 like it's reported by ECJ:
1. ERROR in C:\projects\Test\src\CompilerBug.java (at line 12)
this(() -> {
^^^^^
Cannot refer to 'this' nor 'super' while explicitly invoking a constructor
ACTUAL -
Compilation goes fine, but when compiled class is launched (step 3) the following error is displayed:
Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
CompilerBug$Inner.<init>(LCompilerBug;)V @3: invokedynamic
Reason:
Type uninitializedThis (current frame, stack[2]) is not assignable to 'CompilerBug$Inner'
Current Frame:
bci: @3
flags: { flagThisUninit }
locals: { uninitializedThis, 'CompilerBug' }
stack: { uninitializedThis, 'CompilerBug', uninitializedThis }
Bytecode:
0000000: 2a2b 2aba 0003 0000 b700 04b1
at CompilerBug.main(CompilerBug.java:5)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class CompilerBug {
int var = 0;
public static void main(String[] args) {
new CompilerBug().new Inner();
}
public class Inner {
public Inner(Runnable r) {}
public Inner() {
this(() -> {
var = 1;
});
}
}
}
---------- END SOURCE ----------
- backported by
-
JDK-8157818 Incorrect class file created when passing lambda in inner class constructor
-
- Resolved
-
-
JDK-8163768 Incorrect class file created when passing lambda in inner class constructor
-
- Resolved
-
-
JDK-8167935 Incorrect class file created when passing lambda in inner class constructor
-
- Resolved
-
- duplicates
-
JDK-8133111 Method handles of outer classes are resolved via the inner class
-
- Closed
-
-
JDK-8157142 Verifier error when using a lambda in super constructor call
-
- Closed
-
-
JDK-8143120 Compiler generates invalid bytecode in some cases when using lambda syntax
-
- Closed
-
- relates to
-
JDK-8184989 Incorrect class file created when passing lambda in inner class constructor and outer is subclass
-
- Resolved
-
-
JDK-8145051 Wrong parameter name in synthetic lambda method leads to verifier error
-
- Closed
-
-
JDK-8157142 Verifier error when using a lambda in super constructor call
-
- Closed
-