Package org.apache.groovy.parser.antlr4
Class TryWithResourcesASTTransformation
java.lang.Object
org.apache.groovy.parser.antlr4.TryWithResourcesASTTransformation
Transform try-with-resources to try-catch-finally
Reference JLS "14.20.3. try-with-resources"(https://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiontransform
(TryCatchStatement tryCatchStatement) transformResourceAccess
(Expression variableExpression) See https://docs.oracle.com/javase/specs/jls/se9/html/jls-14.html 14.20.3.1.
-
Constructor Details
-
TryWithResourcesASTTransformation
-
-
Method Details
-
transform
- Parameters:
tryCatchStatement
- the try-with-resources statement to transform- Returns:
- try-catch-finally statement which contains no resources clause
-
transformResourceAccess
See https://docs.oracle.com/javase/specs/jls/se9/html/jls-14.html 14.20.3.1. Basic try-with-resources If a basic try-with-resource statement is of the form: try (VariableAccess ...) Block then the resource is first converted to a local variable declaration by the following translation: try (T #r = VariableAccess ...) { Block }
-