225 // Visit the signature of the method. Note that |
225 // Visit the signature of the method. Note that |
226 // TypeAnnotate doesn't descend into the body. |
226 // TypeAnnotate doesn't descend into the body. |
227 annotate.annotateTypeLater(tree, localEnv, m, tree.pos()); |
227 annotate.annotateTypeLater(tree, localEnv, m, tree.pos()); |
228 |
228 |
229 if (tree.defaultValue != null) |
229 if (tree.defaultValue != null) |
230 annotateDefaultValueLater(tree.defaultValue, localEnv, m); |
230 annotateDefaultValueLater(tree.defaultValue, localEnv, m, tree.pos()); |
231 } |
231 } |
232 |
232 |
233 /** Create a fresh environment for method bodies. |
233 /** Create a fresh environment for method bodies. |
234 * @param tree The method definition. |
234 * @param tree The method definition. |
235 * @param env The environment current outside of the method definition. |
235 * @param env The environment current outside of the method definition. |
436 } |
436 } |
437 |
437 |
438 /** Queue processing of an attribute default value. */ |
438 /** Queue processing of an attribute default value. */ |
439 void annotateDefaultValueLater(final JCExpression defaultValue, |
439 void annotateDefaultValueLater(final JCExpression defaultValue, |
440 final Env<AttrContext> localEnv, |
440 final Env<AttrContext> localEnv, |
441 final MethodSymbol m) { |
441 final MethodSymbol m, |
|
442 final DiagnosticPosition deferPos) { |
442 annotate.normal(new Annotate.Worker() { |
443 annotate.normal(new Annotate.Worker() { |
443 @Override |
444 @Override |
444 public String toString() { |
445 public String toString() { |
445 return "annotate " + m.owner + "." + |
446 return "annotate " + m.owner + "." + |
446 m + " default " + defaultValue; |
447 m + " default " + defaultValue; |
447 } |
448 } |
448 |
449 |
449 @Override |
450 @Override |
450 public void run() { |
451 public void run() { |
451 JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile); |
452 JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile); |
|
453 DiagnosticPosition prevLintPos = deferredLintHandler.setPos(deferPos); |
452 try { |
454 try { |
453 enterDefaultValue(defaultValue, localEnv, m); |
455 enterDefaultValue(defaultValue, localEnv, m); |
454 } finally { |
456 } finally { |
|
457 deferredLintHandler.setPos(prevLintPos); |
455 log.useSource(prev); |
458 log.useSource(prev); |
456 } |
459 } |
457 } |
460 } |
458 }); |
461 }); |
459 annotate.validate(new Annotate.Worker() { //validate annotations |
462 annotate.validate(new Annotate.Worker() { //validate annotations |