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 voidaccept(TreeVisitor visitor)BlockTreeblock()List<CatchTree>catches()Iterable<Tree>children()Creates iterable for children of this node.SyntaxTokencloseParenToken()TryStatementTreeImplcompleteStandardTry(InternalSyntaxToken tryToken, BlockTreeImpl block)TryStatementTreeImplcompleteTryWithResources(InternalSyntaxToken tryToken, InternalSyntaxToken openParenToken, ResourceListTreeImpl resources, InternalSyntaxToken closeParenToken, BlockTreeImpl block, List<CatchTreeImpl> catches)TryStatementTreeImplcompleteWithCatches(List<CatchTreeImpl> catches)BlockTreefinallyBlock()SyntaxTokenfinallyKeyword()Tree.Kindkind()SyntaxTokenopenParenToken()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.SyntaxTokentryKeyword()-
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:
tryKeywordin interfaceTryStatementTree
-
openParenToken
@Nullable public SyntaxToken openParenToken()
- Specified by:
openParenTokenin interfaceTryStatementTree
-
resources
public ListTree<VariableTree> resources()
Description copied from interface:TryStatementTreeJava 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:
resourcesin interfaceTryStatementTree
-
resourceList
public ListTree<Tree> resourceList()
Description copied from interface:TryStatementTreeUntil 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 containIdentifierTreeorMemberSelectExpressionTree.- Specified by:
resourceListin interfaceTryStatementTree
-
closeParenToken
@Nullable public SyntaxToken closeParenToken()
- Specified by:
closeParenTokenin interfaceTryStatementTree
-
block
public BlockTree block()
- Specified by:
blockin interfaceTryStatementTree
-
catches
public List<CatchTree> catches()
- Specified by:
catchesin interfaceTryStatementTree
-
finallyKeyword
@Nullable public SyntaxToken finallyKeyword()
- Specified by:
finallyKeywordin interfaceTryStatementTree
-
finallyBlock
@Nullable public BlockTree finallyBlock()
- Specified by:
finallyBlockin interfaceTryStatementTree
-
accept
public void accept(TreeVisitor visitor)
-
-