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

Reduce "exception is never thrown in body of corresponding try statement" Error to a Warning

    Details

    • Type: Enhancement
    • Status: New
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 13
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      per the discussion begun in https://mail.openjdk.java.net/pipermail/jdk-dev/2019-October/003480.html this change removes the following JLS rule from section 11.2.3:

           "It is a compile-time error if a catch clause can catch checked exception class E1
            and it is not the case that the try block corresponding to the
      catch clause can
            throw a checked exception class that is a subclass or superclass of
      E1, unless E1
            is Exception or a superclass of Exception."

      and converting the javac error message for this condition to a warning.

      The necessary patch required for this change is brief and will be posted as a webrev or PR once I remember how to do that again. ;-)

        Attachments

          Activity

            People

            • Assignee:
              mduigou Michael Duigou
              Reporter:
              mduigou Michael Duigou
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: