mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8020586: Warning produced for an incorrect file
Always using DeferredLintHandler.immediateHandler when processing import classes Reviewed-by: mcimadamore
This commit is contained in:
parent
a2a579a4bd
commit
35af8eccde
5 changed files with 32 additions and 4 deletions
|
@ -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.
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
import java.io.StringBufferInputStream;
|
||||||
|
|
||||||
|
public class Auxiliary {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
Auxiliary.java:1:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
|
||||||
|
1 warning
|
|
@ -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;
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
Auxiliary.java:1:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
|
||||||
|
1 warning
|
Loading…
Add table
Add a link
Reference in a new issue