src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
Print this page
*** 29,48 ****
--- 29,50 ----
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
+ import javax.lang.model.type.TypeKind;
import javax.tools.JavaFileObject;
import com.sun.tools.javac.code.*;
import com.sun.tools.javac.jvm.*;
import com.sun.tools.javac.tree.*;
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.code.Type.*;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.tree.JCTree.*;
+ import com.sun.tools.javac.code.TypeAnnotationPosition.*;
import static com.sun.tools.javac.code.Flags.*;
import static com.sun.tools.javac.code.Flags.ANNOTATION;
import static com.sun.tools.javac.code.Kinds.*;
import static com.sun.tools.javac.code.TypeTag.CLASS;
*** 111,120 ****
--- 113,123 ----
source = Source.instance(context);
target = Target.instance(context);
deferredLintHandler = DeferredLintHandler.instance(context);
lint = Lint.instance(context);
allowTypeAnnos = source.allowTypeAnnotations();
+ speculative = false;
}
/** Switch: support type annotations.
*/
boolean allowTypeAnnos;
*** 133,142 ****
--- 136,150 ----
* enter, as we only need to look up types. This avoids
* unnecessarily deep recursion.
*/
boolean completionEnabled = true;
+ /** The creator that will be used for any varDef's we visit. */
+ Annotate.PositionCreator creator;
+
+ boolean speculative;
+
/* ---------- Processing import clauses ----------------
*/
/** Import all classes of a class or package on demand.
* @param pos Position to be used for error reporting.
*** 359,403 ****
* @param recvparam The method's receiver parameter,
* null if none given; TODO: or already set here?
* @param thrown The method's thrown exceptions.
* @param env The method's (local) environment.
*/
! Type signature(MethodSymbol msym,
! List<JCTypeParameter> typarams,
! List<JCVariableDecl> params,
! JCTree res,
! JCVariableDecl recvparam,
! List<JCExpression> thrown,
! Env<AttrContext> env) {
// Enter and attribute type parameters.
List<Type> tvars = enter.classEnter(typarams, env);
! attr.attribTypeVariables(typarams, env);
// Enter and attribute value parameters.
ListBuffer<Type> argbuf = new ListBuffer<>();
! for (List<JCVariableDecl> l = params; l.nonEmpty(); l = l.tail) {
! memberEnter(l.head, env);
argbuf.append(l.head.vartype.type);
}
// Attribute result type, if one is given.
! Type restype = res == null ? syms.voidType : attr.attribType(res, env);
// Attribute receiver type, if one is given.
Type recvtype;
if (recvparam!=null) {
! memberEnter(recvparam, env);
recvtype = recvparam.vartype.type;
} else {
recvtype = null;
}
// Attribute thrown exceptions.
ListBuffer<Type> thrownbuf = new ListBuffer<>();
! for (List<JCExpression> l = thrown; l.nonEmpty(); l = l.tail) {
! Type exc = attr.attribType(l.head, env);
if (!exc.hasTag(TYPEVAR)) {
exc = chk.checkClassType(l.head.pos(), exc);
} else if (exc.tsym.owner == msym) {
//mark inference variables in 'throws' clause
exc.tsym.flags_field |= THROWS;
--- 367,459 ----
* @param recvparam The method's receiver parameter,
* null if none given; TODO: or already set here?
* @param thrown The method's thrown exceptions.
* @param env The method's (local) environment.
*/
! Type signature(final MethodSymbol msym,
! final List<JCTypeParameter> typarams,
! final List<JCVariableDecl> params,
! final JCTree res,
! final JCVariableDecl recvparam,
! final List<JCExpression> thrown,
! final Env<AttrContext> env,
! final List<JCAnnotation> declAnnos,
! final DiagnosticPosition deferPos) {
! int i;
// Enter and attribute type parameters.
List<Type> tvars = enter.classEnter(typarams, env);
! attr.attribTypeVariables(typarams, env, currentLambda, speculative);
!
! // Handle type annotations on type parameters
! i = 0;
! for (List<JCTypeParameter> l = typarams; l.nonEmpty();
! l = l.tail, i++) {
! final JCTypeParameter param = l.head;
! annotate.annotateTypeLater(param, env, msym, deferPos, currentLambda,
! annotate.methodTypeParamCreator(i),
! speculative);
!
! int j = 0;
! for (List<JCExpression> bounds = param.bounds;
! bounds.nonEmpty(); bounds = bounds.tail, j++) {
! annotate.annotateTypeLater(bounds.head, env, msym, deferPos, currentLambda,
! annotate.methodTypeParamBoundCreator(param, i, j),
! speculative);
! }
! }
// Enter and attribute value parameters.
ListBuffer<Type> argbuf = new ListBuffer<>();
! i = 0;
! for (List<JCVariableDecl> l = params; l.nonEmpty(); l = l.tail, i++) {
! memberEnter(l.head, env, annotate.paramCreator(i));
argbuf.append(l.head.vartype.type);
}
// Attribute result type, if one is given.
! Type restype;
!
! if (res != null) {
! restype = attr.attribType(res, env, currentLambda, speculative);
! annotate.annotateTypeLater(res, declAnnos, env, msym, deferPos,
! currentLambda, annotate.returnCreator,
! speculative);
! } else {
! // For constructors, synthesize a type annotation position
! List<TypePathEntry> typepath = List.nil();
! Type encl = msym.owner.type.getEnclosingType();
! while (encl != null && encl.getKind() != TypeKind.NONE &&
! encl.getKind() != TypeKind.ERROR) {
! typepath = typepath.prepend(TypePathEntry.INNER_TYPE);
! encl = encl.getEnclosingType();
! }
! TypeAnnotationPosition tapos =
! TypeAnnotationPosition.methodReturn(typepath, currentLambda, -1);
! annotate.annotateLater(declAnnos, env, msym, deferPos, tapos);
! restype = syms.voidType;
! }
!
// Attribute receiver type, if one is given.
Type recvtype;
if (recvparam!=null) {
! memberEnter(recvparam, env, annotate.receiverCreator);
recvtype = recvparam.vartype.type;
} else {
recvtype = null;
}
// Attribute thrown exceptions.
ListBuffer<Type> thrownbuf = new ListBuffer<>();
! i = 0;
! for (List<JCExpression> l = thrown; l.nonEmpty(); l = l.tail, i++) {
! Type exc = attr.attribType(l.head, env, currentLambda, speculative);
! annotate.annotateTypeLater(l.head, env, msym, deferPos,
! currentLambda,
! annotate.throwCreator(i),
! speculative);
if (!exc.hasTag(TYPEVAR)) {
exc = chk.checkClassType(l.head.pos(), exc);
} else if (exc.tsym.owner == msym) {
//mark inference variables in 'throws' clause
exc.tsym.flags_field |= THROWS;
*** 419,458 ****
/** Visitor argument: the current environment
*/
protected Env<AttrContext> env;
/** Enter field and method definitions and process import
* clauses, catching any completion failure exceptions.
*/
! protected void memberEnter(JCTree tree, Env<AttrContext> env) {
Env<AttrContext> prevEnv = this.env;
try {
this.env = env;
tree.accept(this);
} catch (CompletionFailure ex) {
chk.completionError(tree.pos(), ex);
} finally {
this.env = prevEnv;
}
}
/** Enter members from a list of trees.
*/
! void memberEnter(List<? extends JCTree> trees, Env<AttrContext> env) {
for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail)
! memberEnter(l.head, env);
}
/** Enter members for a class.
*/
! void finishClass(JCClassDecl tree, Env<AttrContext> env) {
if ((tree.mods.flags & Flags.ENUM) != 0 &&
(types.supertype(tree.sym.type).tsym.flags() & Flags.ENUM) == 0) {
addEnumMembers(tree, env);
}
! memberEnter(tree.defs, env);
}
/** Add the implicit members for an enum type
* to the symbol table.
*/
--- 475,553 ----
/** Visitor argument: the current environment
*/
protected Env<AttrContext> env;
+ protected JCLambda currentLambda;
+
/** Enter field and method definitions and process import
* clauses, catching any completion failure exceptions.
*/
! protected void memberEnter(JCTree tree, Env<AttrContext> env,
! Annotate.PositionCreator creator,
! JCLambda lambda,
! boolean speculative) {
Env<AttrContext> prevEnv = this.env;
+ Annotate.PositionCreator prevCreator = this.creator;
+ JCLambda prevLambda = this.currentLambda;
+ boolean prevSpeculative = this.speculative;
try {
this.env = env;
+ this.creator = creator;
+ this.currentLambda = lambda;
+ this.speculative = speculative;
tree.accept(this);
} catch (CompletionFailure ex) {
chk.completionError(tree.pos(), ex);
} finally {
+ this.creator = prevCreator;
this.env = prevEnv;
+ this.currentLambda = prevLambda;
+ this.speculative = prevSpeculative;
}
}
+ protected void memberEnter(JCTree tree,
+ Env<AttrContext> env,
+ Annotate.PositionCreator creator) {
+ memberEnter(tree, env, creator, currentLambda, speculative);
+ }
+
+ protected void memberEnter(JCTree tree, Env<AttrContext> env) {
+ memberEnter(tree, env, annotate.noCreator, currentLambda, speculative);
+ }
+
/** Enter members from a list of trees.
*/
! void memberEnter(List<? extends JCTree> trees,
! Env<AttrContext> env,
! Annotate.PositionCreator creator,
! JCLambda lambda,
! boolean speculative) {
for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail)
! memberEnter(l.head, env, creator, lambda, speculative);
! }
!
! void memberEnter(List<? extends JCTree> trees,
! Env<AttrContext> env,
! Annotate.PositionCreator creator) {
! memberEnter(trees, env, creator, currentLambda, speculative);
! }
!
! void memberEnter(List<? extends JCTree> trees,
! Env<AttrContext> env) {
! memberEnter(trees, env, annotate.noCreator, currentLambda, speculative);
}
/** Enter members for a class.
*/
! void finishClass(final JCClassDecl tree, final Env<AttrContext> env) {
if ((tree.mods.flags & Flags.ENUM) != 0 &&
(types.supertype(tree.sym.type).tsym.flags() & Flags.ENUM) == 0) {
addEnumMembers(tree, env);
}
! memberEnter(tree.defs, env, annotate.fieldCreator);
}
/** Add the implicit members for an enum type
* to the symbol table.
*/
*** 523,533 ****
}
p = p.owner;
}
}
// process package annotations
! annotate.annotateLater(tree.annotations, env, env.toplevel.packge, null);
}
// process the non-static imports and the static imports of types.
public void visitImport(JCImport tree) {
JCFieldAccess imp = (JCFieldAccess)tree.qualid;
--- 618,628 ----
}
p = p.owner;
}
}
// process package annotations
! annotate.annotateLater(tree.annotations, env, env.toplevel.packge);
}
// process the non-static imports and the static imports of types.
public void visitImport(JCImport tree) {
JCFieldAccess imp = (JCFieldAccess)tree.qualid;
*** 535,545 ****
// Create a local environment pointing to this tree to disable
// effects of other imports in Resolve.findGlobalType
Env<AttrContext> localEnv = env.dup(tree);
! TypeSymbol p = attr.attribImportQualifier(tree, localEnv).tsym;
if (name == names.asterisk) {
// Import on demand.
chk.checkCanonical(imp.selected);
if (tree.staticImport)
importStaticAll(tree.pos, p, env);
--- 630,641 ----
// Create a local environment pointing to this tree to disable
// effects of other imports in Resolve.findGlobalType
Env<AttrContext> localEnv = env.dup(tree);
! TypeSymbol p = attr.attribImportQualifier(tree, localEnv, currentLambda,
! speculative).tsym;
if (name == names.asterisk) {
// Import on demand.
chk.checkCanonical(imp.selected);
if (tree.staticImport)
importStaticAll(tree.pos, p, env);
*** 576,587 ****
DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos());
try {
// Compute the method type
m.type = signature(m, tree.typarams, tree.params,
tree.restype, tree.recvparam,
! tree.thrown,
! localEnv);
} finally {
deferredLintHandler.setPos(prevLintPos);
}
if (types.isSignaturePolymorphic(m)) {
--- 672,683 ----
DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos());
try {
// Compute the method type
m.type = signature(m, tree.typarams, tree.params,
tree.restype, tree.recvparam,
! tree.thrown, localEnv,
! tree.mods.annotations, tree.pos());
} finally {
deferredLintHandler.setPos(prevLintPos);
}
if (types.isSignaturePolymorphic(m)) {
*** 604,620 ****
localEnv.info.scope.leave();
if (chk.checkUnique(tree.pos(), m, enclScope)) {
enclScope.enter(m);
}
- annotate.annotateLater(tree.mods.annotations, localEnv, m, tree.pos());
- // Visit the signature of the method. Note that
- // TypeAnnotate doesn't descend into the body.
- annotate.annotateTypeLater(tree, localEnv, m, tree.pos());
-
if (tree.defaultValue != null)
! annotateDefaultValueLater(tree.defaultValue, localEnv, m);
} finally {
annotate.enterDone();
}
}
--- 700,712 ----
localEnv.info.scope.leave();
if (chk.checkUnique(tree.pos(), m, enclScope)) {
enclScope.enter(m);
}
if (tree.defaultValue != null)
! annotateDefaultValueLater(tree.defaultValue, localEnv,
! m, annotate.noCreator);
} finally {
annotate.enterDone();
}
}
*** 647,657 ****
try {
try {
if (TreeInfo.isEnumInit(tree)) {
attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype);
} else {
! attr.attribType(tree.vartype, localEnv);
if (tree.nameexpr != null) {
attr.attribExpr(tree.nameexpr, localEnv);
MethodSymbol m = localEnv.enclMethod.sym;
if (m.isConstructor()) {
Type outertype = m.owner.owner.type;
--- 739,750 ----
try {
try {
if (TreeInfo.isEnumInit(tree)) {
attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype);
} else {
! attr.attribType(tree.vartype, localEnv,
! currentLambda, speculative);
if (tree.nameexpr != null) {
attr.attribExpr(tree.nameexpr, localEnv);
MethodSymbol m = localEnv.enclMethod.sym;
if (m.isConstructor()) {
Type outertype = m.owner.owner.type;
*** 690,708 ****
v.flags_field |= HASINIT;
if ((v.flags_field & FINAL) != 0 &&
needsLazyConstValue(tree.init)) {
Env<AttrContext> initEnv = getInitEnv(tree, env);
initEnv.info.enclVar = v;
! v.setLazyConstValue(initEnv(tree, initEnv), attr, tree);
}
}
if (chk.checkUnique(tree.pos(), v, enclScope)) {
chk.checkTransparentVar(tree.pos(), v, enclScope);
enclScope.enter(v);
}
! annotate.annotateLater(tree.mods.annotations, localEnv, v, tree.pos());
! annotate.annotateTypeLater(tree.vartype, env, v, tree.pos());
v.pos = tree.pos;
} finally {
annotate.enterDone();
}
}
--- 783,803 ----
v.flags_field |= HASINIT;
if ((v.flags_field & FINAL) != 0 &&
needsLazyConstValue(tree.init)) {
Env<AttrContext> initEnv = getInitEnv(tree, env);
initEnv.info.enclVar = v;
! v.setLazyConstValue(initEnv(tree, initEnv), attr, tree,
! currentLambda, speculative);
}
}
if (chk.checkUnique(tree.pos(), v, enclScope)) {
chk.checkTransparentVar(tree.pos(), v, enclScope);
enclScope.enter(v);
}
! annotate.annotateTypeLater(tree.vartype, tree.mods.annotations,
! localEnv, v, tree.pos(),
! currentLambda, creator, speculative);
v.pos = tree.pos;
} finally {
annotate.enterDone();
}
}
*** 829,839 ****
Assert.check(completionEnabled);
try {
// To prevent deep recursion, suppress completion of some
// types.
completionEnabled = false;
! return attr.attribType(tree, env);
} finally {
completionEnabled = true;
}
}
--- 924,934 ----
Assert.check(completionEnabled);
try {
// To prevent deep recursion, suppress completion of some
// types.
completionEnabled = false;
! return attr.attribType(tree, env, currentLambda, speculative);
} finally {
completionEnabled = true;
}
}
*** 851,873 ****
}
/** Queue processing of an attribute default value. */
void annotateDefaultValueLater(final JCExpression defaultValue,
final Env<AttrContext> localEnv,
! final MethodSymbol m) {
annotate.normal(new Annotate.Worker() {
@Override
public String toString() {
return "annotate " + m.owner + "." +
m + " default " + defaultValue;
}
@Override
public void run() {
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
try {
! enterDefaultValue(defaultValue, localEnv, m);
} finally {
log.useSource(prev);
}
}
});
--- 946,970 ----
}
/** Queue processing of an attribute default value. */
void annotateDefaultValueLater(final JCExpression defaultValue,
final Env<AttrContext> localEnv,
! final MethodSymbol m,
! final Annotate.PositionCreator creator) {
annotate.normal(new Annotate.Worker() {
@Override
public String toString() {
return "annotate " + m.owner + "." +
m + " default " + defaultValue;
}
@Override
public void run() {
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
+ final TypeAnnotationPosition position = creator.create();
try {
! enterDefaultValue(defaultValue, localEnv, m, position);
} finally {
log.useSource(prev);
}
}
});
*** 887,900 ****
}
/** Enter a default value for an attribute method. */
private void enterDefaultValue(final JCExpression defaultValue,
final Env<AttrContext> localEnv,
! final MethodSymbol m) {
m.defaultValue = annotate.enterAttributeValue(m.type.getReturnType(),
defaultValue,
! localEnv);
}
/* ********************************************************************
* Source completer
*********************************************************************/
--- 984,999 ----
}
/** Enter a default value for an attribute method. */
private void enterDefaultValue(final JCExpression defaultValue,
final Env<AttrContext> localEnv,
! final MethodSymbol m,
! final TypeAnnotationPosition position) {
m.defaultValue = annotate.enterAttributeValue(m.type.getReturnType(),
defaultValue,
! localEnv,
! position);
}
/* ********************************************************************
* Source completer
*********************************************************************/
*** 909,918 ****
--- 1008,1018 ----
Assert.check((sym.flags() & Flags.COMPOUND) == 0);
sym.completer = this;
return;
}
+ int i;
ClassSymbol c = (ClassSymbol)sym;
ClassType ct = (ClassType)c.type;
Env<AttrContext> env = enter.typeEnvs.get(c);
JCClassDecl tree = (JCClassDecl)env.tree;
boolean wasFirst = isFirst;
*** 938,982 ****
c.owner.complete();
// create an environment for evaluating the base clauses
Env<AttrContext> baseEnv = baseEnv(tree, env);
- if (tree.extending != null)
- annotate.annotateTypeLater(tree.extending, baseEnv, sym, tree.pos());
- for (JCExpression impl : tree.implementing)
- annotate.annotateTypeLater(impl, baseEnv, sym, tree.pos());
- annotate.flush();
-
// Determine supertype.
! Type supertype =
! (tree.extending != null)
! ? attr.attribBase(tree.extending, baseEnv, true, false, true)
! : ((tree.mods.flags & Flags.ENUM) != 0)
? attr.attribBase(enumBase(tree.pos, c), baseEnv,
! true, false, false)
: (c.fullname == names.java_lang_Object)
? Type.noType
: syms.objectType;
ct.supertype_field = modelMissingTypes(supertype, tree.extending, false);
// Determine interfaces.
ListBuffer<Type> interfaces = new ListBuffer<>();
ListBuffer<Type> all_interfaces = null; // lazy init
Set<Type> interfaceSet = new HashSet<>();
List<JCExpression> interfaceTrees = tree.implementing;
for (JCExpression iface : interfaceTrees) {
! Type i = attr.attribBase(iface, baseEnv, false, true, true);
! if (i.hasTag(CLASS)) {
! interfaces.append(i);
! if (all_interfaces != null) all_interfaces.append(i);
! chk.checkNotRepeated(iface.pos(), types.erasure(i), interfaceSet);
} else {
if (all_interfaces == null)
all_interfaces = new ListBuffer<Type>().appendList(interfaces);
! all_interfaces.append(modelMissingTypes(i, iface, true));
}
}
if ((c.flags_field & ANNOTATION) != 0) {
ct.interfaces_field = List.of(syms.annotationType);
ct.all_interfaces_field = ct.interfaces_field;
} else {
ct.interfaces_field = interfaces.toList();
--- 1038,1094 ----
c.owner.complete();
// create an environment for evaluating the base clauses
Env<AttrContext> baseEnv = baseEnv(tree, env);
// Determine supertype.
! Type supertype;
!
! if (tree.extending != null) {
! supertype = attr.attribBase(tree.extending, baseEnv,
! true, false, true, currentLambda,
! speculative);
! annotate.annotateTypeLater(tree.extending, baseEnv, sym,
! tree.pos(), currentLambda,
! annotate.extendsCreator,
! speculative);
! } else {
! supertype = ((tree.mods.flags & Flags.ENUM) != 0)
? attr.attribBase(enumBase(tree.pos, c), baseEnv,
! true, false, false, currentLambda,
! speculative)
: (c.fullname == names.java_lang_Object)
? Type.noType
: syms.objectType;
+ }
ct.supertype_field = modelMissingTypes(supertype, tree.extending, false);
// Determine interfaces.
ListBuffer<Type> interfaces = new ListBuffer<>();
ListBuffer<Type> all_interfaces = null; // lazy init
Set<Type> interfaceSet = new HashSet<>();
List<JCExpression> interfaceTrees = tree.implementing;
+ i = 0;
for (JCExpression iface : interfaceTrees) {
! Type it = attr.attribBase(iface, baseEnv, false, true, true,
! currentLambda, speculative);
! if (it.hasTag(CLASS)) {
! interfaces.append(it);
! if (all_interfaces != null) all_interfaces.append(it);
! chk.checkNotRepeated(iface.pos(), types.erasure(it), interfaceSet);
} else {
if (all_interfaces == null)
all_interfaces = new ListBuffer<Type>().appendList(interfaces);
! all_interfaces.append(modelMissingTypes(it, iface, true));
!
}
+ annotate.annotateTypeLater(iface, baseEnv, sym, tree.pos(),
+ currentLambda, annotate.implementsCreator(i++),
+ speculative);
}
+ annotate.flush();
+
if ((c.flags_field & ANNOTATION) != 0) {
ct.interfaces_field = List.of(syms.annotationType);
ct.all_interfaces_field = ct.interfaces_field;
} else {
ct.interfaces_field = interfaces.toList();
*** 999,1020 ****
// Annotations.
// In general, we cannot fully process annotations yet, but we
// can attribute the annotation types and then check to see if the
// @Deprecated annotation is present.
! attr.attribAnnotationTypes(tree.mods.annotations, baseEnv);
if (hasDeprecatedAnnotation(tree.mods.annotations))
c.flags_field |= DEPRECATED;
annotate.annotateLater(tree.mods.annotations, baseEnv, c, tree.pos());
// class type parameters use baseEnv but everything uses env
chk.checkNonCyclicDecl(tree);
! attr.attribTypeVariables(tree.typarams, baseEnv);
// Do this here, where we have the symbol.
! for (JCTypeParameter tp : tree.typarams)
! annotate.annotateTypeLater(tp, baseEnv, sym, tree.pos());
// Add default constructor if needed.
if ((c.flags() & INTERFACE) == 0 &&
!TreeInfo.hasConstructors(tree.defs)) {
List<Type> argtypes = List.nil();
--- 1111,1151 ----
// Annotations.
// In general, we cannot fully process annotations yet, but we
// can attribute the annotation types and then check to see if the
// @Deprecated annotation is present.
! attr.attribAnnotationTypes(tree.mods.annotations, baseEnv,
! currentLambda, speculative);
if (hasDeprecatedAnnotation(tree.mods.annotations))
c.flags_field |= DEPRECATED;
annotate.annotateLater(tree.mods.annotations, baseEnv, c, tree.pos());
// class type parameters use baseEnv but everything uses env
chk.checkNonCyclicDecl(tree);
! attr.attribTypeVariables(tree.typarams, baseEnv,
! currentLambda, speculative);
// Do this here, where we have the symbol.
! i = 0;
! for (List<JCTypeParameter> l = tree.typarams; l.nonEmpty();
! l = l.tail, i++) {
! final JCTypeParameter typaram = l.head;
! annotate.annotateTypeLater(typaram, baseEnv, sym, tree.pos(),
! currentLambda, annotate.typeParamCreator(i),
! speculative);
!
! int j = 0;
! for(List<JCExpression> b = typaram.bounds; b.nonEmpty();
! b = b.tail, j++) {
! final JCExpression bound = b.head;
! annotate.annotateTypeLater(bound, baseEnv, sym,
! tree.pos(), currentLambda,
! annotate.typeParamBoundCreator(typaram, i, j),
! speculative);
! }
!
! }
// Add default constructor if needed.
if ((c.flags() & INTERFACE) == 0 &&
!TreeInfo.hasConstructors(tree.defs)) {
List<Type> argtypes = List.nil();
*** 1091,1101 ****
try {
while (halfcompleted.nonEmpty()) {
Env<AttrContext> toFinish = halfcompleted.next();
finish(toFinish);
if (allowTypeAnnos) {
! typeAnnotations.organizeTypeAnnotationsSignatures(toFinish, (JCClassDecl)toFinish.tree);
typeAnnotations.validateTypeAnnotationsSignatures(toFinish, (JCClassDecl)toFinish.tree);
}
}
} finally {
isFirst = true;
--- 1222,1233 ----
try {
while (halfcompleted.nonEmpty()) {
Env<AttrContext> toFinish = halfcompleted.next();
finish(toFinish);
if (allowTypeAnnos) {
! // Note: This call is slated for removal in
! // the next patch
typeAnnotations.validateTypeAnnotationsSignatures(toFinish, (JCClassDecl)toFinish.tree);
}
}
} finally {
isFirst = true;