< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java

Print this page

207 
208         if (types.isSignaturePolymorphic(m)) {
209             m.flags_field |= SIGNATURE_POLYMORPHIC;
210         }
211 
212         // Set m.params
213         ListBuffer<VarSymbol> params = new ListBuffer<>();
214         JCVariableDecl lastParam = null;
215         for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
216             JCVariableDecl param = lastParam = l.head;
217             params.append(Assert.checkNonNull(param.sym));
218         }
219         m.params = params.toList();
220 
221         // mark the method varargs, if necessary
222         if (lastParam != null && (lastParam.mods.flags & Flags.VARARGS) != 0)
223             m.flags_field |= Flags.VARARGS;
224 
225         localEnv.info.scope.leave();
226         if (chk.checkUnique(tree.pos(), m, enclScope)) {
227         enclScope.enter(m);
228         }
229 
230         annotate.annotateLater(tree.mods.annotations, localEnv, m, tree.pos());
231         // Visit the signature of the method. Note that
232         // TypeAnnotate doesn't descend into the body.
233         annotate.queueScanTreeAndTypeAnnotate(tree, localEnv, m, tree.pos());
234 
235         if (tree.defaultValue != null) {
236             m.defaultValue = annotate.unfinishedDefaultValue(); // set it to temporary sentinel for now
237             annotate.annotateDefaultValueLater(tree.defaultValue, localEnv, m, tree.pos());
238         }
239     }
240 
241     /** Create a fresh environment for method bodies.
242      *  @param tree     The method definition.
243      *  @param env      The environment current outside of the method definition.
244      */
245     Env<AttrContext> methodEnv(JCMethodDecl tree, Env<AttrContext> env) {
246         Env<AttrContext> localEnv =
247             env.dup(tree, env.info.dup(env.info.scope.dupUnshared(tree.sym)));

207 
208         if (types.isSignaturePolymorphic(m)) {
209             m.flags_field |= SIGNATURE_POLYMORPHIC;
210         }
211 
212         // Set m.params
213         ListBuffer<VarSymbol> params = new ListBuffer<>();
214         JCVariableDecl lastParam = null;
215         for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
216             JCVariableDecl param = lastParam = l.head;
217             params.append(Assert.checkNonNull(param.sym));
218         }
219         m.params = params.toList();
220 
221         // mark the method varargs, if necessary
222         if (lastParam != null && (lastParam.mods.flags & Flags.VARARGS) != 0)
223             m.flags_field |= Flags.VARARGS;
224 
225         localEnv.info.scope.leave();
226         if (chk.checkUnique(tree.pos(), m, enclScope)) {
227             enclScope.enter(m);
228         }
229 
230         annotate.annotateLater(tree.mods.annotations, localEnv, m, tree.pos());
231         // Visit the signature of the method. Note that
232         // TypeAnnotate doesn't descend into the body.
233         annotate.queueScanTreeAndTypeAnnotate(tree, localEnv, m, tree.pos());
234 
235         if (tree.defaultValue != null) {
236             m.defaultValue = annotate.unfinishedDefaultValue(); // set it to temporary sentinel for now
237             annotate.annotateDefaultValueLater(tree.defaultValue, localEnv, m, tree.pos());
238         }
239     }
240 
241     /** Create a fresh environment for method bodies.
242      *  @param tree     The method definition.
243      *  @param env      The environment current outside of the method definition.
244      */
245     Env<AttrContext> methodEnv(JCMethodDecl tree, Env<AttrContext> env) {
246         Env<AttrContext> localEnv =
247             env.dup(tree, env.info.dup(env.info.scope.dupUnshared(tree.sym)));
< prev index next >