[Java] Class TryWithResourcesASTTransformation

  • org.apache.groovy.parser.antlr4.TryWithResourcesASTTransformation
public class TryWithResourcesASTTransformation
extends Object

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

Constructors
Constructor and description
TryWithResourcesASTTransformation (AstBuilder astBuilder)

Methods Summary

Methods
Type Params Return Type Name and description
public Statement transform(TryCatchStatement tryCatchStatement)
Reference JLS "14.20.3. try-with-resources"(https://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html)
public BinaryExpression transformResourceAccess(Expression variableAccessExpression)
See https://docs.oracle.com/javase/specs/jls/se9/html/jls-14.html 14.20.3.1.

Inherited Methods Summary

Inherited Methods
Methods inherited from class Name
class Object wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Constructor Detail

public TryWithResourcesASTTransformation(AstBuilder astBuilder)

Method Detail

public Statement transform(TryCatchStatement tryCatchStatement)

Reference JLS "14.20.3. try-with-resources"(https://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html)

Parameters:
tryCatchStatement - the try-with-resources statement to transform
Returns:
try-catch-finally statement, which contains no resources clause

public BinaryExpression transformResourceAccess(Expression variableAccessExpression)

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 }

© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/apache/groovy/parser/antlr4/TryWithResourcesASTTransformation.html