JDK-6482910 : (reflect) Define ReflectionException
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2006-10-17
  • Updated: 2012-09-28
  • Resolved: 2006-10-17
Related Reports
Duplicate :  
Description
There are many reflection related exceptions, such as ClassNotFoundException, InstantiationException,IllegalAccessException,InvocationTargetException, NoSuchFieldException, and NoSuchMethodException, but they do not share any common exception type other than Exception, so people are forced to write "catch(Exception)", which has undesirable side-effect of catching RuntimeException.

It would be really nice to introduce ReflectionException as the common base exception for all reflection-related exceptions to mitigate this pain. This is analogous to how IOException has a lot of sub-types.

See http://weblogs.java.net/blog/kohsuke/archive/2006/10/closures_and_la.html for a related rant and how people reacted to this.

Comments
EVALUATION Closing as duplicate of 6368013.
17-10-2006