< prev index next >
src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
Print this page
*** 2007,2017 ****
break;
default:
Assert.error(skind.name());
throw new AssertionError();
}
! if (ret != sym) {
ret.setDeclarationAttributes(sym.getRawAttributes());
ret.setTypeAttributes(sym.getRawTypeAttributes());
}
return ret;
}
--- 2007,2017 ----
break;
default:
Assert.error(skind.name());
throw new AssertionError();
}
! if (ret != sym && skind.propagateAnnotations()) {
ret.setDeclarationAttributes(sym.getRawAttributes());
ret.setTypeAttributes(sym.getRawTypeAttributes());
}
return ret;
}
*** 2043,2062 ****
switch(kind) {
default:
if (m.containsKey(lambdaIdent.sym)) {
Symbol tSym = m.get(lambdaIdent.sym);
JCTree t = make.Ident(tSym).setType(lambdaIdent.type);
- tSym.setTypeAttributes(lambdaIdent.sym.getRawTypeAttributes());
return t;
}
break;
case CAPTURED_OUTER_THIS:
if (lambdaIdent.sym.owner.kind == TYP && m.containsKey(lambdaIdent.sym.owner)) {
// 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;
}
--- 2043,2060 ----
*** 2073,2083 ****
Assert.check(fieldAccess.name == names._this);
Map<Symbol, Symbol> m = translatedSymbols.get(LambdaSymbolKind.CAPTURED_OUTER_THIS);
if (m.containsKey(fieldAccess.sym.owner)) {
Symbol tSym = m.get(fieldAccess.sym.owner);
JCExpression t = make.Ident(tSym).setType(fieldAccess.sym.owner.type);
- tSym.setTypeAttributes(fieldAccess.sym.owner.getRawTypeAttributes());
return t;
}
return null;
}
--- 2071,2080 ----
*** 2270,2279 ****
--- 2267,2287 ----
LOCAL_VAR, // original to translated lambda locals
CAPTURED_VAR, // variables in enclosing scope to translated synthetic parameters
CAPTURED_THIS, // class symbols to translated synthetic parameters (for captured member access)
CAPTURED_OUTER_THIS, // used when `this' capture is illegal, but outer this capture is legit (JDK-8129740)
TYPE_VAR; // original to translated lambda type variables
+
+ boolean propagateAnnotations() {
+ switch (this) {
+ case CAPTURED_VAR:
+ case CAPTURED_THIS:
+ case CAPTURED_OUTER_THIS:
+ return false;
+ default:
+ return true;
+ }
+ }
}
/**
* ****************************************************************
* Signature Generation
< prev index next >