LOG(DEBUG, "DEBUG", "Skipping method with primitive return type: " + method.getSignature()); return NullnessHint.UNKNOWN; LOG(DEBUG, "DEBUG", "@ Return type analysis for: " + method.getSignature()); SSAReturnInstruction retInstr = (SSAReturnInstruction) instr; if (ir.getSymbolTable().isNullConstant(retInstr.getResult())) { LOG(DEBUG, "DEBUG", "Nullable return in method: " + method.getSignature()); return NullnessHint.NULLABLE;
LOG(DEBUG, "DEBUG", "@ " + method.getSignature()); Set<Integer> derefedParamList = new HashSet<Integer>(); prunedCFG = ExceptionPrunedCFG.make(cfg);
private static boolean hasSignature(final IMethod im, final String signature) { return signature.equals(im.getSignature()); }
public Export(LibApiStats stats) { this.libName = stats.libName; this.versions = stats.versions.stream().map(Version::toString).collect(Collectors.toList()); this.apiDiffs = stats.version2Diff.values().stream().map(LibApiComparator.ApiDiff::export).collect(Collectors.toList()); if (LibScoutConfig.libDependencyAnalysis) this.libDeps = stats.version2Deps.values().stream().map(DependencyAnalysis.LibDependencies::export).collect(Collectors.toList()); this.api2Versions = new HashMap<>(); for (IMethod m: stats.api2Versions.keySet()) { this.api2Versions.put(m.getSignature(), stats.api2Versions.get(m).stream().map(Version::toString).collect(Collectors.toList())); } } }
@Override public String toString() { StringBuilder str = new StringBuilder("["); for (int i = 0; i < sites.length; i++) { str.append(' ').append(methods[i].getSignature()).append('@').append(sites[i].getProgramCounter()); } str.append(" ]"); return str.toString(); }
@Override public String toString() { return "BB(Handler)[SSA]" + getNumber() + " - " + method.getSignature(); }
@Override public String toString() { StringBuilder str = new StringBuilder("["); for (int i = 0; i < sites.length; i++) { str.append(' ').append(methods[i].getSignature()).append('@').append(sites[i].getProgramCounter()); } str.append(" ]"); return str.toString(); }
@Override public String toString() { return "BB(Handler)[SSA]" + getNumber() + " - " + method.getSignature(); }
protected static boolean equals(IMethod m1, IMethod m2) { return m1.getSignature().equals(m2.getSignature()) && JvmMethodAccessFlags.getMethodAccessCode(m1) == JvmMethodAccessFlags.getMethodAccessCode(m2); }
public static CGNode getCGNode(IMethod method, CallGraph cg) { logger.debug("Retrieve CGNode for " + method.getSignature()); MethodReference ref = method.getReference(); if (ref == null) return null; Set<CGNode> cgnode = cg.getNodes(ref); if (cgnode.isEmpty()) { logger.warn("Number of CGNode(s) for " + method.getSignature() + " is " + cgnode.size()); return null; } /*else if (cgnode.size() > 1) { logger.warn("Number of CGNode(s) for " + methodSignature + " is " + cgnode.size() + " refMethod.sig: " + refMethod.getSignature()); }*/ return cgnode.iterator().next(); }
public Export(LibDependencies deps) { this.version = deps.version.toString(); for (IMethod m: deps.api2Dependencies.keySet()) this.api2Dependencies.put(m.getSignature(), deps.api2Dependencies.get(m).stream().map(c -> c.getDeclaredTarget().getSignature()).collect(Collectors.toSet())); } }
public Export(ApiDiff diff, boolean verbose) { version = diff.v.toString(); apiCount = diff.apiCount; apiAdditionsCount = diff.added.size(); apiDeletionsCount = diff.removed.size(); actualSemver = diff.actualSemver == null? "" : diff.actualSemver.name(); expectedSemver = diff.expectedSemver == null? "" : diff.expectedSemver.name(); for (IMethod m: diff.alternatives.keySet()) { Set<String> apis = diff.alternatives.get(m).stream().map(IMethod::getSignature).collect(Collectors.toSet()); alternatives.put(m.getSignature(), apis); } if (verbose) { apiAdditions = diff.added.stream().map(IMethod::getSignature).sorted().collect(Collectors.toSet()); apiDeletions = diff.removed.stream().map(IMethod::getSignature).sorted().collect(Collectors.toSet()); } }
/** * @see java.lang.Object#toString() */ @Override public String toString() { return "BB[Induced]" + getNumber() + " - " + getMethod().getSignature(); }
/** * @see java.lang.Object#toString() */ @Override public String toString() { return "BB[Induced]" + getNumber() + " - " + getMethod().getSignature(); }
public void print(boolean verbose) { boolean diff = false; boolean critical = false; if (expectedSemver != null) { diff = !expectedSemver.equals(actualSemver); critical = (expectedSemver.equals(VersionWrapper.SEMVER.PATCH) || expectedSemver.equals(VersionWrapper.SEMVER.MINOR)) && actualSemver.equals(VersionWrapper.SEMVER.MAJOR); } // version, #docAPI, apiCountDiff expSemver, actSemver, diff?, critical? logger.info(String.format("%10s %10d %-15s %8s %8s %10s %15s", v.toString(), apiCount, added.size() > 0 || removed.size() > 0? " (+" + added.size() + "/-" + removed.size() + ")" : "", expectedSemver != null? expectedSemver.toString() : "---", actualSemver != null? actualSemver.toString() : "---", diff? "[DIFF]" : "", critical? "[CRITICAL]" : "")); if (verbose) { final int LIMIT = 15; // print max number of methods removed.stream().map(IMethod::getSignature).sorted().limit(LIMIT).forEach(m -> logger.info(Utils.INDENT2 + "- removed: " + m)); for (IMethod m: alternatives.keySet()) { logger.info(Utils.INDENT2 + "Alternatives for " + m.getSignature()); alternatives.get(m).stream().map(IMethod::getSignature).sorted().forEach(s -> logger.info(Utils.indent(3) + "> alt: " + s)); } added.stream().map(IMethod::getSignature).sorted().limit(LIMIT).forEach(m -> logger.info(Utils.INDENT2 + "+ added: " + m)); } }
@Override public MethodNode comp(IMethod m, TreeConfig config) { String desc = normalizeAnonymousInnerClassConstructor(m); if (desc == null) desc = getFuzzyDescriptor(m); String signature = config.keepMethodSignatures? m.getSignature() : ""; return new MethodNode(config.getHasher().putBytes(desc.getBytes()).hash().asBytes(), signature); }
@Override public String toString() { return "BB[SSA:" + getFirstInstructionIndex() + ".." + getLastInstructionIndex() + ']' + getNumber() + " - " + method.getSignature(); }
@Override public String toString() { return "BB[SSA:" + getFirstInstructionIndex() + ".." + getLastInstructionIndex() + ']' + getNumber() + " - " + method.getSignature(); }
/** * custom comparison for BasicBlockInContext. The WALA .equals() * implementation eventually delegates to pointer equality, which is too * specific for our needs. */ @SuppressWarnings("unused") private boolean compareBlocks(BasicBlockInContext<E> a, BasicBlockInContext<E> b) { if (null == a || null == b) { return false; } // delegate to the defined implementation, but only if it's true. if (a.equals(b)) { return true; } if (a.getNumber() != b.getNumber()) { return false; } if (!a.getMethod().getSignature().equals(b.getMethod().getSignature())) { return false; } return true; }
@Test public void testInnerClassSuper() throws IllegalArgumentException, CancelException, IOException { Pair<CallGraph, PointerAnalysis<? extends InstanceKey>> x = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), new ArrayList<IRAssertion>(), true, null); // can't do an IRAssertion() -- we need the pointer analysis CallGraph cg = x.fst; PointerAnalysis<? extends InstanceKey> pa = x.snd; Iterator<CGNode> iter = cg.iterator(); while ( iter.hasNext() ) { CGNode n = iter.next(); if ( n.getMethod().getSignature().equals("LInnerClassSuper$SuperOuter.test()V") ) { // find enclosing instruction for ( SSAInstruction instr: n.getIR().getInstructions() ) { if ( instr instanceof EnclosingObjectReference ) { StringBuilder allIksBuilder = new StringBuilder(); for (InstanceKey ik: pa.getPointsToSet(new LocalPointerKey(n,instr.getDef()))) allIksBuilder.append(ik.getConcreteType().getName()).append(','); final String allIks = allIksBuilder.toString(); Assert.assertTrue("assertion failed: expecting ik \"LSub,\" in method, got \"" + allIks + "\"\n", allIks.equals("LSub,")); break; } } } } }