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

Final modifier auto inserted as part of try with resources statement

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • None
    • tools
    • None

      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)

            Unassigned Unassigned
            mjayan Meghna Jayan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: