Steven Augart wrote:
> I think our implementation of java.lang.Class's newinstance() is
> incorrect.  Specifically, Class.newinstance() uses reflection to
> invoke a class's zero-argument constructor and then, if it catches an
> InvocationTargetException, unwraps that exception, throwing whatever
> exception was originally thrown by the constructor.
> 
> The exact code we currently have is:
> 
>     catch (InvocationTargetException e)
>       {
>       VMClass.throwException(e.getTargetException());
>       throw (InternalError) new InternalError
>         ("VMClass.throwException returned").initCause(e);
>       }
> 
> This has the effect that Class.newinstance() can throw any exception
> at all, without any warning to the caller.  

This is a well-known bug in the spec.. see

    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4233093

Sun has yet to do anything about it.

IMHO in this case compatibility is best, however repulsive.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com


_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/classpath

Reply via email to