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

apt -print crash

XMLWordPrintable

    • apt
    • b49
    • generic
    • generic

      JDK : tiger b48
      Platforms[s] : all
      testbase : /java/sqe4/tools/1.5.0
      Failing tests : javam/regression/5109108

      Initializing static with anonymous class crashes apt -print in AptEnv.complete().
      Sample is modified form of com/sun/jmx/defaults/ServiceName.java.

      public class Test
      {
      static String getString(Object o) { return o.toString(); }
      static class B {
      String foo() { return null; }
      }
      public static final String ASTRING = getString( new B() { String foo(){ return "Hello";} } );
      }

      /*
      % apt -print -nocompile Test.java
      An exception has occurred in the compiler (1.5.0-auto-tiger). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.NullPointerException
              at com.sun.tools.apt.mirror.AptEnv.complete(AptEnv.java:82)
              at com.sun.tools.apt.mirror.AptEnv.getFlags(AptEnv.java:72)
              at com.sun.tools.apt.mirror.declaration.DeclarationMaker.getTypeDeclaration(DeclarationMaker.java:89)
              at com.sun.tools.apt.comp.Apt.main(Apt.java:194)
              at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:419)
              at com.sun.tools.apt.main.Main.compile(Main.java:942)
              at com.sun.tools.apt.main.Main.compile(Main.java:830)
              at com.sun.tools.apt.Main.compile(Main.java:41)
              at com.sun.tools.apt.Main.main(Main.java:32)
      */


      ----------------------------
      A simpler test case:

      class B {
          Object o =
      (new Object() {});
      }

      ###@###.### 2004-04-20

            sseligmasunw Scott Seligman (Inactive)
            ssides Steve Sides
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: