Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8020586

Warning produced for an incorrect file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 8
    • tools
    • b100
    • Verified

        Consider the following test files:
        -----IncorrectWarning.java:
        public class IncorrectWarning {
            private Aux a;
        }
        -----
        -----Aux.java:
        import java.io.StringBufferInputStream;

        public class Aux {
        }
        -----

        When the deprecation warnings are enabled, there should be a warning produced for the import in the Aux class, like this:
        -----
        $ javac -sourcepath . -Xlint:deprecation Aux.java IncorrectWarning.java
        Aux.java:1: warning: [deprecation] StringBufferInputStream in java.io has been deprecated
        import java.io.StringBufferInputStream;
                      ^
        1 warning
        -----

        But when compiling the IncorrectWarning.java first, the warning is incorrectly put into the IncorrectWarning.java file:
        -----
        $ javac -sourcepath . -Xlint:deprecation IncorrectWarning.java Aux.java
        IncorrectWarning.java:1: warning: [deprecation] StringBufferInputStream in java.io has been deprecated
        public class IncorrectWarning {
                      ^
        1 warning
        -----

        This is reproducible with jdk8/tl/langtools tip:
        $ hg tip
        changeset: 1890:37031963493e
        tag: tip
        user: jjg
        date: Fri Jul 12 13:11:12 2013 -0700
        summary: 8020278: NPE in javadoc

        Also reproducible with:
        $ javac -version
        javac 1.7.0_11

              jlahoda Jan Lahoda
              jlahoda Jan Lahoda
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: