RE: java.lang.Class.newinstance(): exceptions; desired behavior?

2004-09-24 Thread Jeroen Frijters
Steven Augart wrote: It is now the documented behaviour as of JDK 1.5.0rc1. (And it is *really annoying* to implement in a VM written in Java, like Jikes RVM). A while ago it occurred to me that Thread.stop(Throwable) can also be used to throw arbitrary exceptions (on the current thread).

Re: java.lang.Class.newinstance(): exceptions; desired behavior?

2004-09-24 Thread Steven Augart
Jeroen Frijters wrote: Steven Augart wrote: It is now the documented behaviour as of JDK 1.5.0rc1. (And it is *really annoying* to implement in a VM written in Java, like Jikes RVM). A while ago it occurred to me that Thread.stop(Throwable) can also be used to throw arbitrary exceptions (on

java.lang.Class.newinstance(): exceptions; desired behavior?

2004-09-23 Thread Steven Augart
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

Re: java.lang.Class.newinstance(): exceptions; desired behavior?

2004-09-23 Thread Archie Cobbs
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

Re: java.lang.Class.newinstance(): exceptions; desired behavior?

2004-09-23 Thread Steven Augart
Archie Cobbs wrote: 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,

RE: java.lang.Class.newinstance(): exceptions; desired behavior?

2004-09-23 Thread David Holmes
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. And from all reports they won't. Class.newInstance is claimed to be working as designed and we should use Constructor.newInstance if we want

Re: java.lang.Class.newinstance(): exceptions; desired behavior?

2004-09-23 Thread Archie Cobbs
David Holmes wrote: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4233093 Sun has yet to do anything about it. And from all reports they won't. Class.newInstance is claimed to be working as designed and we should use Constructor.newInstance if we want sensible semantics. I