@Override public void visitDUP(DUP obj) { try { Value value = frame.popValue(); frame.pushValue(value); frame.pushValue(value); } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException(e.toString()); } }
@Override public String blockAnnotate(BasicBlock bb) { boolean flip = isForwards() != dataflow.getAnalysis().isForwards(); Fact fact = flip ? dataflow.getStartFact(bb) : dataflow.getResultFact(bb); return " " + dataflow.getAnalysis().factToString(fact); }
/** * Get the Location representing the entry to the CFG. Note that this is a * "fake" Location, and shouldn't be relied on to yield source line * information. * * @return Location at entry to CFG */ public Location getLocationAtEntry() { InstructionHandle handle = getEntry().getFirstInstruction(); assert handle != null; return new Location(handle, getEntry()); }
private void addPropertiesForMethodContainingWarning(WarningPropertySet<WarningProperty> propertySet) { XMethod xMethod = XFactory.createXMethod(classContext.getJavaClass(), method); boolean uncallable = !AnalysisContext.currentXFactory().isCalledDirectlyOrIndirectly(xMethod) && xMethod.isPrivate(); if (uncallable) { propertySet.addProperty(GeneralWarningProperty.IN_UNCALLABLE_METHOD); } }
@Override public void initEntryFact(ResourceValueFrame result) { result.setValid(); result.clearStack(); final int numSlots = result.getNumSlots(); for (int i = 0; i < numSlots; ++i) { boolean slotContainsInstance = resourceTracker.isParamInstance(resource, i); result.setValue(i, slotContainsInstance ? ResourceValue.instance() : ResourceValue.notInstance()); } }
@Override public boolean isReturnTypeReferenceType() { SignatureParser parser = new SignatureParser(getSignature()); String returnTypeSig = parser.getReturnTypeSignature(); return SignatureParser.isReferenceType(returnTypeSig); }
@Override public int getNumParams() { // FIXME: cache this? return new SignatureParser(getSignature()).getNumParameters(); }
/** * Constructor. * * @param dataflow * the Dataflow object whose values should be used to annotate * the printed CFG */ public DataflowCFGPrinter(Dataflow<Fact, AnalysisType> dataflow) { super(dataflow.getCFG()); this.dataflow = dataflow; setIsForwards(dataflow.getAnalysis().isForwards()); }
@Override public void visitSyntheticParameterAnnotation(int p, boolean runtimeVisible) { if (database == null) { return; } XMethod xmethod = XFactory.createXMethod(this); XMethodParameter xparameter = new XMethodParameter(xmethod, p); database.addDirectAnnotation(xparameter, NullnessAnnotation.UNKNOWN_NULLNESS); }
private String getFullyQualifiedMethodName() { String methodName; MethodGen methodGen = cfg.getMethodGen(); if (methodGen == null) { methodName = cfg.getMethodName(); } else { methodName = SignatureConverter.convertMethodSignature(methodGen); } return methodName; }
private static Location getLocation(BasicBlock block) { InstructionHandle handle = block.getFirstInstruction(); if(handle == null) { handle = block.getExceptionThrower(); } return handle == null ? null : new Location(handle, block); }
@Override public String edgeAnnotate(Edge edge) { String edgeAnnotation = ""; try { edgeAnnotation = " " + dataflow.getAnalysis().factToString(dataflow.getAnalysis().getFactOnEdge(edge)); } catch (Throwable e) { // ignore } return edgeAnnotation; }
/** * Constructor. * * @param exception * the ClassNotFoundException that caused this exception */ public MissingClassException(ClassNotFoundException exception) { this(ClassNotFoundExceptionParser.getMissingClassName(exception)); initCause(exception); }
public void logAnError(String msg) { RepositoryLookupFailureCallback lookupFailureCallback = getLookupFailureCallback(); if (lookupFailureCallback != null) { lookupFailureCallback.logError(msg); } }
static @AnalysisFeature public int build(String name) { int num = next++; return asFeatureNum(num); }
@Override public boolean choose(XMethod method) { return accessFlagsAreConcrete(method.getAccessFlags()); } };
@Override public String blockStartAnnotate(BasicBlock bb) { boolean flip = isForwards() != dataflow.getAnalysis().isForwards(); Fact fact = flip ? dataflow.getResultFact(bb) : dataflow.getStartFact(bb); return " " + dataflow.getAnalysis().factToString(fact); }