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

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

      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)

        1. CheckForPreIncrement.java
          5 kB
          Meghna Jayan
        2. TestFormat.java
          0.2 kB
          Meghna Jayan

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

              Created:
              Updated:
              Resolved: