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

Class.newInstance spec should highlight checked exception problem

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.1.7, 1.4.0, 6
    • Fix Version/s: 5.0
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b59
    • CPU:
      generic, x86
    • OS:
      generic, windows_2000, windows_xp

      Description

      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}.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: