Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package soot;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 1999 Raja Vallee-Rai
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import soot.jimple.IdentityStmt;
import soot.jimple.ParameterRef;
import soot.jimple.ThisRef;
import soot.options.Options;
import soot.tagkit.AbstractHost;
import soot.tagkit.CodeAttribute;
import soot.tagkit.Tag;
import soot.util.Chain;
import soot.util.EscapedWriter;
import soot.util.HashChain;
import soot.validation.BodyValidator;
import soot.validation.CheckEscapingValidator;
import soot.validation.CheckInitValidator;
import soot.validation.CheckTypesValidator;
import soot.validation.CheckVoidLocalesValidator;
import soot.validation.LocalsValidator;
import soot.validation.TrapsValidator;
import soot.validation.UnitBoxesValidator;
import soot.validation.UsesValidator;
import soot.validation.ValidationException;
import soot.validation.ValueBoxesValidator;
/**
* Abstract base class that models the body (code attribute) of a Java method. Classes that implement an Intermediate
* Representation for a method body should subclass it. In particular the classes GrimpBody, JimpleBody and BafBody all
* extend this class. This class provides methods that are common to any IR, such as methods to get the body's units
* (statements), traps, and locals.
*
* @see soot.grimp.GrimpBody
* @see soot.jimple.JimpleBody
* @see soot.baf.BafBody
*/
@SuppressWarnings("serial")
public abstract class Body extends AbstractHost implements Serializable {
private static final Logger logger = LoggerFactory.getLogger(Body.class);
/** The method associated with this Body. */
protected transient SootMethod method = null;
/** The chain of locals for this Body. */
protected Chain localChain = new HashChain();
/** The chain of traps for this Body. */
protected Chain trapChain = new HashChain();
/** The chain of units for this Body. */
protected UnitPatchingChain unitChain = new UnitPatchingChain(new HashChain());
private static BodyValidator[] validators;
/** Creates a deep copy of this Body. */
@Override
abstract public Object clone();
/**
* Returns an array containing some validators in order to validate the JimpleBody
*
* @return the array containing validators
*/
private synchronized static BodyValidator[] getValidators() {
if (validators == null) {
validators = new BodyValidator[] { LocalsValidator.v(), TrapsValidator.v(), UnitBoxesValidator.v(), UsesValidator.v(),
ValueBoxesValidator.v(),
// CheckInitValidator.v(),
CheckTypesValidator.v(), CheckVoidLocalesValidator.v(), CheckEscapingValidator.v() };
}
return validators;
};
/**
* Creates a Body associated to the given method. Used by subclasses during initialization. Creation of a Body is triggered
* by e.g. Jimple.v().newBody(options).
*/
protected Body(SootMethod m) {
this.method = m;
}
/** Creates an extremely empty Body. The Body is not associated to any method. */
protected Body() {
}
/**
* Returns the method associated with this Body.
*
* @return the method that owns this body.
*/
public SootMethod getMethod() {
if (method == null) {
throw new RuntimeException("no method associated w/ body");
}
return method;
}
/**
* Sets the method associated with this Body.
*
* @param method
* the method that owns this body.
*
*/
public void setMethod(SootMethod method) {
this.method = method;
}
/** Returns the number of locals declared in this body. */
public int getLocalCount() {
return localChain.size();
}
/** Copies the contents of the given Body into this one. */
public Map