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

compiler diagnostics were trimmed going from 1.0 to 1.1

XMLWordPrintable

    • sparc
    • solaris_2.5



      Name: laC46010 Date: 11/26/96


      JDK1.1 have changed a set of error messages that are reported
      for lang/EXPR/expr777/expr77716 test case of JCK1.1.

      JDK1.0.2 detects illegal static reference to nonstatic variable
      in lines 15, 31, 33.

      Some preJDK1.1M version detects single error in lines 15.

      And finally JDK1.1M shows only error in line 31.

      I like more JDK1.0.2 behaviour in this case
      but if extra messages are suppressed in JDK1.1
      it would be more reasonable to report error message
      at the first line it occurs namely the line 15 not 31.

      See compiler outputs and test source below.

      --------------------JDK1.0.2 output--------------------
      tests/lang/EXPR/expr777/expr77716/expr77716.java:15: Can't make a static reference to nonstatic variable i in class javasoft.sqe.tests.lang.expr777.expr77716.SomeClass.
      i += x.i;
      ^
      tests/lang/EXPR/expr777/expr77716/expr77716.java:31: Can't make a static reference to nonstatic variable i in class javasoft.sqe.tests.lang.expr777.expr77716.SomeClass.
      i += x.i;
      ^
      tests/lang/EXPR/expr777/expr77716/expr77716.java:33: Can't make a static reference to nonstatic variable f in class javasoft.sqe.tests.lang.expr777.expr77716.SomeSubclass.
      f *= x.f;
      ^
      3 errors

      --------------------preJDK1.1M output--------------------
      tests/lang/EXPR/expr777/expr77716/expr77716.java:15: Can't make a static reference to nonstatic variable i in class javasoft.sqe.tests.lang.expr777.expr77716.SomeClass.
      i += x.i;
      ^
      1 error

      --------------------JDK1.1M output--------------------
      tests/lang/EXPR/expr777/expr77716/expr77716.java:31: Can't make a static reference to nonstatic variable i in class javasoft.sqe.tests.lang.expr777.expr77716.SomeClass.
      i += x.i;
      ^
      1 error



      Test source:

      ------------------------------------------------------------------
      // Ident: @(#)expr77716.java 1.5 96/09/02
      // Copyright 09/02/96 Sun Microsystems, Inc. All Rights Reserved
      package javasoft.sqe.tests.lang.expr777.expr77716;



      import java.io.PrintStream;


      class SomeClass {

      public int i;

      public static void inc(SomeClass x) {
      i += x.i;
      x.i++;
      }

      SomeClass(int i) {
      SomeClass.i = i;
      }

      }


      class SomeSubclass extends SomeClass {

      public float f;

      public static void inc(SomeSubclass x) {
      i += x.i;
      x.i++;
      f *= x.f;
      x.f++;
      }

      SomeSubclass(int i, float f) {
      super(i);
      SomeSubclass.f = f;
      }

      }


      public class expr77716 {

      public static void main(String args[]) {
      System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
      }
       
      public static int run(String args[],PrintStream out) {
      SomeClass x = new SomeClass(777);
      SomeSubclass y = new SomeSubclass(33, -2.71f);

      SomeClass.inc(x);
      SomeSubclass.inc(y);
      SomeClass.inc((SomeClass) y);
      return 1;
      }

      }
      ------------------------------------------------------------------


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

            dstoutamsunw David Stoutamire (Inactive)
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: