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

javac got a null pointer exception while compiling an applet

XMLWordPrintable

    • 1.1
    • sparc
    • solaris_2.5.1
    • Not verified

      Problem: WHile compiling an applet, javac got a null pointer exception.

      The trace is as follows ......

      javac memObjTest1_mt.java
      java.lang.NullPointerException
              at sun.tools.tree.MethodExpression.inline(MethodExpression.java:248)
              at sun.tools.tree.ExpressionStatement.inline(ExpressionStatement.java:51)
              at sun.tools.tree.IfStatement.inline(IfStatement.java:77)
              at sun.tools.tree.CompoundStatement.inline(CompoundStatement.java:65)
              at sun.tools.tree.ForStatement.inline(ForStatement.java:90)
              at sun.tools.tree.CompoundStatement.inline(CompoundStatement.java:65)
              at sun.tools.tree.ForStatement.inline(ForStatement.java:84)
              at sun.tools.tree.CompoundStatement.inline(CompoundStatement.java:65)
              at sun.tools.tree.ForStatement.inline(ForStatement.java:90)
              at sun.tools.tree.CompoundStatement.inline(CompoundStatement.java:65)
              at sun.tools.tree.ForStatement.inline(ForStatement.java:84)
              at sun.tools.tree.CompoundStatement.inline(CompoundStatement.java:65)
              at sun.tools.javac.SourceField.inline(SourceField.java:293)
              at sun.tools.javac.SourceField.code(SourceField.java:367)
              at sun.tools.javac.SourceClass.compileClass(SourceClass.java:564)
              at sun.tools.javac.SourceClass.compile(SourceClass.java:527)
              at sun.tools.javac.Main.compile(Main.java:193)
              at sun.tools.javac.Main.main(Main.java:289)
      .//memObjTest1_mt.java:19: Class myThread already defined in memObjTest1_mt.java.
      class myThread implements Runnable {
            ^
      .//memObjTest1_mt.java:31: Class memObjTest1_mt not found in type declaration.
              static memObjTest1_mt myapplet; // Remember applet for graphics
                                            ^
      .//memObjTest1_mt.java:53: Class memObjTest1_mt not found in void run().
                                      myapplet.paint(myapplet.getGraphics());
                                                                         ^
      .//memObjTest1_mt.java:56: Class memObjTest1_mt not found in void run().
                              myapplet.allClear();
                                               ^
      .//memObjTest1_mt.java:70: Undefined variable: this
                              if((this.thrNo == 0) && (done % xfactor) == 0){
                                  ^
      .//memObjTest1_mt.java:89: Class memObjTest1_mt not found in type declaration.
              public void setApplet(memObjTest1_mt ma){
                          ^
      .//memObjTest1_mt.java:97: Class memObj already defined in memObjTest1_mt.java.
      class memObj {
            ^
      .//memObjTest1_mt.java:114: Class memObjTest1 already defined in memObjTest1_mt.
      public class memObjTest1 extends java.applet.Applet {
                   ^
                   ^
      error: An exception has occurred in the compiler; please file a bug report (###@###.###).
      9 errors
       
      ------------------------- End of trace ----------------------------

      I made some changes to the applet and javac had no problems afterwords.

            jrose John Rose
            vgavaska Vivek Gavaskar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: