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

java compiler throws NullPointerException when class can't be found.

    Details

    • Subcomponent:
    • Resolved In Build:
      merlin
    • CPU:
      x86
    • OS:
      other, linux, windows_nt
    • Verification:
      Verified

      Description



      Name: skR10017 Date: 04/24/2000



      The test consists of three files that must be present to see the failure.
      The file base.java must be placed into base subdirectory.
      The sequence of compilation and CLASSPATH property is important.

      Test fails in JDK 1.3.0beta for Linux and JDK 1.3beta-O for Solaris
      ----------------------------- base/base.java --------------------------------
      public interface base
      {
          public void run();
      }
      ----------------------------- impl.java --------------------------------
      public class impl implements base
      {
          public void run()
          { }
      }
      ----------------------------- test.java --------------------------------
      public class test extends impl {
        private String workdir="";
      }
      ----------------------------- output ----------------------------------

      [kotl@linux-4 test]$ ls -lR
      .:
      total 3
      drwxrwxr-x 2 kotl java 512 Apr 24 12:01 base
      -rw-r--r-- 1 kotl java 71 Apr 24 12:00 impl.java
      -rw-r--r-- 1 kotl java 66 Apr 24 12:00 test.java

      base:
      total 1
      -rw-r--r-- 1 kotl java 49 Apr 24 12:00 base.java
      [kotl@linux-4 test]$ cd base
      [kotl@linux-4 base]$ export CLASSPATH=.
      [kotl@linux-4 base]$ javac base.java
      [kotl@linux-4 base]$ cd ..
      [kotl@linux-4 test]$ export CLASSPATH=.:./base
      [kotl@linux-4 test]$ javac impl.java
      [kotl@linux-4 test]$ export CLASSPATH=.
      [kotl@linux-4 test]$ javac test.java
      test.java:2: cannot access base
      file base.class not found
        private String workdir="";
                ^
      An exception has occurred in the compiler (1.3.0beta). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi). Include your program and the following
      diagnostic in your report. Thank you.
      java.lang.NullPointerException:
              at com.sun.tools.javac.v8.comp.Attr.check(Attr.java:81)
              at com.sun.tools.javac.v8.comp.Attr._case(Attr.java:1347)
              at com.sun.tools.javac.v8.tree.Tree$Literal.visit(Tree.java:1002)
              at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:234)
              at com.sun.tools.javac.v8.comp.Attr.attribExpr(Attr.java:254)
              at com.sun.tools.javac.v8.comp.Attr._case(Attr.java:402)
              at com.sun.tools.javac.v8.tree.Tree$VarDef.visit(Tree.java:470)
              at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:234)
              at com.sun.tools.javac.v8.comp.Attr.attribStat(Attr.java:276)
              at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1415)
              at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:378)
              at com.sun.tools.javac.v8.Main.compile(Main.java:247)
              at com.sun.tools.javac.Main.main(Main.java:16)
      [kotl@linux-4 test]$
      ======================================================================

      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                busersunw Btplusnull User (Inactive)
                Reporter:
                kotlsunw Kotl Kotl (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: