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
======================================================================