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

Synthetic final modifier is part of the AST for a try-with-resource resource

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 20
    • None
    • tools
    • None
    • b16
    • Verified

    Description

      For the below code:
      try ( InputStream is = new FileInputStream("foo")) {
      }
      while visiting the TryTree node using TreeScanner, the node info is displayed as :
      try (final InputStream is = new FileInputStream("foo")) {
      }
      Looks like jdk auto inserts the final modifier at the beginning.

      Verified in jdk 11, 17 and 19. Test program is attached
      (Execute the attachment by passing the test prgram also as argument)

      Attachments

        Issue Links

          Activity

            People

              jlahoda Jan Lahoda
              mjayan Meghna Jayan
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: