The fix for JDK-8129740 is incomplete. It fails on cases when outer class is a subclass and the entities of it's superclass are referred to in lambda expression.
Reproduced on:
javac 1.8.0_141
and
javac from jdk9 build 9+178
The test source:
A.java
public class A {
public boolean test(){
return true;
}
class AA{
public AA(Condition condition) {
}
}
}
Condition.java
public interface Condition<T> {
boolean check(T t);
}
B.java
public class B extends A {
private final BA myBA;
public B() {
myBA = new BA();
}
public class BA extends AA{
public BA() {
super(o -> test());
}
}
public static void main(String[] args) {
B b = new B();
System.out.println(b);
}
}
source compiles but execution of B fails with:
Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
B$BA.lambda$new$0(LB;Ljava/lang/Object;)Z @1: getfield
Reason:
Type 'B' (current frame, stack[0]) is not assignable to 'B$BA'
Current Frame:
bci: @1
flags: { }
locals: { 'B', 'java/lang/Object' }
stack: { 'B' }
Bytecode:
0x0000000: 2ab4 0001 b600 04ac
at B.<init>(B.java:6)
at B.main(B.java:17)