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

Exception occurs in the compiler due to "modifier abstract not allowed here"

XMLWordPrintable

    • tiger
    • generic, x86
    • generic, windows_2000



      Name: tb29552 Date: 11/15/2002


      FULL PRODUCT VERSION :
      java version "1.4.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

      FULL OPERATING SYSTEM VERSION : glibc-2.2.5-164, kernel
      2.4.19-4GB, SuSE Linux Professional 8.1
       
       
      ADDITIONAL OPERATING SYSTEMS :


      A DESCRIPTION OF THE PROBLEM :
      The compiler crashes during compilation of an abstract
      classes with an abstract constructor. Even if the code is
      not correct, the compiler should not crash.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile the file Expression.java
      2.
      3.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      I expected a compiler error, but not a crash.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Expression.java:4: modifier abstract not allowed here
          public abstract Expression(Expression exp) {
                          ^
      An exception has occurred in the compiler (1.4.1_01). 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.tree.TreeInfo.isSyntheticInit(TreeInfo.java:112)
              at
      com.sun.tools.javac.v8.tree.TreeInfo.firstConstructorCall(TreeInfo.java:176)
              at
      com.sun.tools.javac.v8.comp.Check.checkCyclicConstructors(Check.java:944)
              at com.sun.tools.javac.v8.comp.Attr.attribClassBody(Attr.java:1401)
              at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1366)
              at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1342)
              at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:358)
              at com.sun.tools.javac.v8.Main.compile(Main.java:520)
              at com.sun.tools.javac.Main.compile(Main.java:36)
              at com.sun.tools.javac.Main.main(Main.java:27)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public abstract class Expression {
          private Expression exp;
       
          public abstract Expression(Expression exp) {
              this.exp = exp; // compiler does not crash without this line
          }
      }
        

      ---------- END SOURCE ----------
      (Review ID: 167106)
      ======================================================================

            gafter Neal Gafter (Inactive)
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: