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

javac crashes on using names starting with class$

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.0
    • tools
    • None
    • x86
    • windows_nt

      When compiling the following class

      class t
      {
      public static void main(String[] args)
      {
      Class c = t.class;
      System.out.println(c);
      }

      int class$t() { return 0; }
      }

      the following exception trace was obtained.

      C:\jdk1.4\bin>javac t.java
      An exception has occurred in the compiler (1.4.0-beta). Please file a bug at the
       Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after ch
      ecking the Bug Parade for duplicates. Include your program and the following dia
      gnostic in your report. Thank you.
      java.lang.ClassCastException: com.sun.tools.javac.v8.code.Symbol$MethodSymbol
              at com.sun.tools.javac.v8.comp.TransInner.cacheSym(TransInner.java:1528)

              at com.sun.tools.javac.v8.comp.TransInner.classOfType(TransInner.java:15
      82)
              at com.sun.tools.javac.v8.comp.TransInner.classOf(TransInner.java:1547)
              at com.sun.tools.javac.v8.comp.TransInner._case(TransInner.java:1954)
              at com.sun.tools.javac.v8.tree.Tree$Select.visit(Tree.java:1200)
              at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.j
      ava:45)
              at com.sun.tools.javac.v8.tree.TreeTranslator._case(TreeTranslator.java:
      120)
              at com.sun.tools.javac.v8.tree.Tree$VarDef.visit(Tree.java:604)
              at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.j
      ava:45)
              at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.j
      ava:58)
              at com.sun.tools.javac.v8.tree.TreeTranslator._case(TreeTranslator.java:
      129)
              at com.sun.tools.javac.v8.tree.Tree$Block.visit(Tree.java:644)
              at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.j
      ava:45)
              at com.sun.tools.javac.v8.tree.TreeTranslator._case(TreeTranslator.java:
      114)
              at com.sun.tools.javac.v8.comp.TransInner._case(TransInner.java:1748)
              at com.sun.tools.javac.v8.tree.Tree$MethodDef.visit(Tree.java:569)
              at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.j
      ava:45)
              at com.sun.tools.javac.v8.comp.TransInner._case(TransInner.java:1678)
              at com.sun.tools.javac.v8.tree.Tree$ClassDef.visit(Tree.java:521)
              at com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.j
      ava:45)
              at com.sun.tools.javac.v8.comp.TransInner.translate(TransInner.java:1638
      )
              at com.sun.tools.javac.v8.comp.TransInner.translateTopLevelClass(TransIn
      ner.java:1988)
              at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:484)
              at com.sun.tools.javac.v8.Main.compile(Main.java:505)
              at com.sun.tools.javac.Main.compile(Main.java:27)
              at com.sun.tools.javac.Main.main(Main.java:16)

      -------------------------------------------------------------------------------
      On the other hand, using other internally used names such as 'this$n', compiler
      gives proper error message.



            gafter Neal Gafter (Inactive)
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: