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

NPE while compiling static import of unaccessible class member

    Details

    • Subcomponent:
    • Resolved In Build:
      b40
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: izR10247 Date: 01/16/2004



      Current 1.5.0-beta b32a compiler throws
      NullPointerException while it tries to compile
      source which contains static import of unaccessible
      member of another package. This failure affects
      execution of the following test:

      lang/PKGS/pkgs056/pkgs05603

      To reproduce this bug please run following test using
      script below, note that b32 compiler compiles the test
      successfully:

      ================= MyTest.sh begin =====================
      #!/usr/bin/bash
      set -x
      uname -a

      JAVAC=/export/ld25/java/dest/jdk1.5.0-b32a/solaris-sparc/bin/javac
      $JAVAC -version -source 1.5 -d . A.java MyTest.java
      ================= MyTest.sh end =======================
      ================= MyTest.java begin ===================
      package p1;

      import java.io.PrintStream;
      import static p2.A.m;

      public class MyTest {

          public static void main(String argv[]) {
              m();
          }
      }
      ================= MyTest.java end =====================
      ================= A.java begin ========================
      package p2;

      public class A {

          private static int m() {
              return 8;
          }
      }
      ================= A.java end =========================
      ================= MyTest output begin ================
      + uname -a
      SunOS novo148 5.8 Generic_108528-20 sun4u sparc SUNW,Ultra-80
      + JAVAC=/export/ld25/java/dest/jdk1.5.0-b32a/solaris-sparc/bin/javac
      + /export/ld25/java/dest/jdk1.5.0-b32a/solaris-sparc/bin/javac -version
      -source 1.5 -d . A.java MyTest.java
      javac 1.5.0-beta
      An exception has occurred in the compiler (1.5.0-beta). 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.javac.comp.Resolve.findFun(Resolve.java:742)
              at com.sun.tools.javac.comp.Resolve.resolveMethod(Resolve.java:1115)
              at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:1552)
              at com.sun.tools.javac.tree.Tree$Ident.accept(Tree.java:1006)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
              at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:271)
              at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1083)
              at com.sun.tools.javac.tree.Tree$Apply.accept(Tree.java:817)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
              at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:278)
              at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:854)
              at com.sun.tools.javac.tree.Tree$Exec.accept(Tree.java:734)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:291)
              at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:307)
              at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:562)
              at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:540)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:291)
              at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:498)
              at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:482)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:291)
              at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2301)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2235)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2188)
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:412)
              at com.sun.tools.javac.main.Main.compile(Main.java:587)
              at com.sun.tools.javac.main.Main.compile(Main.java:539)
              at com.sun.tools.javac.Main.compile(Main.java:44)
              at com.sun.tools.javac.Main.main(Main.java:35)
      ================= MyTest output end ==================
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              gafter Neal Gafter
              Reporter:
              garysunw Gary Gary (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: