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

Class.newInstance spec should highlight checked exception problem

XMLWordPrintable

    • b59
    • generic, x86
    • generic, windows_2000, windows_xp

      The following paragraph should be added to the doc for java.lang.Class.newInstance:

      Note that this method propagates any exception thrown by the nullary constructor, including a checked exception. Use of this method effectively bypasses the compile-time exception checking that would otherwise be performed by the compiler. The {@link java.lang.reflect.Constructor#newInstance(java.lang.Object...)} method avoids this problem by wrapping any exception thrown by the constructor in a (checked) {@link java.lang.reflect.InvocationTargetException}.

            darcy Joe Darcy
            jjb Josh Bloch
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: