提交 ba41a7fc 编写于 作者: J jlahoda

8020586: Warning produced for an incorrect file

Summary: Always using DeferredLintHandler.immediateHandler when processing import classes
Reviewed-by: mcimadamore
上级 0080f894
...@@ -508,11 +508,17 @@ public class MemberEnter extends JCTree.Visitor implements Completer { ...@@ -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);
// Import-on-demand java.lang. DeferredLintHandler prevLintHandler = chk.setDeferredLintHandler(DeferredLintHandler.immediateHandler);
importAll(tree.pos, reader.enterPackage(names.java_lang), env);
// Process all import clauses. try {
memberEnter(tree.defs, env); // Import-on-demand java.lang.
importAll(tree.pos, reader.enterPackage(names.java_lang), env);
// Process all import clauses.
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.
......
import java.io.StringBufferInputStream;
public class Auxiliary {
}
Auxiliary.java:1:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
1 warning
/**
* @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;
}
Auxiliary.java:1:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
1 warning
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册