< prev index next >
src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
Print this page
@@ -2048,20 +2048,35 @@
tSym.setTypeAttributes(lambdaIdent.sym.getRawTypeAttributes());
return t;
}
break;
case CAPTURED_OUTER_THIS:
- if (lambdaIdent.sym.owner.kind == TYP && m.containsKey(lambdaIdent.sym.owner)) {
+ if (lambdaIdent.sym.owner.kind == TYP) {
+ Symbol tSym = null;
+ found_proxy: for (Symbol out:m.keySet()) {
+ Symbol p = out;
+ while (true) {
+ if (lambdaIdent.sym.owner.equals(p)) {
+ tSym = m.get(out);
+ break found_proxy;
+ }
+ Type t2 = ((Symbol.ClassSymbol)p).getSuperclass();
+ if (!t2.hasTag(CLASS) || t2.isErroneous())
+ break;
+ p = t2.tsym;
+ }
+ }
+ if (tSym != null) {
// Transform outer instance variable references anchoring them to the captured synthetic.
- Symbol tSym = m.get(lambdaIdent.sym.owner);
JCExpression t = make.Ident(tSym).setType(lambdaIdent.sym.owner.type);
tSym.setTypeAttributes(lambdaIdent.sym.owner.getRawTypeAttributes());
t = make.Select(t, lambdaIdent.name);
t.setType(lambdaIdent.type);
TreeInfo.setSymbol(t, lambdaIdent.sym);
return t;
}
+ }
break;
}
}
return null;
}
< prev index next >