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

javac throws NullPointerException as a result of a static import

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6u21
    • tools
    • x86
    • linux

      FULL PRODUCT VERSION :


      ADDITIONAL OS VERSION INFORMATION :
      Linux kingsley 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 19:31:57 UTC 2010 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      Javac fails to run successfully on the given test case.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create files One.java and Two.java as given in the test case, and run `javac *.java`.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      An exception has occurred in the compiler (1.6.0_20). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) 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.javac.comp.Check.checkCompatibleConcretes(Check.java:1215)
      at com.sun.tools.javac.comp.Check.checkCompatibleSupertypes(Check.java:1567)
      at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2674)
      at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2628)
      at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2564)
      at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1036)
      at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:765)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:730)
      at com.sun.tools.javac.main.Main.compile(Main.java:353)
      at com.sun.tools.javac.main.Main.compile(Main.java:279)
      at com.sun.tools.javac.main.Main.compile(Main.java:270)
      at com.sun.tools.javac.Main.compile(Main.java:69)
      at com.sun.tools.javac.Main.main(Main.java:54)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      /* One.java */
      package one;
      import static one.Two.three;
      public class One<A> { }

      /* Two.java */
      package one;
      public class Two<B> extends One<B> {
          public static Object three;
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
        From what I can tell, the problem is only encountered when using static imports, and when a class has the same (case-insensitive) name as a package in which it resides. Avoiding either of these situations is sufficient to work around this bug.

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: