Tabnine Logo
FastHierarchy.canStoreType
Code IndexAdd Tabnine to your IDE (free)

How to use
canStoreType
method
in
soot.FastHierarchy

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

origin: Sable/soot

final public boolean castNeverFails(Type src, Type dst) {
 if (fh == null) {
  return true;
 } else if (dst == null) {
  return true;
 } else if (dst == src) {
  return true;
 } else if (src == null) {
  return false;
 } else if (src instanceof NullType) {
  return true;
 } else if (src instanceof AnySubType) {
  return true;
 } else if (dst instanceof NullType) {
  return false;
 } else if (dst instanceof AnySubType) {
  throw new RuntimeException("oops src=" + src + " dst=" + dst);
 } else {
  return getFastHierarchy().canStoreType(src, dst);
 }
}
origin: Sable/soot

if (fh.canStoreType(paramType, rType)) {
 return true;
origin: Sable/soot

public static boolean ancestor_(Type ancestor, Type child) {
 if (TypeResolver.typesEqual(ancestor, child)) {
  return true;
 } else if (child instanceof BottomType) {
  return true;
 } else if (ancestor instanceof BottomType) {
  return false;
 } else if (ancestor instanceof IntegerType && child instanceof IntegerType) {
  return true;
 } else if (ancestor instanceof PrimType || child instanceof PrimType) {
  return false;
 } else if (child instanceof NullType) {
  return true;
 } else if (ancestor instanceof NullType) {
  return false;
 } else {
  return Scene.v().getOrMakeFastHierarchy().canStoreType(child, ancestor);
 }
}
origin: Sable/soot

/** Adds to the set all pairs (l,type) where type is any supertype of t. */
public void localMustBeSubtypeOf(Local l, RefType t) {
 FastHierarchy fh = Scene.v().getFastHierarchy();
 for (Type type : types) {
  RefType supertype = (RefType) type;
  if (fh.canStoreType(t, supertype)) {
   set(indexOf(l, supertype));
  }
 }
}
origin: Sable/soot

protected void checkNode(Node container, Node n, Node upstream) {
 if (container.getReplacement() != container) {
  throw new RuntimeException("container " + container + " is illegal");
 }
 if (upstream.getReplacement() != upstream) {
  throw new RuntimeException("upstream " + upstream + " is illegal");
 }
 PointsToSetInternal p2set = container.getP2Set();
 FastHierarchy fh = pag.getTypeManager().getFastHierarchy();
 if (!p2set.contains(n)
   && (fh == null || container.getType() == null || fh.canStoreType(n.getType(), container.getType()))) {
  logger.debug("Check failure: " + container + " does not have " + n + "; upstream is " + upstream);
 }
}
origin: Sable/soot

protected void checkNode(Node container, Node n, Node upstream) {
 if (container.getReplacement() != container) {
  throw new RuntimeException("container " + container + " is illegal");
 }
 if (upstream.getReplacement() != upstream) {
  throw new RuntimeException("upstream " + upstream + " is illegal");
 }
 PointsToSetInternal p2set = container.getP2Set();
 FastHierarchy fh = pag.getTypeManager().getFastHierarchy();
 if (!p2set.contains(n)
   && (fh == null || container.getType() == null || fh.canStoreType(n.getType(), container.getType()))) {
  logger.debug("Check failure: " + container + " does not have " + n + "; upstream is " + upstream);
 }
}
origin: Sable/soot

private static soot.Local getLocalOfType(soot.Body body, soot.Type type) {
 soot.FastHierarchy fh = InitialResolver.v().hierarchy();
 Iterator stmtsIt = body.getUnits().iterator();
 soot.Local correctLocal = null;
 while (stmtsIt.hasNext()) {
  soot.jimple.Stmt s = (soot.jimple.Stmt) stmtsIt.next();
  if (s instanceof soot.jimple.IdentityStmt && (s.hasTag("EnclosingTag") || s.hasTag("QualifyingTag"))) {
   Iterator it = s.getDefBoxes().iterator();
   while (it.hasNext()) {
    soot.ValueBox vb = (soot.ValueBox) it.next();
    if ((vb.getValue() instanceof soot.Local) && (fh.canStoreType(type, vb.getValue().getType()))) {
     // (vb.getValue().getType().equals(type))){
     correctLocal = (soot.Local) vb.getValue();
    }
   }
  }
 }
 return correctLocal;
}
origin: Sable/soot

private static boolean bodyHasLocal(soot.Body body, soot.Type type) {
 soot.FastHierarchy fh = InitialResolver.v().hierarchy();
 Iterator stmtsIt = body.getUnits().iterator();
 while (stmtsIt.hasNext()) {
  soot.jimple.Stmt s = (soot.jimple.Stmt) stmtsIt.next();
  if (s instanceof soot.jimple.IdentityStmt && (s.hasTag("EnclosingTag") || s.hasTag("QualifyingTag"))) {
   Iterator it = s.getDefBoxes().iterator();
   while (it.hasNext()) {
    soot.ValueBox vb = (soot.ValueBox) it.next();
    if ((vb.getValue() instanceof soot.Local) && (fh.canStoreType(type, vb.getValue().getType()))) {
     // (vb.getValue().getType().equals(type))){
     return true;
    }
   }
  }
 }
 return false;
 /*
  * soot.FastHierarchy fh = InitialResolver.v().hierarchy(); Iterator it = body.getDefBoxes().iterator(); while
  * (it.hasNext()){ soot.ValueBox vb = (soot.ValueBox)it.next(); if ((vb.getValue() instanceof soot.Local) &&
  * (fh.canStoreType(type, vb.getValue().getType()))){//(vb.getValue().getType().equals(type))){ return true; } } return
  * false;
  */
}
origin: Sable/soot

protected Set<SootMethod> getCallTargetsForType(Type type, NumberedString methodStr, Type receiverType,
  Set<SootMethod> possibleTargets) {
 if (!pag.getTypeManager().castNeverFails(type, receiverType)) {
  return Collections.<SootMethod>emptySet();
 }
 if (type instanceof AnySubType) {
  AnySubType any = (AnySubType) type;
  RefType refType = any.getBase();
  if (pag.getTypeManager().getFastHierarchy().canStoreType(receiverType, refType)
    || pag.getTypeManager().getFastHierarchy().canStoreType(refType, receiverType)) {
   return possibleTargets;
  } else {
   return Collections.<SootMethod>emptySet();
  }
 }
 if (type instanceof ArrayType) {
  // we'll invoke the java.lang.Object method in this
  // case
  // Assert.chk(varNodeType.toString().equals("java.lang.Object"));
  type = Scene.v().getSootClass("java.lang.Object").getType();
 }
 RefType refType = (RefType) type;
 SootMethod targetMethod = null;
 targetMethod = VirtualCalls.v().resolveNonSpecial(refType, methodStr);
 return Collections.<SootMethod>singleton(targetMethod);
}
origin: Sable/soot

 return false;
} else {
 return canStoreType(achild.baseType, aparent.baseType);
origin: Sable/soot

AnySubType any = (AnySubType) type;
RefType refType = any.getBase();
if (pag.getTypeManager().getFastHierarchy().canStoreType(receiverType, refType)
  || pag.getTypeManager().getFastHierarchy().canStoreType(refType, receiverType)) {
 return true;
origin: Sable/soot

public boolean addAllocEdge(AllocNode from, VarNode to) {
 FastHierarchy fh = typeManager.getFastHierarchy();
 if (fh == null || to.getType() == null || fh.canStoreType(from.getType(), to.getType())) {
  if (doAddAllocEdge(from, to)) {
   edgeQueue.add(from);
   edgeQueue.add(to);
   return true;
  }
 }
 return false;
}
origin: Sable/soot

if (declaredType != null && !fastHierachy.canStoreType(t, declaredType)) {
 return;
if (sigType != null && !fastHierachy.canStoreType(t, sigType)) {
 return;
origin: Sable/soot

public SootMethod resolveSpecial(SpecialInvokeExpr iie, NumberedString subSig, SootMethod container, boolean appOnly) {
 SootMethod target = iie.getMethod();
 /* cf. JVM spec, invokespecial instruction */
 if (Scene.v().getOrMakeFastHierarchy().canStoreType(container.getDeclaringClass().getType(),
   target.getDeclaringClass().getType())
   && container.getDeclaringClass().getType() != target.getDeclaringClass().getType()
   && !target.getName().equals("<init>") && subSig != sigClinit) {
  return resolveNonSpecial(container.getDeclaringClass().getSuperclass().getType(), subSig, appOnly);
 } else {
  return target;
 }
}
origin: Sable/soot

public static soot.Local getThisGivenOuter(soot.Type sootType, HashMap getThisMap, soot.Body body, LocalGenerator lg,
  soot.Local t2) {
 if (InitialResolver.v().hierarchy() == null) {
  InitialResolver.v().hierarchy(new soot.FastHierarchy());
 }
 soot.FastHierarchy fh = InitialResolver.v().hierarchy();
 while (!fh.canStoreType(t2.getType(), sootType)) {
  soot.SootClass classToInvoke = ((soot.RefType) t2.getType()).getSootClass();
  // make an access method and add it to that class for accessing
  // its private this$0 field
  soot.SootMethod methToInvoke = makeOuterThisAccessMethod(classToInvoke);
  // generate a local that corresponds to the invoke of that meth
  soot.Local t3 = lg.generateLocal(methToInvoke.getReturnType());
  ArrayList methParams = new ArrayList();
  methParams.add(t2);
  soot.Local res = getPrivateAccessFieldInvoke(methToInvoke.makeRef(), methParams, body, lg);
  soot.jimple.AssignStmt assign = soot.jimple.Jimple.v().newAssignStmt(t3, res);
  body.getUnits().add(assign);
  t2 = t3;
 }
 getThisMap.put(sootType, t2);
 return t2;
}
origin: Sable/soot

public void caseCastExpr(CastExpr expr) {
 result = result.add(mgr.RESOLVE_CLASS_ERRORS);
 Type fromType = expr.getOp().getType();
 Type toType = expr.getCastType();
 if (toType instanceof RefLikeType) {
  // fromType might still be unknown when we are called,
  // but toType will have a value.
  FastHierarchy h = Scene.v().getOrMakeFastHierarchy();
  if (fromType == null || fromType instanceof UnknownType
    || ((!(fromType instanceof NullType)) && (!h.canStoreType(fromType, toType)))) {
   result = result.add(mgr.CLASS_CAST_EXCEPTION);
  }
 }
 result = result.add(mightThrow(expr.getOp()));
}
origin: Sable/soot

for (Iterator<VirtualCallSite> siteIt = receiverToSites.get(receiver).iterator(); siteIt.hasNext();) {
 final VirtualCallSite site = siteIt.next();
 if (site.kind() == Kind.THREAD && !fh.canStoreType(type, clRunnable)) {
  continue;
 if (site.kind() == Kind.EXECUTOR && !fh.canStoreType(type, clRunnable)) {
  continue;
 if (site.kind() == Kind.ASYNCTASK && !fh.canStoreType(type, clAsyncTask)) {
  continue;
 if (site.kind() == Kind.HANDLER && !fh.canStoreType(type, clHandler)) {
  continue;
origin: Sable/soot

 @Override
 public void caseCastExpr(CastExpr expr) {
  if (expr.getCastType() instanceof PrimType) {
   // No exception are thrown for primitive casts
   return;
  }
  Type fromType = expr.getOp().getType();
  Type toType = expr.getCastType();
  result = result.add(mgr.RESOLVE_CLASS_ERRORS);
  if (toType instanceof RefLikeType) {
   // fromType might still be unknown when we are called,
   // but toType will have a value.
   FastHierarchy h = Scene.v().getOrMakeFastHierarchy();
   if (fromType == null || fromType instanceof UnknownType
     || ((!(fromType instanceof NullType)) && (!h.canStoreType(fromType, toType)))) {
    result = result.add(mgr.CLASS_CAST_EXCEPTION);
   }
  }
  result = result.add(mightThrow(expr.getOp()));
 }
};
origin: Sable/soot

body.getUnits().add(fieldAssignStmt);
if (fh.canStoreType(t1.getType(), sootType)) {
 getThisMap.put(sootType, t1);
 return t1;
origin: Sable/soot

addToClass = body.getMethod().getDeclaringClass().getOuterClass();
while (!InitialResolver.v().hierarchy().canStoreType(containingClass.getType(), addToClass.getType())) {
 if (addToClass.hasOuterClass()) {
  addToClass = addToClass.getOuterClass();
sootFastHierarchycanStoreType

Javadoc

Given an object of declared type child, returns true if the object can be stored in a variable of type parent. If child is an interface that is not a subinterface of parent, this method will return false even though some objects implementing the child interface may also implement the parent interface.

Popular methods of FastHierarchy

  • isSubclass
    Return true if class child is a subclass of class parent, neither of them being allowed to be interf
  • <init>
    Constructs a hierarchy from the current scene.
  • canStoreClass
    Given an object of declared type child, returns true if the object can be stored in a variable of ty
  • dfsVisit
  • getAllImplementersOfInterface
    For an interface parent (MUST be an interface), returns set of all implementers of it but NOT their
  • getAllSubinterfaces
    For an interface parent (MUST be an interface), returns set of all subinterfaces.
  • getSubclassesOf
  • isVisible
    Returns true if the method m is visible from code in the class from.
  • resolveConcreteDispatch
    Given an object of actual type C (o = new C()), returns the method which will be called on an o.f()
  • put
  • canStoreClassClassic
    "Classic" implementation using the intuitive approach (without using Interval) to check whetherchild
  • resolveAbstractDispatch
    Given an object of declared type C, returns the methods which could be called on an o.f() invocation
  • canStoreClassClassic,
  • resolveAbstractDispatch

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • notifyDataSetChanged (ArrayAdapter)
  • setRequestProperty (URLConnection)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • 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