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

abstract classes without abstract methods become non-abstract

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2beta4
    • CPU:
      sparc
    • OS:
      solaris_2.5.1
    • Verification:
      Verified

      Description



      Name: laC46010 Date: 02/09/98


      javac (JDK1.2beta3E, and JDK1.2beta3F) doesn't complain about
      illegal abstract class instance creation and as result fails to pass
      the following JCK-12ea2 tests:

      lang/CLSS/clss008/clss00801/clss00801.html
      lang/CLSS/clss008/clss00802/clss00802.html
      lang/CLSS/clss008/clss00803/clss00803.html
      lang/CLSS/clss008/clss00804/clss00804.html
      lang/CLSS/clss008/clss00812/clss00812.html
      lang/CLSS/clss037/clss03701/clss03701.html
      lang/STMT/stmt024/stmt02402/stmt02402.html

      See an example below:

      > javac -d . t.java
      > java t
      java.lang.InstantiationError: A
      at t.main(t.java:10)
      > java -fullversion
      java full version "JDK-1.2beta3-E"
      -------------------t.java------------------
      import java.io.PrintStream;
      abstract class A
      {
        public int x = 1;
        // abstract void f();
      }
      public class t {
        public static void main(String argv[])
        {
           A var1 = new A();
           System.out.println("A.x = " + var1.x);
        }
      }
      --------------------------------------------

      Note that when abstract method "f" is uncommented, javac correctly reports
      error message:

      > javac -d . t.java
      t.java:10: class A is an abstract class. It can't be instantiated.
           A var1 = new A();
                    ^
      1 error

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

        Attachments

          Activity

            People

            Assignee:
            tturnidgsunw Todd Turnidge (Inactive)
            Reporter:
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: