@Override public String toString() { return SignatureConverter.convertMethodSignature(javaClass, method); } }
/** * Constructor from method and instruction. * * @param message * reason for the error * @param methodGen * the method * @param ins * the instruction */ public AnalysisException(String message, MethodGen methodGen, Instruction ins) { super(message + " in " + SignatureConverter.convertMethodSignature(methodGen) + " at " + ins); }
@Override public String toString() { return SignatureConverter.convertMethodSignature(this); }
/** * Constructor from method and instruction. * * @param message * reason for the error * @param methodGen * the method * @param handle * the instruction */ public InvalidBytecodeException(String message, MethodGen methodGen, InstructionHandle handle) { super(message + " in " + SignatureConverter.convertMethodSignature(methodGen) + " at " + handle); }
/** * Constructor from method and instruction. * * @param message * reason for the error * @param methodGen * the method * @param handle * the instruction */ public DataflowAnalysisException(String message, MethodGen methodGen, InstructionHandle handle) { super(message + " in " + SignatureConverter.convertMethodSignature(methodGen) + " at " + handle); }
/** * Convenience method for generating a method signature in human readable * form. * * @param className * name of the class containing the method * @param methodName * the name of the method * @param methodSig * the signature of the method */ public static String convertMethodSignature(String className, String methodName, String methodSig) { return convertMethodSignature(className, methodName, methodSig, ""); }
/** * Constructor from MethodGen and another Throwable object. This is useful * for chaining exceptions. * * @param message * reason for the error * @param methodGen * the method * @param throwable * cause of the error */ public AnalysisException(String message, MethodGen methodGen, Throwable throwable) { super(message + " in " + SignatureConverter.convertMethodSignature(methodGen), throwable); }
/** * Constructor from method and instruction. * * @param message * reason for the error * @param methodGen * the method * @param handle * the instruction */ public AnalysisException(String message, MethodGen methodGen, InstructionHandle handle) { super(message + " in " + SignatureConverter.convertMethodSignature(methodGen) + " at " + handle); }
/** * Constructor from method, instruction, and causing Throwable object. * * @param message * reason for the error * @param methodGen * the method * @param handle * the instruction * @param throwable * the cause of the error */ public AnalysisException(String message, MethodGen methodGen, InstructionHandle handle, Throwable throwable) { super(message + " in " + SignatureConverter.convertMethodSignature(methodGen) + " at " + handle, throwable); }
/** * Constructor from method and instruction. * * @param message * reason for the error * @param methodGen * the method * @param handle * the instruction * @param cause * another exception that is the cause of this exception */ public InvalidBytecodeException(String message, MethodGen methodGen, InstructionHandle handle, Throwable cause) { super(message + " in " + SignatureConverter.convertMethodSignature(methodGen) + " at " + handle, cause); } }
/** * Constructor from method, instruction, and causing Throwable object. * * @param message * reason for the error * @param methodGen * the method * @param ins * the instruction * @param throwable * the cause of the error */ public AnalysisException(String message, MethodGen methodGen, Instruction ins, Throwable throwable) { super(message + " in " + SignatureConverter.convertMethodSignature(methodGen) + " at " + ins, throwable); } }
private String getFullyQualifiedMethodName() { String methodName; MethodGen methodGen = cfg.getMethodGen(); if (methodGen == null) { methodName = cfg.getMethodName(); } else { methodName = SignatureConverter.convertMethodSignature(methodGen); } return methodName; }
/** * 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()); }
/** * Convenience method for generating a method signature in human readable * form. * * @param javaClass * the class * @param method * the method */ public static String convertMethodSignature(JavaClass javaClass, Method method) { return convertMethodSignature(javaClass.getClassName(), method.getName(), method.getSignature()); }
/** * Convenience method for generating a method signature in human readable * form. * * @param inv * an InvokeInstruction * @param cpg * the ConstantPoolGen for the class the instruction belongs to */ public static String convertMethodSignature(InvokeInstruction inv, ConstantPoolGen cpg) { return convertMethodSignature(inv.getClassName(cpg), inv.getName(cpg), inv.getSignature(cpg)); }
/** * Convenience method for generating a method signature in human readable * form. * * @param xmethod * an XMethod * @return the formatted version of that signature */ public static String convertMethodSignature(XMethod xmethod) { @DottedClassName String className = xmethod.getClassName(); assert className.indexOf('/') == -1; return convertMethodSignature(className, xmethod.getName(), xmethod.getSignature()); }
/** * Add an edge to the subroutine's CFG. * * @param sourceBlock * the source basic block * @param destBlock * the destination basic block * @param edgeType * the type of edge */ public void addEdge(BasicBlock sourceBlock, BasicBlock destBlock, @Edge.Type int edgeType) { if (VERIFY_INTEGRITY) { if (destBlock.isExceptionHandler() && edgeType != HANDLED_EXCEPTION_EDGE) { throw new IllegalStateException("In method " + SignatureConverter.convertMethodSignature(methodGen) + ": exception handler " + destBlock.getFirstInstruction() + " reachable by non exception edge type " + edgeType); } } cfgSub.createEdge(sourceBlock, destBlock, edgeType); }
/** * Convenience method for generating a method signature in human readable * form. * * @param methodDescriptor * a MethodDescriptor * @return the formatted version of that signature */ public static String convertMethodSignature(MethodDescriptor methodDescriptor) { return convertMethodSignature(methodDescriptor.getClassDescriptor().toDottedClassName(), methodDescriptor.getName(), methodDescriptor.getSignature()); }
/** * See if the currently-visited method declares a * * @NonNull annotation, or overrides a method which declares a * @NonNull annotation. */ private NullnessAnnotation getMethodNullnessAnnotation() { if (method.getSignature().indexOf(")L") >= 0 || method.getSignature().indexOf(")[") >= 0) { if (DEBUG_NULLRETURN) { System.out.println("Checking return annotation for " + SignatureConverter.convertMethodSignature(classContext.getJavaClass(), method)); } XMethod m = XFactory.createXMethod(classContext.getJavaClass(), method); return AnalysisContext.currentAnalysisContext().getNullnessAnnotationDatabase().getResolvedAnnotation(m, false); } return NullnessAnnotation.UNKNOWN_NULLNESS; }
@Override public void visitClassContext(ClassContext classContext) { Method[] methodList = classContext.getJavaClass().getMethods(); for (Method method : methodList) { if (method.getCode() == null) { continue; } // System.out.println("--> " + method.getName()); if (METHOD != null && !method.getName().equals(METHOD)) { continue; } try { System.out.println("Analyzing " + SignatureConverter.convertMethodSignature(classContext.getJavaClass(), method)); analyzeMethod(classContext, method); } catch (CFGBuilderException e) { bugReporter.logError("Error", e); } catch (DataflowAnalysisException e) { bugReporter.logError("Error", e); } catch (ClassNotFoundException e) { bugReporter.reportMissingClass(e); } } }