Bugs item #993105, was opened at 2004-07-18 10:49
Message generated for change (Comment added) made by chiba
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=993105&group_id=22866

Category: Javassist
Group: CVS HEAD
Status: Open
Resolution: None
Priority: 5
Submitted By: Brett Randall (brett_s_r)
Assigned to: Shigeru Chiba (chiba)
Summary: Reflection#makeReflective could reject some reflections

Initial Comment:
In application code using javassist.reflect.Loader and 
Reflection, attempts to reflect some Class types will 
result in uncatchable VerifyError-s and other bytecode 
level errors at runtime.

Two examples are an attempt to reflect a Class that is 
an interface, and an attempt to reflect a subclass of 
either ClassMetaobject or Metaobject.  Reflecting a 
subclass of the meta classes seems to result in 
recursive reflection and a bytecode error.

I would prefer these easy-to-detect cases to be caught 
at the higher-level API through a checked Exception, 
rather that resulting in JVM errors.  A solution that I 
arrived at is to create an Exception subclass of 
CannotCompileException called CannotReflectException, 
which is thrown by Reflection#makeReflective, whenever 
an attempt is made to reflect a Class as described 
above.  No change to the method signature is required.

I found that this improves runtime robustness by 
reducing the chance of uncatchable JVM errors caused 
by illegal bytecode enhancements.

Attached are:

* new Exception class CannotReflectException
* patch to Reflection which throws the new Exception
* two unit tests


----------------------------------------------------------------------

>Comment By: Shigeru Chiba (chiba)
Date: 2004-07-19 22:58

Message:
Logged In: YES 
user_id=388745

Thanks, I'll check your patches.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=993105&group_id=22866


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to