Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6482910

(reflect) Define ReflectionException

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 6
    • core-libs
    • None

      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.

            darcy Joe Darcy
            kkawagucsunw Kohsuke Kawaguchi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: