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

An exception has occurred in the compiler

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.0
    • 1.0
    • tools
    • 1.0fcs
    • sparc
    • solaris_2.4
    • Not verified

      I'm filing this because the compiler asked me to, although the error is user error.

      Here's the output from the compiler.
      /set/hotjava/hotjava2/foley/ws/olive/build/bin/java -ms8m sun.tools.javac.Main -classpath .:/set/hotjava/hotjava2/foley/ws/JDE/classes:/set/hotjava/hotjava2/foley/ws/JDE//build/classes:/set/hotjava/hotjava2/foley/ws/olive/build/classes -d ../classes ../src/sun/jde/ProjFrame.java
      java.lang.NullPointerException
      at sun.tools.tree.FieldExpression.checkLHS(FieldExpression.java:166)
      at sun.tools.tree.AssignExpression.checkValue(AssignExpression.java:40)
      at sun.tools.tree.BinaryAssignExpression.check(BinaryAssignExpression.java:52)
      at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java:43)
      at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:48)
      at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:48)
      at sun.tools.tree.Statement.checkMethod(Statement.java:55)
      at sun.tools.javac.SourceField.check(SourceField.java:181)
      at sun.tools.javac.SourceClass.check(SourceClass.java:398)
      at sun.tools.javac.SourceClass.compileClass(SourceClass.java:513)
      at sun.tools.javac.SourceClass.compile(SourceClass.java:500)
      at sun.tools.javac.Main.compile(Main.java:195)
      at sun.tools.javac.Main.main(Main.java:292)
      ../src/sun/jde/ProjFrame.java:51: No variable projectSA defined in class sun.jde.ProjFrame.
      this.projectSA = projectSA;
      ^
      error: An exception has occurred in the compiler; please file a bug report (###@###.###).
      2 errors
      gnumake: *** [.jde] Error 1

      The problem is that I passed in an argument ,foo, and assigned it to this.foo, but
      I didn't have foo defined in the class.

      The description field as copied from bug report 1227430 follows:

      The code that generates the exception is in file:
         /usr/green/SCCS_DIRECTORIES/JDKbeta/src/share/java/java/awt/test/VisualTest.java

      The following is the compiler output and stack trace.

      [45][test] ? javac VisualTest.java
      java.lang.NullPointerException
      at sun.tools.tree.FieldExpression.checkLHS(FieldExpression.java:166)
      at sun.tools.tree.AssignExpression.checkValue(AssignExpression.java:40)
      at sun.tools.tree.BinaryAssignExpression.check(BinaryAssignExpression.java:52)
      at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java:43)
      at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:48)
      at sun.tools.tree.Statement.checkMethod(Statement.java:55)
      at sun.tools.javac.SourceField.check(SourceField.java:181)
      at sun.tools.javac.SourceClass.check(SourceClass.java:398)
      at sun.tools.javac.SourceClass.compileClass(SourceClass.java:513)
      at sun.tools.javac.SourceClass.compile(SourceClass.java:500)
      at sun.tools.javac.Main.compile(Main.java:195)
      at sun.tools.javac.Main.main(Main.java:286)
      VisualTest.java:304: No constructor matching VPanel(VTest) found in class VPanel.
      component = new VPanel(this);
      ^
      VisualTest.java:439: No variable currentContainer defined in class VisualTest.
      target.currentContainer = this;
      ^
      error: An exception has occurred in the compiler; please file a bug report (###@###.###).
      3 errors

      The description field as copied from bug report 1227917 follows:


      The folllowing generates an exception:

      public class test {
       static public void main(String args[]) {
          NoExistingClass.Variable = 50;
       }
      }

      Stack trace:

      java.lang.NullPointerException
      at sun.tools.tree.FieldExpression.checkLHS(FieldExpression.java:166)
      at sun.tools.tree.AssignExpression.checkValue(AssignExpression.java:40)
      at sun.tools.tree.BinaryAssignExpression.check(BinaryAssignExpression.java:52)
      at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java:43)
      at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:48)
      at sun.tools.tree.Statement.checkMethod(Statement.java:55)
      at sun.tools.javac.SourceField.check(SourceField.java:181)
      at sun.tools.javac.SourceClass.check(SourceClass.java:398)
      at sun.tools.javac.SourceClass.compileClass(SourceClass.java:513)
      at sun.tools.javac.SourceClass.compile(SourceClass.java:500)
      at sun.tools.javac.Main.compile(Main.java:195)
      at sun.tools.javac.Main.main(Main.java:286)
      test.java:3: Class NoExistingClass not found in void main(java.lang.String[]).
          NoExistingClass.Variable = 50;
                         ^
      error: An exception has occurred in the compiler; please file a bug report (###@###.###).
      2 errors

      Vijay

      The description field as copied from bug report 1227916 follows:


      The following produces a compiler exception:

      class Match extends Exception {
      String str; // string to match
      int length; // length of string
      int position[]; // position of substring

      // anchored match
      // throw this on failure to backtrack
      Match(Node nfa, String str) {
      self.str = str;
      length = str.length();
      position = new int[2];

      try {
      nfa.match(self, 0);
      } catch (Match myself) {
      }
      }
      }

      Stack trace:
      ---------
      java.lang.NullPointerException
      at sun.tools.tree.FieldExpression.checkLHS(FieldExpression.java:166)
      at sun.tools.tree.AssignExpression.checkValue(AssignExpression.java:40)
      at sun.tools.tree.BinaryAssignExpression.check(BinaryAssignExpression.java:52)
      at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java:43)
      at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:48)
      at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:48)
      at sun.tools.tree.Statement.checkMethod(Statement.java:55)
      at sun.tools.javac.SourceField.check(SourceField.java:181)
      at sun.tools.javac.SourceClass.check(SourceClass.java:398)
      at sun.tools.javac.SourceClass.compileClass(SourceClass.java:513)
      at sun.tools.javac.SourceClass.compile(SourceClass.java:500)
      at sun.tools.javac.Main.compile(Main.java:195)
      at sun.tools.javac.Main.main(Main.java:286)
      Match.java:8: Class Node not found in type declaration.
      Match(Node nfa, String str) {
      ^
      Match.java:9: Class self not found in Match(Node,java.lang.String).
      self.str = str;
      ^
      error: An exception has occurred in the compiler; please file a bug report (###@###.###).
      3 errors

      The description field as copied from bug report 1227907 follows:

      From: ###@###.###

      This does not look like form output to me.


      Hello, I found the following bug while compiling with the beta code.

      --------------

      java.lang.NullPointerException
              at sun.tools.tree.FieldExpression.checkLHS(FieldExpression.java:166)
              at sun.tools.tree.AssignExpression.checkValue(AssignExpression.java:40)
              at sun.tools.tree.BinaryAssignExpression.check(BinaryAssignExpression.java:52)
              at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java:43)
              at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:48)
              at sun.tools.tree.Statement.checkMethod(Statement.java:55)
              at sun.tools.javac.SourceField.check(SourceField.java:181)
              at sun.tools.javac.SourceClass.check(SourceClass.java:398)
              at sun.tools.javac.SourceClass.compileClass(SourceClass.java:513)
              at sun.tools.javac.SourceClass.compile(SourceClass.java:500)
              at sun.tools.javac.Main.compile(Main.java:195)
              at sun.tools.javac.Main.main(Main.java:286)
      sportsdaemon/BitDumper.java:146: No variable width defined in class
      sportsdaemon.BitDumper.
              this.width = width;
                  ^
      error: An exception has occurred in the compiler; please file a bug report
      (###@###.###).

      --------------

      what made it crash:

          int with; <---- THIS WAS SPELLED WRONG

          public void setDimensions(int width,
                                    int height) {
              this.width = width;
          }

      I was assigning a this.variable that didn't exist

      I tried it out in a couple different places and always got the same error.

      hope that make sense

      carl
      ###@###.###

      The description field as copied from bug report 1227934 follows:

      The following causes an exception:

      CODE:

      import java.*;


      public class Main
      {
         Arg a1;

         public static void main(String args[])
         {
            this.A1 = new Arg("Hello");

            for(int i = 0; i < args.length; i++)
            {
               System.out.println(args[i]);
               if(args[i].equals(A1.GetArg()))
               {
                  System.out.println("World");
               }
            }
         }
      }


      class Arg
      {
         private String arg;

         public Arg(String arg)
         {
            this.arg = arg;
         }
         public String GetArg(void)
         {
            return (arg);
         }
      }

      Stack trace:
      ----------
      Main.java:33: Identifier expected.
         public String GetArg(void)
                                  ^
      java.lang.NullPointerException
      at sun.tools.tree.FieldExpression.checkLHS(FieldExpression.java:166)
      at sun.tools.tree.AssignExpression.checkValue(AssignExpression.java:40)
      at sun.tools.tree.BinaryAssignExpression.check(BinaryAssignExpression.java:52)
      at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java:43)
      at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:48)
      at sun.tools.tree.Statement.checkMethod(Statement.java:55)
      at sun.tools.javac.SourceField.check(SourceField.java:181)
      at sun.tools.javac.SourceClass.check(SourceClass.java:398)
      at sun.tools.javac.SourceClass.compileClass(SourceClass.java:513)
      at sun.tools.javac.SourceClass.compile(SourceClass.java:500)
      at sun.tools.javac.Main.compile(Main.java:195)
      at sun.tools.javac.Main.main(Main.java:286)
      Main.java:10: Undefined variable: this
            this.A1 = new Arg("Hello");
            ^
      error: An exception has occurred in the compiler; please file a bug report
      (###@###.###).
      3 errors

      The description field as copied from bug report 1227932 follows:


      The following causes an exception:

      public class Test {
      int a;
      int b;
      public void assignvalA(int val) {
      this.foo = val;
      }
       public static void main(String args[]) {
        Test test = new test();
      test.assignvalA(5);
       }
      }


      Stack trace:
      ---------
      java.lang.NullPointerException
      at sun.tools.tree.FieldExpression.checkLHS(FieldExpression.java:166)
      at sun.tools.tree.AssignExpression.checkValue(AssignExpression.java:40)
      at sun.tools.tree.BinaryAssignExpression.check(BinaryAssignExpression.java:52)
      at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java:43)
      at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:48)
      at sun.tools.tree.Statement.checkMethod(Statement.java:55)
      at sun.tools.javac.SourceField.check(SourceField.java:181)
      at sun.tools.javac.SourceClass.check(SourceClass.java:398)
      at sun.tools.javac.SourceClass.compileClass(SourceClass.java:513)
      at sun.tools.javac.SourceClass.compile(SourceClass.java:500)
      at sun.tools.javac.Main.compile(Main.java:195)
      at sun.tools.javac.Main.main(Main.java:286)
      Test.java:5: No variable foo defined in class Test.
      this.foo = val;
      ^
      error: An exception has occurred in the compiler; please file a bug report (###@###.###).
      2 errors

      The description field as copied from bug report 1228548 follows:

      When I compile the following code (which is, admittedly, illegal), I get a
      NullPointerException from the compiler (stack trace included below):

      class Tester {
          public void add(Tester Service) {
          //vv add_this
              Service.add(this);
          //^^ add_this
          }
      }
       
      //vv pre_this
      class Name {
          public String str;
       
          Name() {
              str = "<unnamed>";
          }
          //^^ pre_this
       
          Name(String str) {
          //vv post_this
              this.str = "<unnamed>";
          //^^ post_this
          }
       
      //vv pre_this
      }
      //^^ pre_this
       
      //vv using_this
      class Moose {
          String hairdresser;
       
          Moose(String hairdresser) {
              this.haidresser = hairdresser;
          }
      }
      //^^ using_this

      Stack trace::

      java.lang.NullPointerException
              at sun.tools.tree.FieldExpression.checkLHS(FieldExpression.java:166)
              at sun.tools.tree.AssignExpression.checkValue(AssignExpression.java:40)
              at sun.tools.tree.BinaryAssignExpression.check(BinaryAssignExpression.java:52)
              at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java:43)
              at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:48)
              at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:48)
              at sun.tools.tree.Statement.checkMethod(Statement.java:55)
              at sun.tools.javac.SourceField.check(SourceField.java:181)
              at sun.tools.javac.SourceClass.check(SourceClass.java:398)
              at sun.tools.javac.SourceClass.compileClass(SourceClass.java:513)
              at sun.tools.javac.SourceClass.compile(SourceClass.java:500)
              at sun.tools.javac.Main.compile(Main.java:195)
              at sun.tools.javac.Main.main(Main.java:286)
      this.java:33: No variable haidresser defined in class Moose.
              this.haidresser = hairdresser;
                  ^
      error: An exception has occurred in the compiler; please file a bug report (###@###.###).
      2 errors

            fyellinsunw Frank Yellin (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: