[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

java.lang.Constructor conformance

From: Patrick Doyle
Subject: java.lang.Constructor conformance
Date: Tue, 7 Aug 2001 14:36:13 -0400 (EDT)

When a constructor isn't found, Classpath's java.lang.Constructor
dutifully throws InstantiationException, as per Sun's library spec.
However, the JDK itself actually throws NoSuchMethodError (not to be
confused with NoSuchMethodException).  Kaffe also throws

Technically, Classpath is right, but I'm not sure whether that's more
important than matching the behaviour of Sun's JVM.

The way to fix it is to catch the NoSuchMethodException from
Constructor.newInstance, and (believe it or not) re-throw it as a
NoSuchMethodError.  Then Classpath should act just like the JDK.

Patrick Doyle

reply via email to

[Prev in Thread] Current Thread [Next in Thread]