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

fp.bugs 4000 no class bug in bug.java throws NullPointer in NewInstanceExpr...

    XMLWordPrintable

Details

    • 1.1
    • sparc
    • solaris_2.5
    • Not verified

    Description

      This sad little snippet, when compiled as bug.java, crashes javac in a way I haven't been able to find documented yet. I've worked it down to it's essential components.

      class mug
      {
         void m()
      {
         bug b=new bug();
      }
      }

      Here is the result:
      hagen@mile[89]: javac bug.java
      java.lang.NullPointerException
      at sun.tools.tree.NewInstanceExpression.code(NewInstanceExpression.java:196)
      at sun.tools.tree.ExpressionStatement.code(ExpressionStatement.java:77)
      at sun.tools.tree.DeclarationStatement.code(DeclarationStatement.java:81)
      at sun.tools.javac.SourceField.code(SourceField.java:406)
      at sun.tools.javac.SourceField.code(SourceField.java:368)
      at sun.tools.javac.SourceClass.compileClass(SourceClass.java:564)
      at sun.tools.javac.SourceClass.compile(SourceClass.java:527)
      at sun.tools.javac.Main.compile(Main.java:193)
      at sun.tools.javac.Main.main(Main.java:289)
      .//bug.java:2: Class mug already defined in bug.java.
      class mug
            ^
      .//bug.java:6: Class bug not found in type declaration.
         bug b=new bug();
         ^
      .//bug.java:6: Class bug not found in new.
         bug b=new bug();
               ^
      error: An exception has occurred in the compiler; please file a bug report (###@###.###).
      4 errors

      Attachments

        Activity

          People

            fyellinsunw Frank Yellin (Inactive)
            bhagen Benjamin Hagen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: