&& !mtd.isAbstract() && !mtd.isNative() && !isAllPrimitiveTypes(mtd)
private boolean isRelevantMethod(IMethod target) { return !target.isAbstract() && (!applicationOnly || cha.getScope().isApplicationLoader(target.getDeclaringClass().getClassLoader())); }
private boolean isRelevantMethod(IMethod target) { return !target.isAbstract() && (!applicationOnly || cha.getScope().isApplicationLoader(target.getDeclaringClass().getClassLoader())); }
@Override public Collection<IMethod> getAllMethods() { Collection<IMethod> result = new LinkedList<>(getDeclaredMethods()); if (isInterface()) { for (IClass i : getDirectInterfaces()) { result.addAll(i.getAllMethods()); } } else { // for non-interfaces, add default methods inherited from interfaces #219. for (IClass i : this.getAllImplementedInterfaces()) for (IMethod m : i.getDeclaredMethods()) if (!m.isAbstract()) result.add(m); } IClass s = getSuperclass(); while (s != null) { result.addAll(s.getDeclaredMethods()); s = s.getSuperclass(); } return result; }
@Override public Collection<IMethod> getAllMethods() { Collection<IMethod> result = new LinkedList<>(getDeclaredMethods()); if (isInterface()) { for (IClass i : getDirectInterfaces()) { result.addAll(i.getAllMethods()); } } else { // for non-interfaces, add default methods inherited from interfaces #219. for (IClass i : this.getAllImplementedInterfaces()) for (IMethod m : i.getDeclaredMethods()) if (!m.isAbstract()) result.add(m); } IClass s = getSuperclass(); while (s != null) { result.addAll(s.getDeclaredMethods()); s = s.getSuperclass(); } return result; }
/** * @param scope governing analyais scope * @param cha governing class hierarchy * @throws IllegalArgumentException if cha is null */ public AllApplicationEntrypoints(AnalysisScope scope, final IClassHierarchy cha) { if (cha == null) { throw new IllegalArgumentException("cha is null"); } for (IClass klass : cha) { if (!klass.isInterface()) { if (isApplicationClass(scope, klass)) { for (IMethod method : klass.getDeclaredMethods()) { if (!method.isAbstract()) { add(new ArgumentTypeEntrypoint(method, cha)); } } } } } if (DEBUG) { System.err.println((getClass() + "Number of EntryPoints:" + size())); } }
/** * @param scope governing analyais scope * @param cha governing class hierarchy * @throws IllegalArgumentException if cha is null */ public AllApplicationEntrypoints(AnalysisScope scope, final IClassHierarchy cha) { if (cha == null) { throw new IllegalArgumentException("cha is null"); } for (IClass klass : cha) { if (!klass.isInterface()) { if (isApplicationClass(scope, klass)) { for (IMethod method : klass.getDeclaredMethods()) { if (!method.isAbstract()) { add(new ArgumentTypeEntrypoint(method, cha)); } } } } } if (DEBUG) { System.err.println((getClass() + "Number of EntryPoints:" + size())); } }
/** * @param m a method * @param options options governing ssa construction * @return DefUse information for m, built according to the specified options. null if unavailable * @throws IllegalArgumentException if m is null */ public synchronized DefUse findOrCreateDU(IMethod m, Context c, SSAOptions options) { if (m == null) { throw new IllegalArgumentException("m is null"); } if (m.isAbstract() || m.isNative()) { return null; } if (factory.contextIsIrrelevant(m)) { c = Everywhere.EVERYWHERE; } DefUse du = (DefUse) duCache.find(m, c, options); if (du == null) { IR ir = findOrCreateIR(m, c, options); du = new DefUse(ir); duCache.cache(m, c, options, du); } return du; }
/** * @param m a method * @param options options governing ssa construction * @return DefUse information for m, built according to the specified options. null if unavailable * @throws IllegalArgumentException if m is null */ public synchronized DefUse findOrCreateDU(IMethod m, Context c, SSAOptions options) { if (m == null) { throw new IllegalArgumentException("m is null"); } if (m.isAbstract() || m.isNative()) { return null; } if (factory.contextIsIrrelevant(m)) { c = Everywhere.EVERYWHERE; } DefUse du = (DefUse) duCache.find(m, c, options); if (du == null) { IR ir = findOrCreateIR(m, c, options); du = new DefUse(ir); duCache.cache(m, c, options, du); } return du; }
/** * @param m a "normal" (bytecode-based) method * @param options options governing ssa construction * @return an IR for m, built according to the specified options. null if m is abstract or native. * @throws IllegalArgumentException if m is null */ public synchronized IR findOrCreateIR(final IMethod m, Context c, final SSAOptions options) { if (m == null) { throw new IllegalArgumentException("m is null"); } if (m.isAbstract() || m.isNative()) { return null; } if (factory.contextIsIrrelevant(m)) { c = Everywhere.EVERYWHERE; } if (DISABLE) { return factory.makeIR(m, c, options); } IR ir = (IR) irCache.find(m, c, options); if (ir == null) { ir = factory.makeIR(m, c, options); irCache.cache(m, c, options, ir); } return ir; }
/** * @param m a "normal" (bytecode-based) method * @param options options governing ssa construction * @return an IR for m, built according to the specified options. null if m is abstract or native. * @throws IllegalArgumentException if m is null */ public synchronized IR findOrCreateIR(final IMethod m, Context c, final SSAOptions options) { if (m == null) { throw new IllegalArgumentException("m is null"); } if (m.isAbstract() || m.isNative()) { return null; } if (factory.contextIsIrrelevant(m)) { c = Everywhere.EVERYWHERE; } if (DISABLE) { return factory.makeIR(m, c, options); } IR ir = (IR) irCache.find(m, c, options); if (ir == null) { ir = factory.makeIR(m, c, options); irCache.cache(m, c, options, ir); } return ir; }
/** * @param caller the caller node * @param iKey an abstraction of the receiver of the call (or null if not applicable) * @return the CGNode to which this particular call should dispatch. */ protected CGNode getTargetForCall(CGNode caller, CallSiteReference site, IClass recv, InstanceKey iKey[]) { IMethod targetMethod = options.getMethodTargetSelector().getCalleeTarget(caller, site, recv); // this most likely indicates an exclusion at work; the target selector // should have issued a warning if (targetMethod == null || targetMethod.isAbstract()) { return null; } Context targetContext = contextSelector.getCalleeTarget(caller, site, targetMethod, iKey); if (targetContext.isA(IllegalArgumentExceptionContext.class)) { return null; } try { return getCallGraph().findOrCreateNode(targetMethod, targetContext); } catch (CancelException e) { return null; } }
/** * @param caller the caller node * @param iKey an abstraction of the receiver of the call (or null if not applicable) * @return the CGNode to which this particular call should dispatch. */ protected CGNode getTargetForCall(CGNode caller, CallSiteReference site, IClass recv, InstanceKey iKey[]) { IMethod targetMethod = options.getMethodTargetSelector().getCalleeTarget(caller, site, recv); // this most likely indicates an exclusion at work; the target selector // should have issued a warning if (targetMethod == null || targetMethod.isAbstract()) { return null; } Context targetContext = contextSelector.getCalleeTarget(caller, site, targetMethod, iKey); if (targetContext.isA(IllegalArgumentExceptionContext.class)) { return null; } try { return getCallGraph().findOrCreateNode(targetMethod, targetContext); } catch (CancelException e) { return null; } }
@Override @SuppressWarnings("deprecation") public CGNode findOrCreateNode(IMethod method, Context C) throws CancelException { assert C.equals(Everywhere.EVERYWHERE); assert !method.isAbstract(); CGNode n = getNode(method, C); if (n == null) { assert !isInitialized; n = makeNewNode(method, C); IMethod clinit = method.getDeclaringClass().getClassInitializer(); if (clinit != null && getNode(clinit, Everywhere.EVERYWHERE) == null) { CGNode cln = makeNewNode(clinit, Everywhere.EVERYWHERE); CGNode clinits = getFakeWorldClinitNode(); clinits.addTarget(CallSiteReference.make(clinitPC++, clinit.getReference(), IInvokeInstruction.Dispatch.STATIC), cln); } } return n; }
@Override @SuppressWarnings("deprecation") public CGNode findOrCreateNode(IMethod method, Context C) throws CancelException { assert C.equals(Everywhere.EVERYWHERE); assert !method.isAbstract(); CGNode n = getNode(method, C); if (n == null) { assert !isInitialized; n = makeNewNode(method, C); IMethod clinit = method.getDeclaringClass().getClassInitializer(); if (clinit != null && getNode(clinit, Everywhere.EVERYWHERE) == null) { CGNode cln = makeNewNode(clinit, Everywhere.EVERYWHERE); CGNode clinits = getFakeWorldClinitNode(); clinits.addTarget(CallSiteReference.make(clinitPC++, clinit.getReference(), IInvokeInstruction.Dispatch.STATIC), cln); } } return n; }
public static Iterable<Entrypoint> makePrimordialPublicEntrypoints(ClassHierarchy cha, String pkg) { final HashSet<Entrypoint> result = HashSetFactory.make(); for (IClass clazz : cha) { if (clazz.getName().toString().indexOf(pkg) != -1 && !clazz.isInterface() && !clazz.isAbstract()) { for (IMethod method : clazz.getDeclaredMethods()) { if (method.isPublic() && !method.isAbstract()) { System.out.println("Entry:" + method.getReference()); result.add(new DefaultEntrypoint(method, cha)); } } } } return result::iterator; }
if (m.isAbstract()) { System.err.println(m); } else {
dispatch = IInvokeInstruction.Dispatch.SPECIAL; else if (im.isAbstract()) { dispatch = IInvokeInstruction.Dispatch.INTERFACE;
public static Set<IMethod> assertUserCodeReachable(CallGraph cg, Set<MethodReference> uncalled) { Set<IMethod> result = HashSetFactory.make(); for(IClass cls : Iterator2Iterable.make(cg.getClassHierarchy().getLoader(ClassLoaderReference.Application).iterateAllClasses())) { if (cls.isInterface()) { continue; } if (! cls.getName().toString().startsWith("Landroid") && ! cls.getName().toString().equals("Lde/ecspride/R$styleable")) { for(IMethod m : cls.getDeclaredMethods()) { if (!m.isInit() && !m.isAbstract() && !uncalled.contains(m.getReference())) { if (! cg.getNodes(m.getReference()).isEmpty()) { System.err.println("found " + m); } else { result.add(m); } } } } } return result; }
public static int getMethodAccessCode(IMethod m) { int res = 0x0; if (m == null) return res; if (m.isPublic()) { res |= JvmMethodAccessFlags.PUBLIC.getValue(); } else if (m.isProtected()) { res |= JvmMethodAccessFlags.PROTECTED.getValue(); } else if (m.isPrivate()) { res |= JvmMethodAccessFlags.PRIVATE.getValue(); } else { res |= JvmMethodAccessFlags.PACKAGE_PROTECTED.getValue(); } if (m.isStatic()) res |= JvmMethodAccessFlags.STATIC.getValue(); if (m.isFinal()) res |= JvmMethodAccessFlags.FINAL.getValue(); if (m.isAbstract()) res |= JvmMethodAccessFlags.ABSTRACT.getValue(); return res; }