Package org.sonar.java.model.statement
Class TryStatementTreeImpl
- java.lang.Object
-
- org.sonar.java.model.JavaTree
-
- org.sonar.java.model.statement.TryStatementTreeImpl
-
- All Implemented Interfaces:
StatementTree
,Tree
,TryStatementTree
public class TryStatementTreeImpl extends JavaTree implements TryStatementTree
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.sonar.java.model.JavaTree
JavaTree.AnnotatedTypeTree, JavaTree.ArrayTypeTreeImpl, JavaTree.CompilationUnitTreeImpl, JavaTree.ImportTreeImpl, JavaTree.NotImplementedTreeImpl, JavaTree.PackageDeclarationTreeImpl, JavaTree.ParameterizedTypeTreeImpl, JavaTree.PrimitiveTypeTreeImpl, JavaTree.UnionTypeTreeImpl, JavaTree.WildcardTreeImpl
-
-
Field Summary
-
Fields inherited from class org.sonar.java.model.JavaTree
grammarRuleKey
-
-
Constructor Summary
Constructors Constructor Description TryStatementTreeImpl(List<CatchTreeImpl> catches, InternalSyntaxToken finallyKeyword, BlockTreeImpl finallyBlock)
TryStatementTreeImpl(InternalSyntaxToken tryToken, InternalSyntaxToken openParenToken, ResourceListTreeImpl resources, InternalSyntaxToken closeParenToken, BlockTreeImpl block, List<CatchTreeImpl> catches)
TryStatementTreeImpl(InternalSyntaxToken finallyKeyword, BlockTreeImpl finallyBlock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(TreeVisitor visitor)
BlockTree
block()
List<CatchTree>
catches()
Iterable<Tree>
children()
Creates iterable for children of this node.SyntaxToken
closeParenToken()
TryStatementTreeImpl
completeStandardTry(InternalSyntaxToken tryToken, BlockTreeImpl block)
TryStatementTreeImpl
completeTryWithResources(InternalSyntaxToken tryToken, InternalSyntaxToken openParenToken, ResourceListTreeImpl resources, InternalSyntaxToken closeParenToken, BlockTreeImpl block, List<CatchTreeImpl> catches)
TryStatementTreeImpl
completeWithCatches(List<CatchTreeImpl> catches)
BlockTree
finallyBlock()
SyntaxToken
finallyKeyword()
Tree.Kind
kind()
SyntaxToken
openParenToken()
ListTree<Tree>
resourceList()
Until Java 9, resource could only be instance ofVariableTree
.ListTree<VariableTree>
resources()
Java 9 allows resources to be declared by existing effectively final variables.SyntaxToken
tryKeyword()
-
Methods inherited from class org.sonar.java.model.JavaTree
firstToken, getChildren, getGrammarRuleKey, getLine, is, isLeaf, lastToken, parent, setParent
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.sonar.plugins.java.api.tree.Tree
firstToken, is, lastToken, parent
-
-
-
-
Constructor Detail
-
TryStatementTreeImpl
public TryStatementTreeImpl(List<CatchTreeImpl> catches, @Nullable InternalSyntaxToken finallyKeyword, @Nullable BlockTreeImpl finallyBlock)
-
TryStatementTreeImpl
public TryStatementTreeImpl(InternalSyntaxToken finallyKeyword, BlockTreeImpl finallyBlock)
-
TryStatementTreeImpl
public TryStatementTreeImpl(InternalSyntaxToken tryToken, InternalSyntaxToken openParenToken, ResourceListTreeImpl resources, InternalSyntaxToken closeParenToken, BlockTreeImpl block, List<CatchTreeImpl> catches)
-
-
Method Detail
-
completeWithCatches
public TryStatementTreeImpl completeWithCatches(List<CatchTreeImpl> catches)
-
completeStandardTry
public TryStatementTreeImpl completeStandardTry(InternalSyntaxToken tryToken, BlockTreeImpl block)
-
completeTryWithResources
public TryStatementTreeImpl completeTryWithResources(InternalSyntaxToken tryToken, InternalSyntaxToken openParenToken, ResourceListTreeImpl resources, InternalSyntaxToken closeParenToken, BlockTreeImpl block, List<CatchTreeImpl> catches)
-
tryKeyword
public SyntaxToken tryKeyword()
- Specified by:
tryKeyword
in interfaceTryStatementTree
-
openParenToken
@Nullable public SyntaxToken openParenToken()
- Specified by:
openParenToken
in interfaceTryStatementTree
-
resources
public ListTree<VariableTree> resources()
Description copied from interface:TryStatementTree
Java 9 allows resources to be declared by existing effectively final variables. This method will not return trees of resources declared by such variables, only resources declared with new variables will be returned (as it was until Java 9).- Specified by:
resources
in interfaceTryStatementTree
-
resourceList
public ListTree<Tree> resourceList()
Description copied from interface:TryStatementTree
Until Java 9, resource could only be instance ofVariableTree
. Since Java 9 it is possible to refer to resources by existing effectively final variables, so list can also containIdentifierTree
orMemberSelectExpressionTree
.- Specified by:
resourceList
in interfaceTryStatementTree
-
closeParenToken
@Nullable public SyntaxToken closeParenToken()
- Specified by:
closeParenToken
in interfaceTryStatementTree
-
block
public BlockTree block()
- Specified by:
block
in interfaceTryStatementTree
-
catches
public List<CatchTree> catches()
- Specified by:
catches
in interfaceTryStatementTree
-
finallyKeyword
@Nullable public SyntaxToken finallyKeyword()
- Specified by:
finallyKeyword
in interfaceTryStatementTree
-
finallyBlock
@Nullable public BlockTree finallyBlock()
- Specified by:
finallyBlock
in interfaceTryStatementTree
-
accept
public void accept(TreeVisitor visitor)
-
-