8020586: Warning produced for an incorrect file

Always using DeferredLintHandler.immediateHandler when processing import classes

Reviewed-by: mcimadamore
This commit is contained in:
Jan Lahoda 2013-07-17 15:08:58 +02:00
parent a2a579a4bd
commit 35af8eccde
5 changed files with 32 additions and 4 deletions

View file

@ -508,11 +508,17 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
// process package annotations // process package annotations
annotateLater(tree.packageAnnotations, env, tree.packge); annotateLater(tree.packageAnnotations, env, tree.packge);
DeferredLintHandler prevLintHandler = chk.setDeferredLintHandler(DeferredLintHandler.immediateHandler);
try {
// Import-on-demand java.lang. // Import-on-demand java.lang.
importAll(tree.pos, reader.enterPackage(names.java_lang), env); importAll(tree.pos, reader.enterPackage(names.java_lang), env);
// Process all import clauses. // Process all import clauses.
memberEnter(tree.defs, env); memberEnter(tree.defs, env);
} finally {
chk.setDeferredLintHandler(prevLintHandler);
}
} }
// process the non-static imports and the static imports of types. // process the non-static imports and the static imports of types.

View file

@ -0,0 +1,5 @@
import java.io.StringBufferInputStream;
public class Auxiliary {
}

View file

@ -0,0 +1,2 @@
Auxiliary.java:1:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
1 warning

View file

@ -0,0 +1,13 @@
/**
* @test /nodynamiccopyright/
* @bug 8020586
* @summary Warnings in the imports section should be attributed to the correct source file
* @clean Auxiliary ImplicitCompilation
* @compile/ref=ImplicitCompilation.out -XDrawDiagnostics -Xlint:deprecation -sourcepath . ImplicitCompilation.java
* @clean Auxiliary ImplicitCompilation
* @compile/ref=ExplicitCompilation.out -XDrawDiagnostics -Xlint:deprecation ImplicitCompilation.java Auxiliary.java
*/
public class ImplicitCompilation {
private Auxiliary a;
}

View file

@ -0,0 +1,2 @@
Auxiliary.java:1:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
1 warning