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

canonical import check compares classes by simple name

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 10
    • 10
    • tools
    • None
    • b29

      javac fails to detect non-canonical imports if the actual and expected symbols have the same simple name.

      === T.java
      import p1.A.I; // non-canonical import; should be p2.A.I

      class T {
        I i;
      }
      === p1/A.java
      package p1;
      public class A extends p2.A {}
      === p2/A.java
      package p2;
      public class A {
          public static class I {}
      }
      ===

      $ javac p1/A.java p2/A.java && jar cvf lib.jar p1/*.class p2/*.class
      $ javac -fullversion -cp lib.jar -sourcepath : T.java
      javac full version "9+181"
      ... OK

            cushon Liam Miller-Cushon
            cushon Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: