Community
Participate
Working Groups
Build 20020321 I have a class Foo which subclasses an abstract class Bar. Foo doesn't implement all of the abstract methods in Bar, so there are some compilation problems. I tried to run the class on the knowledge that the unimplemented methods weren't used. I had expected that the compiler would stub in those methods with implementations which threw an Error with an Unresolved compilation problem, or to allow the VM to catch the problems (AbstractMethodError). However, the compiler seems to throw the error in the class' constructor! This prevents me from using the class at all, even though the methods are not used. I believe that the compiler should still allow me to use this class.
This looks like a duplicate of 3179 which has been fixed in the build 20020326. I I tried the following test case: public abstract class Bar { abstract void foo(); } public class Foo extends Bar { public static void main(String[] args) { Foo foo = new Foo(); System.out.println(foo); foo.foo(); } } If I comment out the line foo.foo(); I can successfully run the code. If I leave the code as is, I got: java.lang.Error: Unresolved compilation problem: Class must implement the inherited abstract method Bar.foo() at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at Foo.foo(Foo.java:9) at Foo.main(Foo.java:14) Exception in thread "main" So this seems to be fixed. Closed. *** This bug has been marked as a duplicate of 3179 ***