本文整理汇总了Java中edu.umd.cs.findbugs.classfile.IAnalysisCache.getMethodAnalysis方法的典型用法代码示例。如果您正苦于以下问题:Java IAnalysisCache.getMethodAnalysis方法的具体用法?Java IAnalysisCache.getMethodAnalysis怎么用?Java IAnalysisCache.getMethodAnalysis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.findbugs.classfile.IAnalysisCache
的用法示例。
在下文中一共展示了IAnalysisCache.getMethodAnalysis方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDataflow
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
@Override
protected BackwardTypeQualifierDataflow getDataflow(DepthFirstSearch dfs, XMethod xmethod, CFG cfg,
ValueNumberDataflow vnaDataflow, ConstantPoolGen cpg, IAnalysisCache analysisCache,
MethodDescriptor methodDescriptor, TypeQualifierValue typeQualifierValue) throws CheckedAnalysisException {
ReverseDepthFirstSearch rdfs = analysisCache.getMethodAnalysis(ReverseDepthFirstSearch.class, methodDescriptor);
BackwardTypeQualifierDataflowAnalysis analysis = new BackwardTypeQualifierDataflowAnalysis(dfs, rdfs, xmethod, cfg,
vnaDataflow, cpg, typeQualifierValue);
// Get the corresponding forward dataflow.
// We use it to halt tracking of backwards values once we know
// that they encounter a conflicting forward value.
ForwardTypeQualifierDataflowFactory forwardFactory = analysisCache.getMethodAnalysis(
ForwardTypeQualifierDataflowFactory.class, methodDescriptor);
ForwardTypeQualifierDataflow forwardDataflow = forwardFactory.getDataflow(typeQualifierValue);
analysis.setForwardTypeQualifierDataflow(forwardDataflow);
analysis.registerSourceSinkLocations();
BackwardTypeQualifierDataflow dataflow = new BackwardTypeQualifierDataflow(cfg, analysis);
dataflow.execute();
if (ClassContext.DUMP_DATAFLOW_ANALYSIS) {
dataflow.dumpDataflow(analysis);
}
return dataflow;
}
示例2: getJumpInfoFromStackMap
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
private JumpInfoFromStackMap getJumpInfoFromStackMap() {
IAnalysisCache analysisCache = Global.getAnalysisCache();
XMethod xMethod = XFactory.createXMethod(v.getThisClass(), v.getMethod());
if (xMethod instanceof MethodInfo) {
MethodInfo mi = (MethodInfo) xMethod;
if (!mi.hasBackBranch())
return null;
}
try {
return analysisCache.getMethodAnalysis(JumpInfoFromStackMap.class, xMethod.getMethodDescriptor());
} catch (CheckedAnalysisException e) {
AnalysisContext.logError("Error getting jump information from StackMap", e);
return null;
}
}
示例3: analyze
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
@Override
public TaintDataflow analyze(IAnalysisCache cache, MethodDescriptor descriptor)
throws CheckedAnalysisException {
if(FindSecBugsGlobalConfig.getInstance().isDebugPrintInstructionVisited() || FindSecBugsGlobalConfig.getInstance().isDebugPrintInvocationVisited()) {
System.out.println("==[ Method: "+descriptor.getName()+" ]==");
}
CFG cfg = cache.getMethodAnalysis(CFG.class, descriptor);
DepthFirstSearch dfs = cache.getMethodAnalysis(DepthFirstSearch.class, descriptor);
MethodGen methodGen = cache.getMethodAnalysis(MethodGen.class, descriptor);
TaintAnalysis analysis = new TaintAnalysis(methodGen, dfs, descriptor, taintConfig);
TaintDataflow flow = new TaintDataflow(cfg, analysis);
flow.execute();
analysis.finishAnalysis();
if (CONFIG.isDebugOutputTaintConfigs() && writer != null) {
TaintMethodConfig derivedConfig = taintConfig.get(getSlashedMethodName(methodGen));
if (derivedConfig != null) {
try {
writer.append(getSlashedMethodName(methodGen) + ":" + derivedConfig + "\n");
writer.flush();
} catch (IOException ex) {
AnalysisContext.logError("Cannot write derived configs", ex);
}
}
}
return flow;
}
示例4: addSourceLine
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
/**
* Add source line annotation for given Location in a method.
*
* @param methodDescriptor
* the method
* @param location
* the Location in the method
* @return this BugInstance
*/
@Nonnull
public BugInstance addSourceLine(MethodDescriptor methodDescriptor, Location location) {
try {
IAnalysisCache analysisCache = Global.getAnalysisCache();
ClassContext classContext = analysisCache.getClassAnalysis(ClassContext.class, methodDescriptor.getClassDescriptor());
Method method = analysisCache.getMethodAnalysis(Method.class, methodDescriptor);
return addSourceLine(classContext, method, location);
} catch (CheckedAnalysisException e) {
return addSourceLine(SourceLineAnnotation.createReallyUnknown(methodDescriptor.getClassDescriptor()
.toDottedClassName()));
}
}
示例5: fromVisitedInstruction
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
public static SourceLineAnnotation fromVisitedInstruction(MethodDescriptor methodDescriptor, int position) {
try {
IAnalysisCache analysisCache = Global.getAnalysisCache();
JavaClass jclass = analysisCache.getClassAnalysis(JavaClass.class, methodDescriptor.getClassDescriptor());
Method method = analysisCache.getMethodAnalysis(Method.class, methodDescriptor);
return fromVisitedInstruction(jclass, method, position);
} catch (CheckedAnalysisException e) {
return createReallyUnknown(methodDescriptor.getClassDescriptor().toDottedClassName());
}
}
示例6: analyze
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
public CompactLocationNumbering analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor)
throws CheckedAnalysisException {
Method method = analysisCache.getMethodAnalysis(Method.class, descriptor);
if (method.getCode() == null) {
return null;
}
CFG cfg = getCFG(analysisCache, descriptor);
return new CompactLocationNumbering(cfg);
}
示例7: analyze
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
public ObligationDataflow analyze(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor)
throws CheckedAnalysisException {
CFG cfg = analysisCache.getMethodAnalysis(CFG.class, methodDescriptor);
DepthFirstSearch dfs = analysisCache.getMethodAnalysis(DepthFirstSearch.class, methodDescriptor);
XMethod xmethod = XFactory.createXMethod(methodDescriptor);
ConstantPoolGen cpg = analysisCache.getClassAnalysis(ConstantPoolGen.class, methodDescriptor.getClassDescriptor());
ObligationPolicyDatabase database = analysisCache.getDatabase(ObligationPolicyDatabase.class);
TypeDataflow typeDataflow = analysisCache.getMethodAnalysis(TypeDataflow.class, methodDescriptor);
IsNullValueDataflow invDataflow = analysisCache.getMethodAnalysis(IsNullValueDataflow.class, methodDescriptor);
ObligationFactory factory = database.getFactory();
ObligationAnalysis analysis = new ObligationAnalysis(dfs, xmethod, cpg, factory, database, typeDataflow, invDataflow,
analysisCache.getErrorLogger());
ObligationDataflow dataflow = new ObligationDataflow(cfg, analysis);
Profiler profiler = analysisCache.getProfiler();
profiler.start(analysis.getClass());
try {
dataflow.execute();
} finally {
profiler.end(analysis.getClass());
}
if (DEBUG_PRINTCFG) {
System.out.println("Dataflow CFG:");
DataflowCFGPrinter.printCFG(dataflow, System.out);
}
return dataflow;
}
示例8: getJumpInfo
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
private JumpInfo getJumpInfo() {
IAnalysisCache analysisCache = Global.getAnalysisCache();
XMethod xMethod = XFactory.createXMethod(v.getThisClass(), v.getMethod());
if (xMethod instanceof MethodInfo) {
MethodInfo mi = (MethodInfo) xMethod;
if (!mi.hasBackBranch())
return null;
}
try {
return analysisCache.getMethodAnalysis(JumpInfo.class, xMethod.getMethodDescriptor());
} catch (CheckedAnalysisException e) {
AnalysisContext.logError("Error getting jump information", e);
return null;
}
}
示例9: getMethodGen
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
protected MethodGen getMethodGen(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor)
throws CheckedAnalysisException {
return analysisCache.getMethodAnalysis(MethodGen.class, methodDescriptor);
}
示例10: visitClass
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void visitClass(ClassDescriptor classDescriptor) throws CheckedAnalysisException {
if (dataflowClassName == null) {
return;
}
if (!initialized) {
initialize();
}
if (dataflowClass == null) {
return;
}
IAnalysisCache analysisCache = Global.getAnalysisCache();
XClass classInfo = analysisCache.getClassAnalysis(XClass.class, classDescriptor);
// Test dataflow analysis on each method]
for (XMethod xMethod : classInfo.getXMethods()) {
if (methodName != null && !methodName.equals(xMethod.getName())) {
continue;
}
MethodDescriptor methodDescriptor = xMethod.getMethodDescriptor();
System.out.println("-----------------------------------------------------------------");
System.out.println("Method: " + SignatureConverter.convertMethodSignature(methodDescriptor));
System.out.println("-----------------------------------------------------------------");
// Create and execute the dataflow analysis
Dataflow<Fact,AnalysisType> dataflow = analysisCache.getMethodAnalysis(dataflowClass, methodDescriptor);
System.out.println("Dataflow finished after " + dataflow.getNumIterations());
if (SystemProperties.getBoolean("dataflow.printcfg")) {
DataflowCFGPrinter<Fact,AnalysisType> cfgPrinter
= new DataflowCFGPrinter<Fact,AnalysisType>(dataflow);
cfgPrinter.print(System.out);
}
}
}
示例11: getReverseDepthFirstSearch
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
protected ReverseDepthFirstSearch getReverseDepthFirstSearch(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor)
throws CheckedAnalysisException {
return analysisCache.getMethodAnalysis(ReverseDepthFirstSearch.class, methodDescriptor);
}
示例12: getTypeDataflow
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
protected TypeDataflow getTypeDataflow(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor)
throws CheckedAnalysisException {
return analysisCache.getMethodAnalysis(TypeDataflow.class, methodDescriptor);
}
示例13: getDepthFirstSearch
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
protected DepthFirstSearch getDepthFirstSearch(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor)
throws CheckedAnalysisException {
return analysisCache.getMethodAnalysis(DepthFirstSearch.class, methodDescriptor);
}
示例14: getCompactLocationNumbering
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
protected CompactLocationNumbering getCompactLocationNumbering(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor)
throws CheckedAnalysisException {
return analysisCache.getMethodAnalysis(CompactLocationNumbering.class, methodDescriptor);
}
示例15: getValueNumberDataflow
import edu.umd.cs.findbugs.classfile.IAnalysisCache; //导入方法依赖的package包/类
protected ValueNumberDataflow getValueNumberDataflow(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor)
throws CheckedAnalysisException {
return analysisCache.getMethodAnalysis(ValueNumberDataflow.class, methodDescriptor);
}