&& !isAllPrimitiveTypes(mtd) && !mtd.getDeclaringClass() .getClassLoader() .getName() .toString()
public static boolean fromLoader(IClass declClass, ClassLoaderReference clr) { ClassLoaderReference nodeClRef = declClass.getClassLoader().getReference(); return nodeClRef.equals(clr); } }
@Override public void visitCheckCast(ITypeTestInstruction instruction) { for(String t : instruction.getTypes()) { castTypes.add(ShrikeUtil.makeTypeReference(getDeclaringClass().getClassLoader().getReference(), t)); } } }
/** * Create an {@link InducedCFG} from an instruction array. * * NOTE: SIDE EFFECT!!! ... nulls out phi instructions in the instruction array! */ public InducedCFG makeControlFlowGraph(SSAInstruction[] instructions) { return this.getDeclaringClass().getClassLoader().getLanguage().makeInducedCFG(instructions, this, Everywhere.EVERYWHERE); }
private boolean isRelevantMethod(IMethod target) { return !target.isAbstract() && (!applicationOnly || cha.getScope().isApplicationLoader(target.getDeclaringClass().getClassLoader())); }
@Override public Collection<Annotation> getAnnotations(boolean runtimeInvisible) throws InvalidClassFileException { AnnotationsReader r = getAnnotationsReader(runtimeInvisible ? AnnotationType.RuntimeInvisibleAnnotations : AnnotationType.RuntimeVisibleAnnotations); return Annotation.getAnnotationsFromReader(r, getDeclaringClass().getClassLoader().getReference()); }
private static int getNumberOfAppClasses(ClassHierarchy cha){ Iterator<IClass> classes = cha.iterator(); int numberOfClasses = 0; while(classes.hasNext()){ if(classes.next().getClassLoader().getName().toString().equals("Application")) numberOfClasses++; } return numberOfClasses; }
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 ); }
public Collection<TypeAnnotation> getTypeAnnotationsAtCode(boolean runtimeInvisible) throws InvalidClassFileException { TypeAnnotationsReader r = getTypeAnnotationsReaderAtCode( runtimeInvisible ? TypeAnnotationsReader.AnnotationType.RuntimeInvisibleTypeAnnotations : TypeAnnotationsReader.AnnotationType.RuntimeVisibleTypeAnnotations ); final ClassLoaderReference clRef = getDeclaringClass().getClassLoader().getReference(); return TypeAnnotation.getTypeAnnotationsFromReader( r, TypeAnnotation.targetConverterAtCode(clRef, this), clRef ); }
/** * if F is a supported constant representing a field, return the corresponding {@link InstanceFieldKey} for I. Otherwise, return {@code null}. */ protected PointerKey getInstanceFieldPointerKeyForConstant(InstanceKey I, ConstantKey<?> F) { Object v = F.getValue(); // FIXME: current only constant string are handled if (I.getConcreteType().getClassLoader().getLanguage().modelConstant(v)) { IField f = I.getConcreteType().getField(Atom.findOrCreateUnicodeAtom(String.valueOf(v))); return getPointerKeyForInstanceField(I, f); } return null; }
/** * Add constraints to represent the flow of exceptions to the exceptional return value for this node */ protected void addNodePassthruExceptionConstraints(CGNode node, IRView ir, DefUse du) { // add constraints relating to thrown exceptions that reach the exit block. List<ProgramCounter> peis = getIncomingPEIs(ir, ir.getExitBlock()); PointerKey exception = getPointerKeyForExceptionalReturnValue(node); TypeReference throwableType = node.getMethod().getDeclaringClass().getClassLoader().getLanguage().getThrowableType(); IClass c = node.getClassHierarchy().lookupClass(throwableType); addExceptionDefConstraints(ir, du, node, peis, exception, Collections.singleton(c)); }
@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 protected void processCallingConstraints(CGNode caller, SSAAbstractInvokeInstruction instruction, CGNode target, InstanceKey[][] constParams, PointerKey uniqueCatchKey) { if (JavaScriptLoader.JS.equals(caller.getMethod().getDeclaringClass().getClassLoader().getLanguage())) { JSSSAPropagationCallGraphBuilder.processCallingConstraintsInternal(this, caller, instruction, target, constParams, uniqueCatchKey); } else { super.processCallingConstraints(caller, instruction, target, constParams, uniqueCatchKey); } }
@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 MethodReference computeMethodReference() { try { Atom name = Atom.findOrCreateUnicodeAtom(getMethodName()); ImmutableByteArray desc = ImmutableByteArray.make(getMethodSignature()); Descriptor D = Descriptor.findOrCreate(declaringClass.getClassLoader().getLanguage(), desc); return MethodReference.findOrCreate(declaringClass.getReference(), name, D); } catch (InvalidClassFileException e) { Assertions.UNREACHABLE(); return null; } }
@Override public boolean test(CGNode o) { if (o == null) return false; return o.getMethod().getDeclaringClass().getClassLoader().getReference().equals(ClassLoaderReference.Application); } }
private MethodReference computeMethodReference() { try { Atom name = Atom.findOrCreateUnicodeAtom(getMethodName()); ImmutableByteArray desc = ImmutableByteArray.make(getMethodSignature()); Descriptor D = Descriptor.findOrCreate(declaringClass.getClassLoader().getLanguage(), desc); return MethodReference.findOrCreate(declaringClass.getReference(), name, D); } catch (InvalidClassFileException e) { Assertions.UNREACHABLE(); return null; } }
@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 IntSet getRelevantParameters(CGNode caller, CallSiteReference site) { MutableIntSet s = IntSetUtil.make(); for(int i = 0; i < caller.getIR().getCalls(site)[0].getNumberOfUses(); i++) { if (!caller.getMethod().getDeclaringClass().getClassLoader().getLanguage().methodsHaveDeclaredParameterTypes() || dispatchIndex(site, i)) { s.add(i); } } return s; }
private IMethod makeUnaryNumberCall(IClass cls) { JSInstructionFactory insts = (JSInstructionFactory)cls.getClassLoader().getInstructionFactory(); MethodReference ref = AstMethodReference.fnReference(JavaScriptTypes.Number); JavaScriptSummary S = new JavaScriptSummary(ref, 2); S.addStatement(insts.GetInstruction(S.getNumberOfStatements(), 4, 2, "toNumber")); S.getNextProgramCounter(); CallSiteReference cs = new DynamicCallSiteReference(JavaScriptTypes.CodeBody, S.getNextProgramCounter()); S.addStatement(insts.Invoke(S.getNumberOfStatements(), 4, 5, new int[] { 2 }, 6, cs)); S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 5, false)); S.getNextProgramCounter(); return new JavaScriptConstructor(ref, S, cls, cha.lookupClass(JavaScriptTypes.Number)); }