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)
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)
- duplicates
-
JDK-8293897 Synthetic final modifier is part of the AST for a try-with-resource resource
-
- Closed
-