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

doc, release notes for JDK-8036942 should be added

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: docs

      Description

      For a code like:

      import java.io.IOException;

      class LambdaWithMultiCatch {
          public static void main(String[] args) {
              Runnable r = () -> {
              try {
                  throw new IOException();
              } catch(IOException | IllegalArgumentException e) {
                  System.out.println("This code will generate a wrong exception table");
              }
            };
            r.run();
          }
      }

      javac will generate an incorrect exception table for method main. The generated exception table will look like:

          Exception table:
               from to target type
                   0 8 8 Class java/lang/Exception <---- no trace of IOException nor IllegalArgumentException

      This is a known issue and developers should avoid using multi-catch statements inside lambda bodies till this issue is fixed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jgordon Joni Gordon (Inactive)
                Reporter:
                vromero Vicente Arturo Romero Zaldivar
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: