protected LoadedFieldSet getLoadedFieldSet(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor) throws CheckedAnalysisException { return analysisCache.getMethodAnalysis(LoadedFieldSet.class, methodDescriptor); } }
protected MethodGen getMethodGen(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor) throws CheckedAnalysisException { return analysisCache.getMethodAnalysis(MethodGen.class, methodDescriptor); }
protected ValueNumberDataflow getValueNumberDataflow(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor) throws CheckedAnalysisException { return analysisCache.getMethodAnalysis(ValueNumberDataflow.class, methodDescriptor); }
protected DepthFirstSearch getDepthFirstSearch(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor) throws CheckedAnalysisException { return analysisCache.getMethodAnalysis(DepthFirstSearch.class, methodDescriptor); }
protected CompactLocationNumbering getCompactLocationNumbering(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor) throws CheckedAnalysisException { return analysisCache.getMethodAnalysis(CompactLocationNumbering.class, methodDescriptor); }
protected ReverseDepthFirstSearch getReverseDepthFirstSearch(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor) throws CheckedAnalysisException { return analysisCache.getMethodAnalysis(ReverseDepthFirstSearch.class, methodDescriptor); }
protected ExceptionSetFactory getExceptionSetFactory(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor) throws CheckedAnalysisException { return analysisCache.getMethodAnalysis(ExceptionSetFactory.class, methodDescriptor); }
protected TypeDataflow getTypeDataflow(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor) throws CheckedAnalysisException { return analysisCache.getMethodAnalysis(TypeDataflow.class, methodDescriptor); }
protected IsNullValueDataflow getIsNullValueDataflow(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor) throws CheckedAnalysisException { return analysisCache.getMethodAnalysis(IsNullValueDataflow.class, methodDescriptor); }
protected Method getMethod(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor) throws CheckedAnalysisException { return analysisCache.getMethodAnalysis(Method.class, methodDescriptor); }
protected CFG getCFG(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor) throws CheckedAnalysisException { return analysisCache.getMethodAnalysis(CFG.class, methodDescriptor); }
private <Analysis> Analysis getMethodAnalysis(Class<Analysis> analysisClass, Method method) throws DataflowAnalysisException, CFGBuilderException { try { MethodDescriptor methodDescriptor = BCELUtil.getMethodDescriptor(jclass, method); return Global.getAnalysisCache().getMethodAnalysis(analysisClass, methodDescriptor); } catch (DataflowAnalysisException e) { throw e; } catch (CFGBuilderException e) { throw e; } catch (CheckedAnalysisException e) { Throwable cause = e.getCause(); if (cause instanceof CFGBuilderException) { throw (CFGBuilderException) cause; } String message = "Should not happen: bad CAE: " + e.getClass().getName() + " for " + analysisClass.getName() + " of " + method; IllegalStateException ise = new IllegalStateException(message); ise.initCause(e); throw ise; } }
@Override 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); } }
private static TaintDataflow getTaintDataFlow(ClassContext classContext, Method method) throws CheckedAnalysisException { MethodDescriptor descriptor = BCELUtil.getMethodDescriptor(classContext.getJavaClass(), method); return Global.getAnalysisCache().getMethodAnalysis(TaintDataflow.class, descriptor); }
@Override public @CheckForNull JumpInfo analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor) throws CheckedAnalysisException { Method method = analysisCache.getMethodAnalysis(Method.class, descriptor); JavaClass jclass = getJavaClass(analysisCache, descriptor.getClassDescriptor()); Code code = method.getCode(); if (code == null) { return null; } JumpStackComputation branchAnalysis = new JumpStackComputation(descriptor); return computeJumpInfo(jclass, method, branchAnalysis); }
@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; }
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()); } }
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; } }
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; } } private JumpInfoFromStackMap getJumpInfoFromStackMap() {
@Override public MethodBytecodeSet analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor) throws CheckedAnalysisException { Method method = analysisCache.getMethodAnalysis(Method.class, descriptor); Code code = method.getCode(); if (code == null) { return null; } byte[] instructionList = code.getCode(); // Create callback UnpackedBytecodeCallback callback = new UnpackedBytecodeCallback(instructionList.length); // Scan the method. BytecodeScanner scanner = new BytecodeScanner(); scanner.scan(instructionList, callback); UnpackedCode unpackedCode = callback.getUnpackedCode(); MethodBytecodeSet result = null; if (unpackedCode != null) { result = unpackedCode.getBytecodeSet(); } return result; }