Tabnine Logo
SootClass.getMethod
Code IndexAdd Tabnine to your IDE (free)

How to use
getMethod
method
in
soot.SootClass

Best Java code snippets using soot.SootClass.getMethod (Showing top 20 results out of 315)

origin: Sable/soot

public SootMethod getMethod(String subsignature) {
 checkLevel(SIGNATURES);
 NumberedString numberedString = Scene.v().getSubSigNumberer().find(subsignature);
 if (numberedString == null) {
  throw new RuntimeException("No method " + subsignature + " in class " + getName());
 }
 return getMethod(numberedString);
}
origin: Sable/soot

body.getLocals().add(bool);
final SootMethod booleanWrapperConstructor = booleanWrapperRefType.getSootClass().getMethod("void <init>(boolean)");
units.addFirst(Jimple.v().newAssignStmt(Jimple.v().newStaticFieldRef(field.makeRef()), bool));
units.addFirst(Jimple.v().newInvokeStmt(
origin: Sable/soot

public Wrapper() {
 PrimType[] tmp = { BooleanType.v(), ByteType.v(), CharType.v(), DoubleType.v(), FloatType.v(), IntType.v(),
   LongType.v(), ShortType.v() };
 wrapperTypes = new HashMap<>();
 valueOf = new HashMap<>();
 primitiveValue = new HashMap<>();
 for (PrimType primType : tmp) {
  RefType wrapperType = primType.boxedType();
  String cn = wrapperType.getClassName();
  wrapperTypes.put(wrapperType, primType);
  String valueOfMethodSignature = cn + " valueOf(" + primType.toString() + ")";
  SootMethod valueOfMethod = wrapperType.getSootClass().getMethod(valueOfMethodSignature);
  valueOf.put(primType, valueOfMethod);
  String primitiveValueMethodSignature = primType.toString() + " " + primType.toString() + "Value()";
  SootMethod primitiveValueMethod = wrapperType.getSootClass().getMethod(primitiveValueMethodSignature);
  primitiveValue.put(wrapperType, primitiveValueMethod);
 }
 wrapperTypes = Collections.unmodifiableMap(wrapperTypes);
 valueOf = Collections.unmodifiableMap(valueOf);
 primitiveValue = Collections.unmodifiableMap(primitiveValue);
}
origin: Sable/soot

public static void main(String[] args) {
 // assumes 2 args: Class + Method
 Scene.v().loadClassAndSupport(args[0]);
 SootClass sc = Scene.v().getSootClass(args[0]);
 SootMethod sm = sc.getMethod(args[1]);
 Body b = sm.retrieveActiveBody();
 CompleteBlockGraph cfg = new CompleteBlockGraph(b);
 System.out.println(cfg);
 BlockGraphConverter.addStartStopNodesTo(cfg);
 System.out.println(cfg);
 BlockGraphConverter.reverse(cfg);
 System.out.println(cfg);
}
origin: Sable/soot

 private Optional<SootMethod> findAccessibleInSuperClassesBySubSig(SootClass base, String subSig) {
  Hierarchy hierarchy = Scene.v().getActiveHierarchy();
  for (SootClass superClass : hierarchy.getSuperclassesOfIncluding(base.getSuperclass())) {
   if (superClass.isLibraryClass() && superClass.declaresMethod(subSig)) {
    SootMethod method = superClass.getMethod(subSig);
    if (hierarchy.isVisible(base, method)) {
     return Optional.of(method);
    }
   }
  }
  return Optional.empty();
 }
}
origin: Sable/soot

otherMethods.add(currentClass.getMethod(signature));
origin: Sable/soot

public static SootMethod getMainMethod() {
 return Scene.v().getMainClass().getMethod(Scene.v().getSubSigNumberer().findOrAdd("void main(java.lang.String[])"));
}
origin: Sable/soot

/**
 * @apilevel internal
 */
private SootMethod sootMethod_compute() {
  ArrayList list = new ArrayList();
  for (int i = 0; i < getNumParameter(); i++)
    list.add(getParameter(i).type().getSootType());
  if (hostType().isArrayDecl())
    return typeObject().getSootClassDecl().getMethod(name(), list, type().getSootType());
  return hostType().getSootClassDecl().getMethod(name(), list, type().getSootType());
}
origin: Sable/soot

public void staticBlockInlining(SootClass sootClass) {
 this.sootClass = sootClass;
 // retrieve the clinit method if any for sootClass
 // the clinit method gets converted into the static block which could initialize the final variable
 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");
 }
 // running methodCallFinder on the Clinit method
 AST.apply(new MethodCallFinder(this));
}
origin: Sable/soot

public static void main(String[] args) {
 // assumes 2 args: Class + Method
 Scene.v().loadClassAndSupport(args[0]);
 SootClass sc = Scene.v().getSootClass(args[0]);
 SootMethod sm = sc.getMethod(args[1]);
 Body b = sm.retrieveActiveBody();
 ShimpleBody sb = Shimple.v().newBody(b);
 CompleteBlockGraph cfg = new CompleteBlockGraph(sb);
 ValueGraph vg = new ValueGraph(cfg);
 System.out.println(vg);
}
origin: Sable/soot

public static void main(String[] args) {
 // assumes 2 args: Class + Method
 Scene.v().loadClassAndSupport(args[0]);
 SootClass sc = Scene.v().getSootClass(args[0]);
 SootMethod sm = sc.getMethod(args[1]);
 Body b = sm.retrieveActiveBody();
 ShimpleBody sb = Shimple.v().newBody(b);
 CompleteBlockGraph cfg = new CompleteBlockGraph(sb);
 SimpleGlobalValueNumberer sgvn = new SimpleGlobalValueNumberer(cfg);
 System.out.println(sgvn);
}
origin: Sable/soot

