@Override public IClassLoader getLoader(ClassLoaderReference loaderRef) { for (IClassLoader loader : loaders) { if (loader.getReference().equals(loaderRef)) { return loader; } } Assertions.UNREACHABLE(); return null; }
public static boolean fromLoader(IClass declClass, ClassLoaderReference clr) { ClassLoaderReference nodeClRef = declClass.getClassLoader().getReference(); return nodeClRef.equals(clr); } }
Collection<Annotation> getAnnotations(Field m) { List<Annotation> result = new ArrayList<>(); for(org.jf.dexlib2.iface.Annotation a : m.getAnnotations()) { result.add(DexUtil.getAnnotation(a, getClassLoader().getReference())); } return result; }
List<Annotation> getAnnotations(Method m, Set<String> set) { List<Annotation> result = new ArrayList<>(); for(org.jf.dexlib2.iface.Annotation a : m.getAnnotations()) { if (set == null || set.contains(AnnotationVisibility.getVisibility(a.getVisibility()))) { result.add(DexUtil.getAnnotation(a, getClassLoader().getReference())); } } return result; }
@Override public Collection<Annotation> getAnnotations(boolean runtimeInvisible) throws InvalidClassFileException { AnnotationsReader r = getAnnotationsReader(runtimeInvisible); return Annotation.getAnnotationsFromReader(r, getClassLoader().getReference()); }
@Override public void visitCheckCast(ITypeTestInstruction instruction) { for(String t : instruction.getTypes()) { castTypes.add(ShrikeUtil.makeTypeReference(getDeclaringClass().getClassLoader().getReference(), t)); } } }
@Override public void visitCheckCast(ITypeTestInstruction instruction) { for(String t : instruction.getTypes()) { castTypes.add(ShrikeUtil.makeTypeReference(getDeclaringClass().getClassLoader().getReference(), t)); } } }
public Collection<TypeAnnotation> getTypeAnnotations(boolean runtimeInvisible) throws InvalidClassFileException { TypeAnnotationsReader r = getTypeAnnotationsReader(runtimeInvisible); final ClassLoaderReference clRef = getClassLoader().getReference(); return TypeAnnotation.getTypeAnnotationsFromReader( r, TypeAnnotation.targetConverterAtClassFile(clRef), clRef ); }
public static boolean fromLoader(CGNode node, ClassLoaderReference clr) { IClass declClass = node.getMethod().getDeclaringClass(); ClassLoaderReference nodeClRef = declClass.getClassLoader().getReference(); return nodeClRef.equals(clr); }
@Override public Collection<Annotation> getAnnotations(boolean runtimeInvisible) throws InvalidClassFileException { AnnotationsReader r = getAnnotationsReader(runtimeInvisible ? AnnotationType.RuntimeInvisibleAnnotations : AnnotationType.RuntimeVisibleAnnotations); return Annotation.getAnnotationsFromReader(r, getDeclaringClass().getClassLoader().getReference()); }
public Collection<TypeAnnotation> getTypeAnnotationsAtMethodInfo(boolean runtimeInvisible) throws InvalidClassFileException { TypeAnnotationsReader r = getTypeAnnotationsReaderAtMethodInfo( runtimeInvisible ? TypeAnnotationsReader.AnnotationType.RuntimeInvisibleTypeAnnotations : TypeAnnotationsReader.AnnotationType.RuntimeVisibleTypeAnnotations ); final ClassLoaderReference clRef = getDeclaringClass().getClassLoader().getReference(); return TypeAnnotation.getTypeAnnotationsFromReader( r, TypeAnnotation.targetConverterAtMethodInfo(clRef), clRef ); }
/** * initialize the TypeReference field for this instance * * @throws InvalidClassFileException * iff Shrike can't read this class */ private void computeTypeReference() throws InvalidClassFileException { String className = 'L' + reader.get().getName(); ImmutableByteArray name = ImmutableByteArray.make(className); typeReference = TypeReference.findOrCreate(getClassLoader().getReference(), TypeName.findOrCreate(name)); }
/** * Restrict g to nodes from the Application loader */ public static Graph<IClass> pruneForAppLoader(Graph<IClass> g) { Predicate<IClass> f = c -> (c.getClassLoader().getReference().equals(ClassLoaderReference.Application)); return pruneGraph(g, f); }
@Override public void visitInvoke(IInvokeInstruction instruction) { IClassLoader loader = getDeclaringClass().getClassLoader(); MethodReference m = MethodReference.findOrCreate(loader.getLanguage(), loader.getReference(), instruction.getClassType(), instruction.getMethodName(), instruction.getMethodSignature()); int programCounter = 0; programCounter = getProgramCounter(); CallSiteReference site = null; site = CallSiteReference.make(programCounter, m, instruction.getInvocationCode()); callSites.add(site); }
@Override public void visitInvoke(IInvokeInstruction instruction) { popN(instruction); ClassLoaderReference loader = cfg.getMethod().getDeclaringClass().getClassLoader().getReference(); TypeReference returnType = ShrikeUtil.makeTypeReference(loader, Util.getReturnType(instruction.getMethodSignature())); if (!returnType.equals(TypeReference.Void)) { workingState.push(UNANALYZED); } }
@Override public boolean test(CGNode o) { if (o == null) return false; return o.getMethod().getDeclaringClass().getClassLoader().getReference().equals(ClassLoaderReference.Application); } }
@Override public void visitInvoke(IInvokeInstruction instruction) { popN(instruction); ClassLoaderReference loader = cfg.getMethod().getDeclaringClass().getClassLoader().getReference(); TypeReference returnType = ShrikeUtil.makeTypeReference(loader, Util.getReturnType(instruction.getMethodSignature())); if (!returnType.equals(TypeReference.Void)) { workingState.push(UNANALYZED); } }
private static ClassLoaderReference findLoader(String loaderName, IClassHierarchy cha) { Atom loaderAtom = Atom.findOrCreateUnicodeAtom(loaderName); IClassLoader[] loaders = cha.getLoaders(); for (IClassLoader loader : loaders) { if (loader.getName() == loaderAtom) { return loader.getReference(); } } Assertions.UNREACHABLE(); return null; }
protected JavaField(CAstEntity fieldEntity, IClassLoader loader, IClass declaringClass, Collection<Annotation> annotations) { super(FieldReference.findOrCreate(declaringClass.getReference(), Atom.findOrCreateUnicodeAtom(fieldEntity.getName()), TypeReference.findOrCreate(loader.getReference(), TypeName.string2TypeName(fieldEntity.getType().getName()))), fieldEntity.getQualifiers(), declaringClass, declaringClass.getClassHierarchy(), annotations); } }
@Override protected void leaveTypeLiteralExpr(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) { WalkContext wc = c; assert n.getChild(0).getKind() == CAstNode.CONSTANT; String typeNameStr = (String) n.getChild(0).getValue(); TypeName typeName = TypeName.string2TypeName(typeNameStr); TypeReference typeRef = TypeReference.findOrCreate(loader.getReference(), typeName); int result = wc.currentScope().allocateTempValue(); c.setValue(n, result); wc.cfg().addInstruction(insts.LoadMetadataInstruction(wc.cfg().currentInstruction, result, loader.getLanguage().getConstantType(typeRef), typeRef)); }