public void staticBlockInlining(SootClass sootClass) {
    this.sootClass = sootClass;
    // retrieve the clinit method if any for sootClass
    if (!sootClass.declaresMethod("void <clinit>()")) {
      System.out.println("no clinit");
      return;
    }

    SootMethod clinit = sootClass.getMethod("void <clinit>()");
    // System.out.println(clinit);

    // retireve the active body
    if (!clinit.hasActiveBody())
      throw new RuntimeException("method " + clinit.getName() + " has no active body!");

    Body clinitBody = clinit.getActiveBody();

    Chain units = ((DavaBody) clinitBody).getUnits();

    if (units.size() != 1) {
      throw new RuntimeException("DavaBody AST doesn't have single root.");
    }

    ASTNode AST = (ASTNode) units.getFirst();
    if (!(AST instanceof ASTMethodNode))
      throw new RuntimeException("Starting node of DavaBody AST is not an ASTMethodNode");

    AST.apply(new MethodCallFinder(this));
  }
 @SuppressWarnings({"unchecked", "cast"})
 public FieldDecl fullCopy() {
   FieldDecl res = (FieldDecl) copy();
   for (int i = 0; i < getNumChildNoTransform(); i++) {
     ASTNode node = getChildNoTransform(i);
     if (node != null) node = node.fullCopy();
     res.setChild(node, i);
   }
   return res;
 }
Beispiel #3
0
 @SuppressWarnings({"unchecked", "cast"})
 public WildcardType fullCopy() {
   WildcardType res = (WildcardType) copy();
   for (int i = 0; i < getNumChildNoTransform(); i++) {
     ASTNode node = getChildNoTransform(i);
     if (node != null) node = node.fullCopy();
     res.setChild(node, i);
   }
   return res;
 }
 @SuppressWarnings({"unchecked", "cast"})
 public LocalClassDeclStmt fullCopy() {
   LocalClassDeclStmt res = (LocalClassDeclStmt) copy();
   for (int i = 0; i < getNumChildNoTransform(); i++) {
     ASTNode node = getChildNoTransform(i);
     if (node != null) node = node.fullCopy();
     res.setChild(node, i);
   }
   return res;
 }
Beispiel #5
0
 /** @apilevel low-level */
 @SuppressWarnings({"unchecked", "cast"})
 public AssignXorExpr fullCopy() {
   AssignXorExpr res = (AssignXorExpr) copy();
   for (int i = 0; i < getNumChildNoTransform(); i++) {
     ASTNode node = getChildNoTransform(i);
     if (node != null) node = node.fullCopy();
     res.setChild(node, i);
   }
   return res;
 }
 /** @apilevel low-level */
 @SuppressWarnings({"unchecked", "cast"})
 public MethodDeclSubstituted fullCopy() {
   MethodDeclSubstituted res = (MethodDeclSubstituted) copy();
   for (int i = 0; i < getNumChildNoTransform(); i++) {
     ASTNode node = getChildNoTransform(i);
     if (node != null) node = node.fullCopy();
     res.setChild(node, i);
   }
   return res;
 }
 @SuppressWarnings({"unchecked", "cast"})
 public ArrayTypeWithSizeAccess fullCopy() {
   ArrayTypeWithSizeAccess res = (ArrayTypeWithSizeAccess) copy();
   for (int i = 0; i < getNumChildNoTransform(); i++) {
     ASTNode node = getChildNoTransform(i);
     if (node != null) node = node.fullCopy();
     res.setChild(node, i);
   }
   return res;
 }
Beispiel #8
0
 // Declared in AnonymousClasses.jrag at line 38
 @SuppressWarnings({"unchecked", "cast"})
 public List getImplementsList() {
   if (getImplementsList_computed)
     return (List) ASTNode.getChild(this, getImplementsListChildPosition());
   int num = boundariesCrossed;
   boolean isFinal = this.is$Final();
   getImplementsList_value = getImplementsList_compute();
   setImplementsList(getImplementsList_value);
   if (isFinal && num == boundariesCrossed) getImplementsList_computed = true;
   return (List) ASTNode.getChild(this, getImplementsListChildPosition());
 }
Beispiel #9
0
 // Declared in AnonymousClasses.jrag at line 32
 @SuppressWarnings({"unchecked", "cast"})
 public Opt getSuperClassAccessOpt() {
   if (getSuperClassAccessOpt_computed)
     return (Opt) ASTNode.getChild(this, getSuperClassAccessOptChildPosition());
   int num = boundariesCrossed;
   boolean isFinal = this.is$Final();
   getSuperClassAccessOpt_value = getSuperClassAccessOpt_compute();
   setSuperClassAccessOpt(getSuperClassAccessOpt_value);
   if (isFinal && num == boundariesCrossed) getSuperClassAccessOpt_computed = true;
   return (Opt) ASTNode.getChild(this, getSuperClassAccessOptChildPosition());
 }
Beispiel #10
0
 /**
  * Create a deep copy of the AST subtree at this node. The copy is dangling, i.e. has no parent.
  *
  * @return dangling copy of the subtree at this node
  * @apilevel low-level
  */
 @SuppressWarnings({"unchecked", "cast"})
 public Wildcard fullCopy() {
   Wildcard tree = (Wildcard) copy();
   if (children != null) {
     for (int i = 0; i < children.length; ++i) {
       ASTNode child = (ASTNode) children[i];
       if (child != null) {
         child = child.fullCopy();
         tree.setChild(child, i);
       }
     }
   }
   return tree;
 }
 // Declared in TypeAnalysis.jrag at line 257
 public TypeDecl Define_TypeDecl_declType(ASTNode caller, ASTNode child) {
   if (caller == getVariableDeclListNoTransform()) {
     int childIndex = caller.getIndexOfChild(child);
     return null;
   }
   return getParent().Define_TypeDecl_declType(this, caller);
 }
Beispiel #12
0
 public void flushCollectionCache() {
   super.flushCollectionCache();
 }
Beispiel #13
0
 public void flushCache() {
   super.flushCache();
 }