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

REGRESSION: javac compilation failure when imported class with $ sign in the name

XMLWordPrintable

    • b75
    • 6
    • b85
    • generic
    • generic
    • Verified

      Since jdk6.0-b75 javac fails to compile a source which contains
      an import of the class with dollar sign in the name.
      Please see minimized test below to reproduce this failure.

      Minimized test:
      ===============
      --- com/test/Test.java ---
      package com.test;

      public class Test {

          public Test() {
          }

      }
      ---com/test/Test.java---

      --- com/test/Test$Test.java ---
      package com.test;

      public class Test$Test {

          public Test$Test(double value) {
          }

      }
      --- com/test/Test$Test.java ---

      --- T1.java ---
      import com.test.Test$Test;

      public class T1 {

          public static void main(String[] args) {
              Object obj = new Test$Test(1.0);
          }
      }
      ---end-of- ---

      Minimized test output:
      =====================
      <yg153347@oink> /java/re/jdk/6.0/promoted/beta2/b75/binaries/solaris-sparc/bin/javac com/test/*.java
      <yg153347@oink> /java/re/jdk/6.0/promoted/beta2/b75/binaries/solaris-sparc/bin/javac T1.java
      T1.java:1: com.test.Test$Test is not public in com.test.Test; cannot be accessed from outside package
      import com.test.Test$Test;
                     ^
      T1.java:6: cannot find symbol
      symbol : constructor Test$Test(double)
      location: class Test$Test
              Object obj = new Test$Test(1.0);
                           ^
      2 errors
      =====================

      There is no errors if I compile all files together:
      <yg153347@oink> /java/re/jdk/6.0/promoted/beta2/b75/binaries/solaris-sparc/bin/javac com/test/*.java T1.java
        or use previous Mustang builds (b74):
      <yg153347@oink> /java/re/jdk/6.0/promoted/beta2/b74/binaries/solaris-sparc/bin/javac com/test/*.java
      <yg153347@oink> /java/re/jdk/6.0/promoted/beta2/b74/binaries/solaris-sparc/bin/javac T1.java
        or Tiger's javac:
      <yg153347@oink> /java/re/jdk/1.5.0/archive/fcs/binaries/solaris-sparc/bin/javac com/test/*.java
      <yg153347@oink> /java/re/jdk/1.5.0/archive/fcs/binaries/solaris-sparc/bin/javac T1.java

            ahe Peter Ahe
            ygaevsky Yuri Gaevsky (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: