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

javac NPE in Check$Validator.visitSelect

XMLWordPrintable

    • b09
    • sparc
    • solaris_7

        Description: 1.4.2 javac NPE in Check$Validator.visitSelect

         FULL PRODUCT VERSION :
        ./java -version
        java version "1.4.2_14"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_14-b03) Java
        HotSpot(TM) Client VM (build 1.4.2_14-b03, mixed mode)


        ADDITIONAL OS VERSION INFORMATION :
        SunOS 5.8 Generic_108528-14 sun4u sparc SUNW,Ultra-4

        A DESCRIPTION OF THE PROBLEM :
          Verified this NPE happens when following conditions are met.

        - The class in the java source being compiled (A) implements an interface
        (B)
          whose super class (interface) is not visible during compilation.
        - .class exists for the interface (B) above.
        - (A) implements another interface that is in a package.

        This problem happens on JDK 1.4.2_* on Solaris and Windows.

        myc.java (A)
        myitf/myitf.java // interface which (B) extends
        myitf/myitf.class //
        myitf2.class (B) .class
        myitf2.java (B)

        $ find . -name '*.java' | xargs pg | cat
        ::::::::::::::
        ./myc.java
        ::::::::::::::
        public final class myc implements myitf2, java.io.Serializable {

        }
        ::::::::::::::
        ./myitf/myitf.java
        ::::::::::::::
        public interface myitf {
          final int VAR = 1;
        }
        ::::::::::::::
        ./myitf2.java
        ::::::::::::::
        public interface myitf2 extends myitf {
          public abstract void methodA();
        }



        $ <jdk1.4.2_14>/bin/javac myc.java
        myc.java:1: cannot access myitf
        file myitf.class not found
        public final class myc implements myitf2, java.io.Serializable {
                     ^
        An exception has occurred in the compiler (1.4.2_14). 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.v8.comp.Check$Validator.visitSelect(Check.java:437)
                at com.sun.tools.javac.v8.tree.Tree$Select.accept(Tree.java:1091)
                at com.sun.tools.javac.v8.comp.Check.validate(Check.java:409)
                at com.sun.tools.javac.v8.comp.Check.validate(Check.java:420)
                at com.sun.tools.javac.v8.comp.Attr.attribClassBody(Attr.java:1369)
                at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1356)
                at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1332)
                at
        com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:355)
                at com.sun.tools.javac.v8.Main.compile(Main.java:569)
                at com.sun.tools.javac.Main.compile(Main.java:36)
                at com.sun.tools.javac.Main.main(Main.java:27)

        The problem is not seen with jdk 1.5 :
        $ <jdk1.5.0_12>/bin/javac myc.java
        myc.java:1: cannot access myitf
        file myitf.class not found
        public final class myc implements myitf2, java.io.Serializable {
                     ^

              wrockett Walter Rockett (Inactive)
              kevibrow Kevin Brown
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: