public String getMethodSig() { return methodGen.getSignature(); }
private static String getFullMethodName(MethodGen methodGen) { String methodNameWithSignature = methodGen.getName() + methodGen.getSignature(); String slashedClassName = methodGen.getClassName().replace('.', '/'); return slashedClassName + "." + methodNameWithSignature; }
/** * Constructor. * * @param rdfs * the reverse depth-first-search (for the block order) * @param cfg * the CFG for the method * @param methodGen * the MethodGen for the method * @param vnaDataflow * @param assertionMethods * AssertionMethods for the analyzed class */ public UnconditionalValueDerefAnalysis(ReverseDepthFirstSearch rdfs, DepthFirstSearch dfs, CFG cfg, Method method, MethodGen methodGen, ValueNumberDataflow vnaDataflow, AssertionMethods assertionMethods) { super(rdfs, dfs); this.cfg = cfg; this.methodGen = methodGen; this.method = method; this.vnaDataflow = vnaDataflow; this.assertionMethods = assertionMethods; if (DEBUG) { System.out.println("UnconditionalValueDerefAnalysis analysis " + methodGen.getClassName() + "." + methodGen.getName() + " : " + methodGen.getSignature()); } }
/** * Convenience method for generating a method signature in human readable * form. * * @param methodGen * the method to produce a method signature for */ public static String convertMethodSignature(MethodGen methodGen) { return convertMethodSignature(methodGen.getClassName(), methodGen.getName(), methodGen.getSignature()); }
public static XMethod createXMethod(MethodGen methodGen) { String className = methodGen.getClassName(); String methodName = methodGen.getName(); String methodSig = methodGen.getSignature(); int accessFlags = methodGen.getAccessFlags(); return createXMethod(className, methodName, methodSig, accessFlags); }
/** * Look up the Method represented by given MethodGen. * * @param methodGen * a MethodGen * @return the Method represented by the MethodGen */ public Method getMethod(MethodGen methodGen) { Method[] methodList = jclass.getMethods(); for (Method method : methodList) { if (method.getName().equals(methodGen.getName()) && method.getSignature().equals(methodGen.getSignature()) && method.getAccessFlags() == methodGen.getAccessFlags()) { return method; } } return null; }
/** * Constructor. * * @param method * TODO * @param methodGen * the MethodGen whose CFG we'll be analyzing * @param cfg * the control flow graph * @param dfs * DepthFirstSearch of the method * @param typeMerger * object to merge types * @param lookupFailureCallback * lookup failure callback * @param exceptionSetFactory * factory for creating ExceptionSet objects */ public TypeAnalysis(Method method, MethodGen methodGen, CFG cfg, DepthFirstSearch dfs, TypeMerger typeMerger, RepositoryLookupFailureCallback lookupFailureCallback, ExceptionSetFactory exceptionSetFactory) { this(method, methodGen, cfg, dfs, typeMerger, new TypeFrameModelingVisitor(methodGen.getConstantPool(), typeMerger), lookupFailureCallback, exceptionSetFactory); if (TypeFrameModelingVisitor.DEBUG) { System.out.println(methodGen.getClassName() + "." + methodGen.getName() + " " + methodGen.getSignature()); } }
public ValueNumberAnalysis(MethodGen methodGen, DepthFirstSearch dfs, LoadedFieldSet loadedFieldSet, RepositoryLookupFailureCallback lookupFailureCallback) { super(dfs); this.methodGen = methodGen; this.factory = new ValueNumberFactory(); ValueNumberCache cache = new ValueNumberCache(); this.visitor = new ValueNumberFrameModelingVisitor(methodGen, factory, cache, loadedFieldSet, lookupFailureCallback); int numLocals = methodGen.getMaxLocals(); this.entryLocalValueList = new ValueNumber[numLocals]; for (int i = 0; i < numLocals; ++i) { this.entryLocalValueList[i] = factory.createFreshValue(); } this.exceptionHandlerValueNumberMap = new IdentityHashMap<>(); // For non-static methods, keep track of which value represents the // "this" reference if (!methodGen.isStatic()) { this.thisValue = entryLocalValueList[0]; } this.factAtLocationMap = new HashMap<>(); this.factAfterLocationMap = new HashMap<>(); if (DEBUG) { System.out.println("VNA Analysis " + methodGen.getClassName() + "." + methodGen.getName() + " : " + methodGen.getSignature()); } }
public IsNullValueAnalysis(MethodDescriptor descriptor, MethodGen methodGen, CFG cfg, ValueNumberDataflow vnaDataflow, TypeDataflow typeDataflow, DepthFirstSearch dfs, AssertionMethods assertionMethods) { super(dfs); this.trackValueNumbers = AnalysisContext.currentAnalysisContext().getBoolProperty( AnalysisFeatures.TRACK_VALUE_NUMBERS_IN_NULL_POINTER_ANALYSIS); this.methodGen = methodGen; this.visitor = new IsNullValueFrameModelingVisitor(methodGen.getConstantPool(), assertionMethods, vnaDataflow, typeDataflow, trackValueNumbers); this.vnaDataflow = vnaDataflow; this.cfg = cfg; this.locationWhereValueBecomesNullSet = new HashSet<>(); this.pointerEqualityCheck = getForPointerEqualityCheck(cfg, vnaDataflow); if (DEBUG) { System.out.println("IsNullValueAnalysis for " + methodGen.getClassName() + "." + methodGen.getName() + " : " + methodGen.getSignature()); } }
/** * Get the value number assigned to the given parameter upon entry to the * method. * * @param param * a parameter (0 == first parameter) * @return the ValueNumber assigned to that parameter */ public ValueNumber getEntryValueForParameter(int param) { SignatureParser sigParser = new SignatureParser(methodGen.getSignature()); int p = 0; int slotOffset = methodGen.isStatic() ? 0 : 1; for ( String paramSig : sigParser.parameterSignatures()) { if (p == param) { return getEntryValue(slotOffset); } p++; slotOffset += SignatureParser.getNumSlotsForType(paramSig); } throw new IllegalStateException(); }
/** * Add a method annotation. If this is the first method annotation added, it * becomes the primary method annotation. If the method has source line * information, then a SourceLineAnnotation is added to the method. * * @param methodGen * the MethodGen object for the method * @param sourceFile * source file method is defined in * @return this object */ @Nonnull public BugInstance addMethod(MethodGen methodGen, String sourceFile) { String className = methodGen.getClassName(); MethodAnnotation methodAnnotation = new MethodAnnotation(className, methodGen.getName(), methodGen.getSignature(), methodGen.isStatic()); addMethod(methodAnnotation); addSourceLinesForMethod(methodAnnotation, SourceLineAnnotation.fromVisitedMethod(methodGen, sourceFile)); return this; }
System.out.println("Method: " + methodGen.getName() + " - " + methodGen.getSignature() + "in class " + methodGen.getClassName());
+ methodGen.getSignature(), e);
+ this.methodName + " : " + this.methodGen.getSignature());
+ methodGen.getSignature());
System.out.println(this.getClass().getName() + " iteration: " + numIterations + ", timestamp: " + timestamp); MethodGen mg = cfg.getMethodGen(); System.out.println(mg.getClassName() + "." + mg.getName() + mg.getSignature()); System.out.println("----------------------------------------------------------------------"); System.out.println(this.getClass().getName() + " iteration: " + numIterations + ", timestamp: " + timestamp); MethodGen mg = cfg.getMethodGen(); System.out.println(mg.getClassName() + "." + mg.getName() + mg.getSignature()); new RuntimeException("Quiescence achieved----------------------------------------------------------------") .printStackTrace(System.out);
String methodId = methodGen.getClassName() + "." + methodGen.getName() + ":" + methodGen.getSignature(); System.out.println("CC: getting refined CFG for " + methodId); String methodId = methodGen.getClassName() + "." + methodGen.getName() + ":" + methodGen.getSignature(); System.out.println("ClassContext: request to prune " + methodId);
Type[] parameterTypeList = Type.getArgumentTypes(methodGen.getSignature()); Location firstLocation = new Location(cfg.getEntry().getFirstInstruction(), cfg.getEntry());
XMethod xm = XFactory.createXMethod(methodGen.getClassName(), methodGen.getName(), methodGen.getSignature(), methodGen.isStatic()); INullnessAnnotationDatabase db = AnalysisContext.currentAnalysisContext().getNullnessAnnotationDatabase();
private static String getFullMethodName(MethodGen methodGen) { String methodNameWithSignature = methodGen.getName() + methodGen.getSignature(); String slashedClassName = methodGen.getClassName().replace('.', '/'); return slashedClassName + "." + methodNameWithSignature; }