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

improve handling of IOExceptions in JavaCompiler.close()

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 17
    • 8, 9, 10, 11, 12, 13
    • tools
    • None
    • b04

    Description

      Seen in JavaCompiler.close()

                  for (Closeable c: closeables) {
                      try {
                          c.close();
                      } catch (IOException e) {
                          // When javac uses JDK 7 as a baseline, this code would be
                          // better written to set any/all exceptions from all the
                          // Closeables as suppressed exceptions on the FatalError
                          // that is thrown.
                          JCDiagnostic msg = diagFactory.fragment(Fragments.FatalErrCantClose);
                          throw new FatalError(msg, e);
                      }
                  }

      Since the baseline is now up to 11, we could refactor the code qas suggested in the comment.

      Attachments

        Issue Links

          Activity

            People

              jjg Jonathan Gibbons
              jjg Jonathan Gibbons
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: