package soot.JastAddJ; import java.util.HashSet;import java.util.LinkedHashSet;import java.io.File;import java.util.*;import beaver.*;import java.util.ArrayList;import java.util.zip.*;import java.io.*;import java.io.FileNotFoundException;import java.util.Collection;import soot.*;import soot.util.*;import soot.jimple.*;import soot.coffi.ClassFile;import soot.coffi.method_info;import soot.coffi.CONSTANT_Utf8_info;import soot.tagkit.SourceFileTag;import soot.coffi.CoffiMethodSource; public class InstanceOfExpr extends Expr implements Cloneable { public void flushCache() { super.flushCache(); type_computed = false; type_value = null; } public void flushCollectionCache() { super.flushCollectionCache(); } @SuppressWarnings({"unchecked", "cast"}) public InstanceOfExpr clone() throws CloneNotSupportedException { InstanceOfExpr node = (InstanceOfExpr)super.clone(); node.type_computed = false; node.type_value = null; node.in$Circle(false); node.is$Final(false); return node; } @SuppressWarnings({"unchecked", "cast"}) public InstanceOfExpr copy() { try { InstanceOfExpr node = (InstanceOfExpr)clone(); if(children != null) node.children = (ASTNode[])children.clone(); return node; } catch (CloneNotSupportedException e) { } System.err.println("Error: Could not clone node of type " + getClass().getName() + "!"); return null; } @SuppressWarnings({"unchecked", "cast"}) public InstanceOfExpr fullCopy() { InstanceOfExpr res = (InstanceOfExpr)copy(); for(int i = 0; i < getNumChildNoTransform(); i++) { ASTNode node = getChildNoTransform(i); if(node != null) node = node.fullCopy(); res.setChild(node, i); } return res; } // Declared in PrettyPrint.jadd at line 420 public void toString(StringBuffer s) { getExpr().toString(s); s.append(" instanceof "); getTypeAccess().toString(s); } // Declared in TypeCheck.jrag at line 235 // 15.20.2 public void typeCheck() { TypeDecl relationalExpr = getExpr().type(); TypeDecl referenceType = getTypeAccess().type(); if(!relationalExpr.isUnknown()) { if(!relationalExpr.isReferenceType() && !relationalExpr.isNull()) error("The relational expression in instance of must be reference or null type"); if(!referenceType.isReferenceType()) error("The reference expression in instance of must be reference type"); if(!relationalExpr.castingConversionTo(referenceType)) error("The type " + relationalExpr.typeName() + " of the relational expression " + getExpr() + " can not be cast into the type " + referenceType.typeName()); if(getExpr().isTypeAccess()) error("The relational expression " + getExpr() + " must not be a type name"); } } // Declared in Expressions.jrag at line 902 // See BooleanExpressions.jrag for the evaluation of conditionals public soot.Value eval(Body b) { return b.newInstanceOfExpr( asImmediate(b, getExpr().eval(b)), getTypeAccess().type().getSootType(), this ); } // Declared in java.ast at line 3 // Declared in java.ast line 188 public InstanceOfExpr() { super(); } // Declared in java.ast at line 10 // Declared in java.ast line 188 public InstanceOfExpr(Expr p0, Access p1) { setChild(p0, 0); setChild(p1, 1); } // Declared in java.ast at line 15 protected int numChildren() { return 2; } // Declared in java.ast at line 18 public boolean mayHaveRewrite() { return false; } // Declared in java.ast at line 2 // Declared in java.ast line 188 public void setExpr(Expr node) { setChild(node, 0); } // Declared in java.ast at line 5 public Expr getExpr() { return (Expr)getChild(0); } // Declared in java.ast at line 9 public Expr getExprNoTransform() { return (Expr)getChildNoTransform(0); } // Declared in java.ast at line 2 // Declared in java.ast line 188 public void setTypeAccess(Access node) { setChild(node, 1); } // Declared in java.ast at line 5 public Access getTypeAccess() { return (Access)getChild(1); } // Declared in java.ast at line 9 public Access getTypeAccessNoTransform() { return (Access)getChildNoTransform(1); } // Declared in ConstantExpression.jrag at line 492 @SuppressWarnings({"unchecked", "cast"}) public boolean isConstant() { ASTNode$State state = state(); boolean isConstant_value = isConstant_compute(); return isConstant_value; } private boolean isConstant_compute() { return false; } // Declared in DefiniteAssignment.jrag at line 347 @SuppressWarnings({"unchecked", "cast"}) public boolean isDAafterFalse(Variable v) { ASTNode$State state = state(); boolean isDAafterFalse_Variable_value = isDAafterFalse_compute(v); return isDAafterFalse_Variable_value; } private boolean isDAafterFalse_compute(Variable v) { return isDAafter(v); } // Declared in DefiniteAssignment.jrag at line 348 @SuppressWarnings({"unchecked", "cast"}) public boolean isDAafterTrue(Variable v) { ASTNode$State state = state(); boolean isDAafterTrue_Variable_value = isDAafterTrue_compute(v); return isDAafterTrue_Variable_value; } private boolean isDAafterTrue_compute(Variable v) { return isDAafter(v); } // Declared in DefiniteAssignment.jrag at line 411 @SuppressWarnings({"unchecked", "cast"}) public boolean isDAafter(Variable v) { ASTNode$State state = state(); boolean isDAafter_Variable_value = isDAafter_compute(v); return isDAafter_Variable_value; } private boolean isDAafter_compute(Variable v) { return getExpr().isDAafter(v); } // Declared in DefiniteAssignment.jrag at line 852 @SuppressWarnings({"unchecked", "cast"}) public boolean isDUafter(Variable v) { ASTNode$State state = state(); boolean isDUafter_Variable_value = isDUafter_compute(v); return isDUafter_Variable_value; } private boolean isDUafter_compute(Variable v) { return getExpr().isDUafter(v); } protected boolean type_computed = false; protected TypeDecl type_value; // Declared in TypeAnalysis.jrag at line 361 @SuppressWarnings({"unchecked", "cast"}) public TypeDecl type() { if(type_computed) { return type_value; } ASTNode$State state = state(); int num = state.boundariesCrossed; boolean isFinal = this.is$Final(); type_value = type_compute(); if(isFinal && num == state().boundariesCrossed) type_computed = true; return type_value; } private TypeDecl type_compute() { return typeBoolean(); } // Declared in SyntacticClassification.jrag at line 89 public NameType Define_NameType_nameType(ASTNode caller, ASTNode child) { if(caller == getTypeAccessNoTransform()) { return NameType.TYPE_NAME; } return getParent().Define_NameType_nameType(this, caller); } public ASTNode rewriteTo() { return super.rewriteTo(); } }