public class TryWithResources extends TryStmt implements Cloneable, VariableScope
| Modifier and Type | Field and Description |
|---|---|
protected Map |
catchableException_TypeDecl_values |
protected Map |
handlesException_TypeDecl_values |
protected Map |
isDAafter_Variable_values |
protected Map |
localLookup_String_values |
protected Map |
localVariableDeclaration_String_values |
protected Map |
lookupVariable_String_values |
protected boolean |
typeError_computed |
protected TypeDecl |
typeError_value |
protected boolean |
typeRuntimeException_computed |
protected TypeDecl |
typeRuntimeException_value |
branches_computed, branches_value, branchesFromFinally_computed, branchesFromFinally_value, canCompleteNormally_computed, canCompleteNormally_value, escapedBranches_computed, escapedBranches_value, exceptionRanges_computed, exceptionRanges_value, isDUafter_Variable_values, isDUbefore_Variable_values, label_begin_computed, label_begin_value, label_block_end_computed, label_block_end_value, label_catch_end_computed, label_catch_end_value, label_end_computed, label_end_value, label_exception_handler_computed, label_exception_handler_value, label_finally_block_computed, label_finally_block_value, label_finally_computed, label_finally_value, targetBranches_computed, targetBranches_valuelocalNum_computed, localNum_valuechildren, generatedWithCacheCycle, generatedWithCircularEnabled, generatedWithComponentCheck, in$Circle, is$Final, numChildren, parent, PRIMITIVE_PACKAGE_NAME, state| Constructor and Description |
|---|
TryWithResources() |
TryWithResources(List<ResourceDeclaration> p0,
Block p1,
List<CatchClause> p2,
Opt<Block> p3) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCatchClause(CatchClause node)
Append an element to the CatchClause list.
|
void |
addCatchClauseNoTransform(CatchClause node) |
void |
addResource(ResourceDeclaration node)
Append an element to the Resource list.
|
void |
addResourceNoTransform(ResourceDeclaration node) |
boolean |
catchableException(TypeDecl type)
The block of the try statement can throw an exception of
a type assignable to the given type.
|
boolean |
catchHandlesException(TypeDecl exceptionType)
This attribute computes whether or not the TWR statement
has a catch clause which handles the exception.
|
TryWithResources |
clone() |
TryWithResources |
copy() |
boolean |
Define_boolean_handlesException(ASTNode caller,
ASTNode child,
TypeDecl exceptionType) |
boolean |
Define_boolean_isDAbefore(ASTNode caller,
ASTNode child,
Variable v) |
boolean |
Define_boolean_reachableCatchClause(ASTNode caller,
ASTNode child,
TypeDecl exceptionType) |
boolean |
Define_boolean_resourcePreviouslyDeclared(ASTNode caller,
ASTNode child,
String name) |
SimpleSet |
Define_SimpleSet_lookupVariable(ASTNode caller,
ASTNode child,
String name) |
VariableScope |
Define_VariableScope_outerScope(ASTNode caller,
ASTNode child) |
void |
exceptionHandling()
Exception error checks.
|
void |
flushCache() |
void |
flushCollectionCache() |
TryWithResources |
fullCopy()
Create a deep copy of the AST subtree at this node.
|
Block |
getBlock()
Retrieves the Block child.
|
Block |
getBlockNoTransform()
Retrieves the Block child.
|
CatchClause |
getCatchClause(int i)
Retrieves the element at index
i in the CatchClause list.. |
List<CatchClause> |
getCatchClauseList()
Retrieves the CatchClause list.
|
List<CatchClause> |
getCatchClauseListNoTransform()
Retrieves the CatchClause list.
|
List<CatchClause> |
getCatchClauses()
Retrieves the CatchClause list.
|
List<CatchClause> |
getCatchClausesNoTransform()
Retrieves the CatchClause list.
|
Block |
getFinally()
Retrieves the (optional) Finally child.
|
Opt<Block> |
getFinallyOpt() |
Opt<Block> |
getFinallyOptNoTransform()
Retrieves the optional node for child Finally.
|
int |
getNumCatchClause()
Retrieves the number of children in the CatchClause list.
|
int |
getNumCatchClauseNoTransform()
Retrieves the number of children in the CatchClause list.
|
int |
getNumResource()
Retrieves the number of children in the Resource list.
|
int |
getNumResourceNoTransform()
Retrieves the number of children in the Resource list.
|
ResourceDeclaration |
getResource(int i)
Retrieves the element at index
i in the Resource list.. |
List<ResourceDeclaration> |
getResourceList()
Retrieves the Resource list.
|
List<ResourceDeclaration> |
getResourceListNoTransform()
Retrieves the Resource list.
|
List<ResourceDeclaration> |
getResources()
Retrieves the Resource list.
|
List<ResourceDeclaration> |
getResourcesNoTransform()
Retrieves the Resource list.
|
boolean |
handlesException(TypeDecl exceptionType)
Inherit the handlesException attribute from methoddecl.
|
boolean |
hasFinally()
Check whether the optional Finally child exists.
|
void |
init$Children()
Initializes the child array to the correct size.
|
boolean |
isDAafter(Variable v) |
SimpleSet |
localLookup(String name) |
VariableDeclaration |
localVariableDeclaration(String name) |
MethodDecl |
lookupClose(ResourceDeclaration resource)
Lookup the close method declaration for the resource which is being used.
|
SimpleSet |
lookupVariable(String name) |
boolean |
mayHaveRewrite() |
protected int |
numChildren() |
protected boolean |
reachedException(TypeDecl catchType)
Returns true if the try-with-resources statement can throw
an exception of type (or a subtype of) catchType.
|
boolean |
resourceClosingException(TypeDecl catchType)
True if the automatic closing of resources in this try-with-resources statement
may throw an exception of type catchType.
|
boolean |
resourceInitializationException(TypeDecl catchType)
True if the resource initialization of this try-with-resources statement
may throw an exception of type catchType.
|
boolean |
resourcePreviouslyDeclared(String name) |
ASTNode |
rewriteTo() |
void |
setBlock(Block node)
Replaces the Block child.
|
void |
setCatchClause(CatchClause node,
int i)
Replaces the CatchClause list element at index
i with the new node node. |
void |
setCatchClauseList(List<CatchClause> list)
Replaces the CatchClause list.
|
void |
setFinally(Block node)
Replaces the (optional) Finally child.
|
void |
setFinallyOpt(Opt<Block> opt)
Replaces the optional node for the Finally child.
|
void |
setResource(ResourceDeclaration node,
int i)
Replaces the Resource list element at index
i with the new node node. |
void |
setResourceList(List<ResourceDeclaration> list)
Replaces the Resource list.
|
void |
toString(StringBuffer sb)
Pretty printing of try-with-resources
|
boolean |
twrHandlesException(TypeDecl exceptionType)
Returns true if exceptions of type exceptionType are handled
in the try-with-resources statement or any containing statement
within the directly enclosing method or initializer block.
|
TypeDecl |
typeError() |
TypeDecl |
typeRuntimeException() |
addFallThroughLabelTag, branches, branchesFromFinally, branchTarget, break_label, canCompleteNormally, collectBranches, collectFinally, continue_label, Define_ArrayList_exceptionRanges, Define_boolean_enclosedByExceptionHandler, Define_boolean_isDUbefore, Define_boolean_reachable, Define_boolean_reportUnreachable, Define_Collection_TypeDecl__caughtExceptions, emitExceptionHandler, emitFinallyCode, enclosedByExceptionHandler, escapedBranches, exceptionRanges, isDAafterFinally, isDUafter, isDUafterFinally, isDUbefore, jimplify2, label_begin, label_block_end, label_catch_end, label_end, label_exception_handler, label_finally_block, label_finally, modifiedInScope, needsFinallyTrap, targetBranches, typeThrowableaddsIndentationLevel, continueLabel, declaresVariable, Define_String_typeDeclIndent, enclosingBodyDecl, hostType, isDAbefore, localNum, lookupMethod, lookupType, lookupType, reachable, reportUnreachableaccessControl, addAttributes, addChild, asImmediate, asLocal, asLocal, asRValue, beginExceptionRange, checkDUeverywhere, checkEnum, checkUncheckedConversion, checkWarnings, clearLocations, cloneSubtree, collectEnclosingVariables, collectErrors, collectExceptions, collectTypesToHierarchy, collectTypesToSignatures, compilationUnit, Define_Annotation_lookupAnnotation, Define_ASTNode_enclosingBlock, Define_BodyDecl_enclosingBodyDecl, Define_boolean_hasPackage, Define_boolean_inExplicitConstructorInvocation, Define_boolean_inExtendsOrImplements, Define_boolean_inhModifiedInScope, Define_boolean_insideLoop, Define_boolean_insideSwitch, Define_boolean_inStaticContext, Define_boolean_isAnonymous, Define_boolean_isAnonymousDecl, Define_boolean_isCatchParam, Define_boolean_isConstructorParameter, Define_boolean_isDest, Define_boolean_isExceptionHandlerParameter, Define_boolean_isExplicitGenericConstructorAccess, Define_boolean_isIncOrDec, Define_boolean_isLocalClass, Define_boolean_isMemberType, Define_boolean_isMethodParameter, Define_boolean_isNestedType, Define_boolean_isSource, Define_boolean_mayBeAbstract, Define_boolean_mayBeFinal, Define_boolean_mayBeNative, Define_boolean_mayBePrivate, Define_boolean_mayBeProtected, Define_boolean_mayBePublic, Define_boolean_mayBeStatic, Define_boolean_mayBeStrictfp, Define_boolean_mayBeSynchronized, Define_boolean_mayBeTransient, Define_boolean_mayBeVolatile, Define_boolean_mayUseAnnotationTarget, Define_boolean_variableArityValid, Define_boolean_withinDeprecatedAnnotation, Define_boolean_withinSuppressWarnings, Define_Case_bind, Define_CatchClause_catchClause, Define_ClassInstanceExpr_getClassInstanceExpr, Define_Collection_lookupConstructor, Define_Collection_lookupMethod, Define_Collection_lookupSuperConstructor, Define_CompilationUnit_compilationUnit, Define_ConstructorDecl_constructorDecl, Define_ConstructorDecl_unknownConstructor, Define_ElementValue_lookupElementTypeValue, Define_Expr_nestedScope, Define_GLBType_lookupGLBType, Define_int_localNum, Define_LabeledStmt_lookupLabel, Define_LUBType_lookupLUBType, Define_MethodDecl_unknownMethod, Define_NameType_nameType, Define_SimpleSet_allImportedTypes, Define_SimpleSet_lookupType, Define_soot_jimple_Stmt_condition_false_label, Define_soot_jimple_Stmt_condition_true_label, Define_String_hostPackage, Define_String_methodHost, Define_String_packageName, Define_TypeDecl_assignConvertedType, Define_TypeDecl_componentType, Define_TypeDecl_declType, Define_TypeDecl_enclosingAnnotationDecl, Define_TypeDecl_enclosingInstance, Define_TypeDecl_enclosingType, Define_TypeDecl_expectedType, Define_TypeDecl_genericDecl, Define_TypeDecl_hostType, Define_TypeDecl_lookupType, Define_TypeDecl_lookupWildcardExtends, Define_TypeDecl_lookupWildcardSuper, Define_TypeDecl_returnType, Define_TypeDecl_superType, Define_TypeDecl_switchType, Define_TypeDecl_typeBoolean, Define_TypeDecl_typeByte, Define_TypeDecl_typeChar, Define_TypeDecl_typeCloneable, Define_TypeDecl_typeDouble, Define_TypeDecl_typeError, Define_TypeDecl_typeException, Define_TypeDecl_typeFloat, Define_TypeDecl_typeInt, Define_TypeDecl_typeLong, Define_TypeDecl_typeNull, Define_TypeDecl_typeNullPointerException, Define_TypeDecl_typeObject, Define_TypeDecl_typeRuntimeException, Define_TypeDecl_typeSerializable, Define_TypeDecl_typeShort, Define_TypeDecl_typeString, Define_TypeDecl_typeThrowable, Define_TypeDecl_typeVoid, Define_TypeDecl_typeWildcard, Define_TypeDecl_unknownType, Define_Variable_unknownField, definesLabel, definiteAssignment, dumpString, dumpTree, dumpTree, dumpTreeNoRewrite, dumpTreeNoRewrite, duringAnnotations, duringAnonymousClasses, duringBoundNames, duringDU, duringEnums, duringGenericTypeVariables, duringImplicitConstructor, duringLiterals, duringNameResolution, duringSyntacticClassification, duringVariableDeclarationTransformation, emitConstant, end, endExceptionRange, error, errorPrefix, extractIndent, extractSingleType, flushCaches, getChild, getChildNoTransform, getIndexOfChild, getNumChild, getNumChildNoTransform, getParent, in$Circle, in$Circle, indent, insertChild, is$Final, is$Final, isDescendantTo, isStringAdd, iterator, jimplify1phase1, jimplify1phase2, jimplify2, lineNumber, location, nameCheck, newLabel, options, putSimpleSetElement, removeChild, removeInstanceMethods, removeInstanceVariables, replace, setChild, setEnd, setLocation, setParent, setStart, sourceFile, start, state, toString, transformation, transformEnumConstructors, typeCheck, unassignedEverywhere, usesTypeVariable, varChildIndex, varChildIndex, warning, warningPrefix, withgetColumn, getEnd, getId, getLine, getStart, makePositionequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorprotected Map localLookup_String_values
protected Map localVariableDeclaration_String_values
protected Map isDAafter_Variable_values
protected Map catchableException_TypeDecl_values
protected Map handlesException_TypeDecl_values
protected boolean typeError_computed
protected TypeDecl typeError_value
protected boolean typeRuntimeException_computed
protected TypeDecl typeRuntimeException_value
protected Map lookupVariable_String_values
public TryWithResources()
public TryWithResources(List<ResourceDeclaration> p0, Block p1, List<CatchClause> p2, Opt<Block> p3)
public void flushCache()
flushCache in class TryStmtpublic void flushCollectionCache()
flushCollectionCache in class TryStmtpublic TryWithResources clone() throws CloneNotSupportedException
clone in class TryStmtCloneNotSupportedExceptionpublic TryWithResources copy()
public TryWithResources fullCopy()
public void exceptionHandling()
exceptionHandling in class ASTNode<ASTNode>protected boolean reachedException(TypeDecl catchType)
reachedException in class TryStmtpublic void toString(StringBuffer sb)
public void init$Children()
init$Children in class TryStmtprotected int numChildren()
numChildren in class TryStmtpublic boolean mayHaveRewrite()
mayHaveRewrite in class TryStmtpublic void setResourceList(List<ResourceDeclaration> list)
list - The new list node to be used as the Resource list.public int getNumResource()
public int getNumResourceNoTransform()
public ResourceDeclaration getResource(int i)
i in the Resource list..i - Index of the element to return.i in the Resource list.public void addResource(ResourceDeclaration node)
node - The element to append to the Resource list.public void addResourceNoTransform(ResourceDeclaration node)
public void setResource(ResourceDeclaration node, int i)
i with the new node node.node - The new node to replace the old list element.i - The list index of the node to be replaced.public List<ResourceDeclaration> getResources()
public List<ResourceDeclaration> getResourcesNoTransform()
This method does not invoke AST transformations.
public List<ResourceDeclaration> getResourceList()
public List<ResourceDeclaration> getResourceListNoTransform()
This method does not invoke AST transformations.
public void setBlock(Block node)
public Block getBlock()
public Block getBlockNoTransform()
This method does not invoke AST transformations.
getBlockNoTransform in class TryStmtpublic void setCatchClauseList(List<CatchClause> list)
setCatchClauseList in class TryStmtlist - The new list node to be used as the CatchClause list.public int getNumCatchClause()
getNumCatchClause in class TryStmtpublic int getNumCatchClauseNoTransform()
getNumCatchClauseNoTransform in class TryStmtpublic CatchClause getCatchClause(int i)
i in the CatchClause list..getCatchClause in class TryStmti - Index of the element to return.i in the CatchClause list.public void addCatchClause(CatchClause node)
addCatchClause in class TryStmtnode - The element to append to the CatchClause list.public void addCatchClauseNoTransform(CatchClause node)
addCatchClauseNoTransform in class TryStmtpublic void setCatchClause(CatchClause node, int i)
i with the new node node.setCatchClause in class TryStmtnode - The new node to replace the old list element.i - The list index of the node to be replaced.public List<CatchClause> getCatchClauses()
getCatchClauses in class TryStmtpublic List<CatchClause> getCatchClausesNoTransform()
This method does not invoke AST transformations.
getCatchClausesNoTransform in class TryStmtpublic List<CatchClause> getCatchClauseList()
getCatchClauseList in class TryStmtpublic List<CatchClause> getCatchClauseListNoTransform()
This method does not invoke AST transformations.
getCatchClauseListNoTransform in class TryStmtpublic void setFinallyOpt(Opt<Block> opt)
Opt node containing the child Finally, not the actual child!setFinallyOpt in class TryStmtopt - The new node to be used as the optional node for the Finally child.public boolean hasFinally()
hasFinally in class TryStmttrue if the optional Finally child exists, false if it does not.public Block getFinally()
getFinally in class TryStmtnull otherwise.public void setFinally(Block node)
setFinally in class TryStmtnode - The new node to be used as the Finally child.public Opt<Block> getFinallyOpt()
getFinallyOpt in class TryStmtpublic Opt<Block> getFinallyOptNoTransform()
Opt node containing the child Finally, not the actual child!
This method does not invoke AST transformations.
getFinallyOptNoTransform in class TryStmtpublic boolean catchHandlesException(TypeDecl exceptionType)
public boolean twrHandlesException(TypeDecl exceptionType)
public MethodDecl lookupClose(ResourceDeclaration resource)
public VariableDeclaration localVariableDeclaration(String name)
public boolean resourceClosingException(TypeDecl catchType)
public boolean resourceInitializationException(TypeDecl catchType)
public boolean catchableException(TypeDecl type)
TryStmtcatchableException in class TryStmtTryStmt.catchableException(TypeDecl)public boolean handlesException(TypeDecl exceptionType)
handlesException in class TryStmtpublic TypeDecl typeRuntimeException()
typeRuntimeException in class TryStmtpublic SimpleSet lookupVariable(String name)
lookupVariable in interface VariableScopelookupVariable in class Stmtpublic boolean resourcePreviouslyDeclared(String name)
public boolean Define_boolean_handlesException(ASTNode caller, ASTNode child, TypeDecl exceptionType)
Define_boolean_handlesException in class TryStmtpublic boolean Define_boolean_reachableCatchClause(ASTNode caller, ASTNode child, TypeDecl exceptionType)
Define_boolean_reachableCatchClause in class TryStmtpublic SimpleSet Define_SimpleSet_lookupVariable(ASTNode caller, ASTNode child, String name)
Define_SimpleSet_lookupVariable in class ASTNode<ASTNode>public VariableScope Define_VariableScope_outerScope(ASTNode caller, ASTNode child)
Define_VariableScope_outerScope in class ASTNode<ASTNode>public boolean Define_boolean_resourcePreviouslyDeclared(ASTNode caller, ASTNode child, String name)
Define_boolean_resourcePreviouslyDeclared in class ASTNode<ASTNode>public boolean Define_boolean_isDAbefore(ASTNode caller, ASTNode child, Variable v)
Define_boolean_isDAbefore in class TryStmtCopyright © 2020 Soot OSS. All rights reserved.