private void analyzeMethod(ClassContext classContext, Method method) throws CFGBuilderException, ClassNotFoundException, DataflowAnalysisException { CFG cfg = classContext.getCFG(method); for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) { Location location = i.next(); Instruction ins = location.getHandle().getInstruction(); if (ins instanceof InvokeInstruction) { if (TARGET_METHOD != null && !((InvokeInstruction) ins).getMethodName(classContext.getConstantPoolGen()).equals(TARGET_METHOD)) { continue; } System.out.println("\n*******************************************************\n"); System.out.println("Method invocation: " + location.getHandle()); System.out.println("\tInvoking: " + SignatureConverter.convertMethodSignature((InvokeInstruction) ins, classContext.getConstantPoolGen())); JavaClassAndMethod proto = Hierarchy.findInvocationLeastUpperBound((InvokeInstruction) ins, classContext.getConstantPoolGen()); if (proto == null) { System.out.println("\tUnknown prototype method"); } else { System.out.println("\tPrototype method: class=" + proto.getJavaClass().getClassName() + ", method=" + proto.getMethod()); } Set<JavaClassAndMethod> calledMethodSet = Hierarchy.resolveMethodCallTargets((InvokeInstruction) ins, classContext.getTypeDataflow(method).getFactAtLocation(location), classContext.getConstantPoolGen()); System.out.println("\tTarget method set: " + calledMethodSet); } } }
UselessValuesContext(ClassContext classContext, Method method) throws CheckedAnalysisException { this.classContext = classContext; this.method = method; cfg = classContext.getCFG(method); cpg = cfg.getMethodGen().getConstantPool(); ta = classContext.getTypeDataflow(method).getAnalysis(); vna = classContext.getValueNumberDataflow(method).getAnalysis(); }
&& "(Ljava/lang/Object;)Ljava/lang/String;".equals(sig1)) { try { TypeDataflow typeDataflow = classContext.getTypeDataflow(method); TypeFrame frame = typeDataflow.getFactAtLocation(location); if (!frame.isValid()) {
TypeDataflow typeDataflow = classContext.getTypeDataflow(method); TypeFrame frame = typeDataflow.getFactAtLocation(location); if (frame.isValid()) {
LocationAndFactPair lfp = getClassContext().getTypeDataflow(getMethod()).getLocationAndFactForInstruction( getPC());
public void dumpDataflowInformation(Method method) { try { dumpDataflowInformation(method, getCFG(method), getValueNumberDataflow(method), getIsNullValueDataflow(method), getUnconditionalValueDerefDataflow(method), getTypeDataflow(method)); } catch (DataflowAnalysisException e) { AnalysisContext.logError( "Could not dump data information for " + getJavaClass().getClassName() + "." + method.getName(), e); } catch (CFGBuilderException e) { AnalysisContext.logError( "Could not dump data information for " + getJavaClass().getClassName() + "." + method.getName(), e); } }
TypeDataflow typeDataflow = classContext.getTypeDataflow(method);
TypeDataflow typeDataflow = classContext.getTypeDataflow(method); ConstantPoolGen cpg = classContext.getConstantPoolGen();
TypeDataflow typeDataflow = classContext.getTypeDataflow(method); ConstantPoolGen cpg = classContext.getConstantPoolGen();
TypeDataflow typeDataflow = classContext.getTypeDataflow(method); ConstantPoolGen constantPoolGen = classContext.getConstantPoolGen();
try { ConstantPoolGen cpg = classContext.getConstantPoolGen(); TypeDataflow typeDataflow = classContext.getTypeDataflow(method);
dataflow, classContext.getTypeDataflow(method));
typeDataflow = classContext.getTypeDataflow(method); } catch (CheckedAnalysisException e1) { AnalysisContext.logError("Coult not get Type dataflow", e1);
TypeDataflow typeDataflow = classContext.getTypeDataflow(method); ConstantPoolGen cpg = classContext.getConstantPoolGen();
private void analyzeMethod(ClassContext classContext, Method method) throws CFGBuilderException, DataflowAnalysisException TypeDataflow typeDataflow = classContext.getTypeDataflow(method); ConstantPoolGen cpg = classContext.getConstantPoolGen();
TypeDataflow typeDataflow = classContext.getTypeDataflow(method); ValueNumberDataflow vnDataflow = classContext.getValueNumberDataflow(method);
private void checkMonitorWait() { try { TypeDataflow typeDataflow = getClassContext().getTypeDataflow(getMethod()); TypeDataflow.LocationAndFactPair pair = typeDataflow.getLocationAndFactForInstruction(getPC()); if (pair == null) { return; } Type receiver = pair.frame.getInstance(pair.location.getHandle().getInstruction(), getClassContext() .getConstantPoolGen()); if (!(receiver instanceof ReferenceType)) { return; } if (Hierarchy.isSubtype((ReferenceType) receiver, CONDITION_TYPE)) { accumulator.accumulateBug( new BugInstance(this, "DM_MONITOR_WAIT_ON_CONDITION", HIGH_PRIORITY).addClassAndMethod(this), this); } } catch (ClassNotFoundException e) { bugReporter.reportMissingClass(e); } catch (DataflowAnalysisException e) { bugReporter.logError("Exception caught by DumbMethods", e); } catch (CFGBuilderException e) { bugReporter.logError("Exception caught by DumbMethods", e); } }
TypeDataflow typeDataflow = classContext.getTypeDataflow(method); TypeFrame typeFrame = typeDataflow.getFactAtLocation(location); if (!typeFrame.isValid()) {
CFG cfg = classContext.getCFG(method); ValueNumberDataflow vnaDataflow = classContext.getValueNumberDataflow(method); TypeDataflow typeDataflow = classContext.getTypeDataflow(method);
TypeDataflow typeDataflow = classContext.getTypeDataflow(method); INullnessAnnotationDatabase db = AnalysisContext.currentAnalysisContext().getNullnessAnnotationDatabase();