73 private final Todo todo; |
73 private final Todo todo; |
74 private final Annotate annotate; |
74 private final Annotate annotate; |
75 private final Types types; |
75 private final Types types; |
76 private final JCDiagnostic.Factory diags; |
76 private final JCDiagnostic.Factory diags; |
77 private final Target target; |
77 private final Target target; |
|
78 private final DeferredLintHandler deferredLintHandler; |
78 |
79 |
79 private final boolean skipAnnotations; |
80 private final boolean skipAnnotations; |
80 private final boolean allowSimplifiedVarargs; |
|
81 |
81 |
82 public static MemberEnter instance(Context context) { |
82 public static MemberEnter instance(Context context) { |
83 MemberEnter instance = context.get(memberEnterKey); |
83 MemberEnter instance = context.get(memberEnterKey); |
84 if (instance == null) |
84 if (instance == null) |
85 instance = new MemberEnter(context); |
85 instance = new MemberEnter(context); |
100 todo = Todo.instance(context); |
100 todo = Todo.instance(context); |
101 annotate = Annotate.instance(context); |
101 annotate = Annotate.instance(context); |
102 types = Types.instance(context); |
102 types = Types.instance(context); |
103 diags = JCDiagnostic.Factory.instance(context); |
103 diags = JCDiagnostic.Factory.instance(context); |
104 target = Target.instance(context); |
104 target = Target.instance(context); |
|
105 deferredLintHandler = DeferredLintHandler.instance(context); |
105 Options options = Options.instance(context); |
106 Options options = Options.instance(context); |
106 skipAnnotations = options.isSet("skipAnnotations"); |
107 skipAnnotations = options.isSet("skipAnnotations"); |
107 Source source = Source.instance(context); |
|
108 allowSimplifiedVarargs = source.allowSimplifiedVarargs(); |
|
109 } |
108 } |
110 |
109 |
111 /** A queue for classes whose members still need to be entered into the |
110 /** A queue for classes whose members still need to be entered into the |
112 * symbol table. |
111 * symbol table. |
113 */ |
112 */ |
569 MethodSymbol m = new MethodSymbol(0, tree.name, null, enclScope.owner); |
568 MethodSymbol m = new MethodSymbol(0, tree.name, null, enclScope.owner); |
570 m.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, m, tree); |
569 m.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, m, tree); |
571 tree.sym = m; |
570 tree.sym = m; |
572 Env<AttrContext> localEnv = methodEnv(tree, env); |
571 Env<AttrContext> localEnv = methodEnv(tree, env); |
573 |
572 |
574 // Compute the method type |
573 DeferredLintHandler prevLintHandler = |
575 m.type = signature(tree.typarams, tree.params, |
574 chk.setDeferredLintHandler(deferredLintHandler.setPos(tree.pos())); |
576 tree.restype, tree.thrown, |
575 try { |
577 localEnv); |
576 // Compute the method type |
|
577 m.type = signature(tree.typarams, tree.params, |
|
578 tree.restype, tree.thrown, |
|
579 localEnv); |
|
580 } finally { |
|
581 chk.setDeferredLintHandler(prevLintHandler); |
|
582 } |
578 |
583 |
579 // Set m.params |
584 // Set m.params |
580 ListBuffer<VarSymbol> params = new ListBuffer<VarSymbol>(); |
585 ListBuffer<VarSymbol> params = new ListBuffer<VarSymbol>(); |
581 JCVariableDecl lastParam = null; |
586 JCVariableDecl lastParam = null; |
582 for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) { |
587 for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) { |
616 if ((tree.mods.flags & STATIC) != 0 || |
621 if ((tree.mods.flags & STATIC) != 0 || |
617 (env.info.scope.owner.flags() & INTERFACE) != 0) { |
622 (env.info.scope.owner.flags() & INTERFACE) != 0) { |
618 localEnv = env.dup(tree, env.info.dup()); |
623 localEnv = env.dup(tree, env.info.dup()); |
619 localEnv.info.staticLevel++; |
624 localEnv.info.staticLevel++; |
620 } |
625 } |
621 attr.attribType(tree.vartype, localEnv); |
626 DeferredLintHandler prevLintHandler = |
|
627 chk.setDeferredLintHandler(deferredLintHandler.setPos(tree.pos())); |
|
628 try { |
|
629 attr.attribType(tree.vartype, localEnv); |
|
630 } finally { |
|
631 chk.setDeferredLintHandler(prevLintHandler); |
|
632 } |
|
633 |
622 if ((tree.mods.flags & VARARGS) != 0) { |
634 if ((tree.mods.flags & VARARGS) != 0) { |
623 //if we are entering a varargs parameter, we need to replace its type |
635 //if we are entering a varargs parameter, we need to replace its type |
624 //(a plain array type) with the more precise VarargsType --- we need |
636 //(a plain array type) with the more precise VarargsType --- we need |
625 //to do it this way because varargs is represented in the tree as a modifier |
637 //to do it this way because varargs is represented in the tree as a modifier |
626 //on the parameter declaration, and not as a distinct type of array node. |
638 //on the parameter declaration, and not as a distinct type of array node. |