SootMethod superConstructor = parentClass.getMethod("<init>", argsTwoTypes);
origin: Sable/soot

/**
 * @apilevel internal
 */
private SootMethod sootMethod_compute() {
  ArrayList list = new ArrayList();
  // this$0
  TypeDecl typeDecl = hostType();
  if (typeDecl.needsEnclosing())
    list.add(typeDecl.enclosingType().getSootType());
  if (typeDecl.needsSuperEnclosing()) {
    TypeDecl superClass = ((ClassDecl) typeDecl).superclass();
    list.add(superClass.enclosingType().getSootType());
  }
  // args
  for (int i = 0; i < getNumParameter(); i++)
    list.add(getParameter(i).type().getSootType());
  return hostType().getSootClassDecl().getMethod("<init>", list, soot.VoidType.v());
}
origin: Sable/soot

SootMethod sootMethod = runtime.getMethod("void <init>(java.lang.String)");
SootMethodRef methodRef = sootMethod.makeRef();
RefType myRefType = RefType.v(runtime);
origin: Sable/soot

private void loadBooleanValue(PatchingChain<Unit> units, SootField f, Unit insert) {
 units.insertBefore(Baf.v().newStaticGetInst(f.makeRef()), insert);
 if (f.getType() instanceof RefType) {
  SootMethod boolInit = ((RefType) f.getType()).getSootClass().getMethod("boolean booleanValue()");
  units.insertBefore(Baf.v().newVirtualInvokeInst(boolInit.makeRef()), insert);
 }
}
origin: Sable/soot

/**
 * @ast method
 * @aspect EmitJimple
 * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/JimpleBackend/EmitJimple.jrag:210
 */
public void jimplify1phase2() {
  String name = name();
  ArrayList parameters = new ArrayList();
  ArrayList paramnames = new ArrayList();
  for (int i = 0; i < getNumParameter(); i++) {
    parameters.add(getParameter(i).type().getSootType());
    paramnames.add(getParameter(i).name());
  }
  soot.Type returnType = type().getSootType();
  int modifiers = sootTypeModifiers();
  ArrayList throwtypes = new ArrayList();
  for (int i = 0; i < getNumException(); i++)
    throwtypes.add(getException(i).type().getSootClassDecl());
  String signature = SootMethod.getSubSignature(name, parameters, returnType);
  if (!hostType().getSootClassDecl().declaresMethod(signature)) {
    SootMethod m = Scene.v().makeSootMethod(name, parameters, returnType, modifiers, throwtypes);
    hostType().getSootClassDecl().addMethod(m);
    m.addTag(new soot.tagkit.ParamNamesTag(paramnames));
    sootMethod = m;
  } else {
    sootMethod = hostType().getSootClassDecl().getMethod(signature);
  }
  addAttributes();
}
origin: Sable/soot

  sootMethod = m;
} else {
  sootMethod = hostType().getSootClassDecl().getMethod(signature);
origin: Sable/soot

  .getMethod("<init>", Collections.<Type>singletonList(RefType.v("java.lang.String"))).makeRef();
SpecialInvokeExpr constructorInvokeExpr
  = Jimple.v().newSpecialInvokeExpr(exceptionLocal, cref, StringConstant.v(guard.message));
   .getSootClass("java.lang.Throwable").getMethod("printStackTrace", Collections.<Type>emptyList()).makeRef());
 InvokeStmt printStackTraceStmt = Jimple.v().newInvokeStmt(printStackTraceExpr);
 body.getUnits().insertAfter(printStackTraceStmt, initStmt);
origin: Sable/soot

SootMethod reset = counterClass.getMethod("void reset()");
SootMethod report = counterClass.getMethod("void report()");
origin: Sable/soot

 sootClass.addMethod(sootMethod);
} else {
 ((soot.javaToJimple.PolyglotMethodSource) sootClass.getMethod(methodName, paramTypes, methodRetType).getSource())
   .hasAssert(true);
sootSootClassgetMethod

Javadoc

Attempts to retrieve the method with the given name and parameters. This method may throw an AmbiguousMethodException if there is more than one method with the given name and parameter.

Popular methods of SootClass

  • isInterface
    Convenience method; returns true if this class is an interface.
  • getMethods
  • getName
    Returns the name of this class.
  • setApplicationClass
    Makes this class an application class.
  • getFields
    Returns a backed Chain of fields.
  • getInterfaces
    Returns a backed Chain of the interfaces that are directly implemented by this class. (see getInterf
  • getSuperclass
    WARNING: interfaces are subclasses of the java.lang.Object class! Returns the superclass of this cla
  • hasSuperclass
    WARNING: interfaces are subclasses of the java.lang.Object class! Does this class have a superclass?
  • resolvingLevel
  • addMethod
    Adds the given method to this class.
  • declaresMethod
    Does this class declare a method with the given subsignature?
  • getType
    Returns the RefType corresponding to this class.
  • declaresMethod,
  • getType,
  • isApplicationClass,
  • isLibraryClass,
  • addField,
  • isAbstract,
  • isPhantom,
  • <init>,
  • declaresField

Popular in Java

  • Making http requests using okhttp
  • onCreateOptionsMenu (Activity)
  • setScale (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now