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

Add notes for Error handling in Method.invoke and Constructor.newInstance

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 24
    • core-libs

      Method.invoke and Constructor.newInstance wrap Error instances from the calls into InvocationTargetException instances. If the Error is OutOfMemoryError or StackOverflowError, attempts to wrap the ITE into other exceptions may fail with secondary Error, which will hide the original Error.

      Changing the API to propagate any Error is out-of-spec, and is not considered.

      We should add notes in these 2 methods about the potential risks of swallowing errors.

            liach Chen Liang
            liach Chen Liang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: