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

compiler crashes with this code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.6
    • tools
    • generic
    • generic



      Name: diC59631 Date: 08/19/98


      The compiler crashed when trying to compile this
      code.

      public class PrintUpClass {

        public static void print(Class c) {

          for (int step=0; c != null ; c = c.getSuperclass(), step++) {

            //print the "steps" up the inheritance tree

            System.out.println(step);

            
            //print the name of the class
            //System.out.println(c.getName());
            System.out.println(c);


          }

        }


        public static void main(String[] argv) throws Exception {

          if (argv.length == 0) {
            print(String.class);
          } else if (argv.length == 1) {
            print( Class.class.forName(argv[0]) );
          } else {
            System.err.println("only one argument is allowed");
            System.exit(-1);
          }

        }

      }



      Here was the stack trace.

      java.lang.NullPointerException
              at sun.tools.tree.ConditionalExpression.costInline(ConditionalExpression.java:159)
              at sun.tools.tree.NaryExpression.costInline(NaryExpression.java:63)
              at sun.tools.tree.MethodExpression.costInline(MethodExpression.java:543)
              at sun.tools.tree.NaryExpression.costInline(NaryExpression.java:66)
              at sun.tools.tree.MethodExpression.costInline(MethodExpression.java:543)
              at sun.tools.tree.ExpressionStatement.costInline(ExpressionStatement.java:73)
              at sun.tools.tree.IfStatement.costInline(IfStatement.java:117)
              at sun.tools.tree.IfStatement.costInline(IfStatement.java:120)
              at sun.tools.java.FieldDefinition.cleanup(FieldDefinition.java:509)
              at sun.tools.java.ClassDefinition.cleanup(ClassDefinition.java:1180)
              at sun.tools.javac.Main.compile(Main.java:369)
              at sun.tools.javac.Main.main(Main.java:521)
      (Review ID: 37255)
      ======================================================================

            tturnidgsunw Todd Turnidge (Inactive)
            dindrigo Daniel Indrigo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: