classpath
[Top][All Lists]
Advanced

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

RE: java.lang.Class patches


From: Jeroen Frijters
Subject: RE: java.lang.Class patches
Date: Fri, 11 Apr 2003 14:28:13 +0200

Brian Jones wrote:
> "Jeroen Frijters" <address@hidden> writes:
> 
> > Hi,
> > 
> > Yet another java.lang.Class patch.
> > 
> > Change Log
> > 
> > * java/lang/Class.java
> > (constructor): Added transient field to cache constructor.
> > (newInstance): Fixed to consider non-public constructors as well, 
> > added constructor object caching and implemented 
> accessibility check.
> > Exceptions thrown by constructor are rethrown without the wrapping 
> > InvocationTargetException. This is a little odd (because it 
> can cause
> > newInstance() to throw checked exception that aren't 
> declared), but it 
> > is compatible with Sun's implementation.
> > 
> > * vm/reference/java/lang/VMClass.java
> > (throwException): Added native method to throw checked exceptions 
> > without declaring them.
> 
> Could you fix this so that the exception is declared and then 
> maybe we don't need that native method in VMClass to throw 
> the exception?

No, the problem is that *any* exception can be thrown from a constructor
(and hence from Class.newInstance()). Yet, Class.newInstance() doesn't
declare "throws Exception" and it can't because that would break
existing code (wouldn't compile anymore).

Regards,
Jeroen




reply via email to

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