/** * <p> * Returns a <code>ThrowableSet</code> representing the set of exceptions included in <code>include</code> minus the set * of exceptions included in <code>exclude</code>. Creates a new <code>ThrowableSet</code> only if there was not already * one whose contents correspond to <code>include</code> - <code>exclude</code>. * </p> * * @param include * A set of {@link RefLikeType} objects representing exception types included in the result; may be * <code>null</code> if there are no included types. * * @param exclude * A set of {@link AnySubType} objects representing exception types excluded from the result; may be * <code>null</code> if there are no excluded types. * * @return a <code>ThrowableSet</code> representing the set of exceptions corresponding to <code>include</code> - * <code>exclude</code>. */ private ThrowableSet registerSetIfNew(Set<RefLikeType> include, Set<AnySubType> exclude) { if (INSTRUMENTING) { registrationCalls++; } ThrowableSet result = new ThrowableSet(include, exclude); ThrowableSet ref = registry.get(result); if (null != ref) { return ref; } registry.put(result, result); return result; }
"ThrowableSet.Add(ThrowableSet): attempt to add to [" + this.toString() + "] after removals recorded."); ThrowableSet result = getMemoizedAdds(s); if (result == null) { if (INSTRUMENTING) { Manager.v().addsExclusionWithoutSearch++; result = this.add(s.exceptionsIncluded); addToMemoizedAdds(s, result); } else if (INSTRUMENTING) { Manager.v().addsInclusionFromMemo++;
/** * Returns a <code>ThrowableSet</code> which contains all the exceptions from the current set except for those in the given * <code>ThrowableSet</code>. * * @param s * The set containing the exceptions to exclude from the new set * * @return The exceptions that are only in this set, but not in the given set * * @throws ThrowableSet.AlreadyHasExclusionsException * if this <code>ThrowableSet</code> or <code>s</code> is the result of a {@link #whichCatchableAs(RefType)} * operation, so that it is not possible to represent the addition of <code>s</code> to this * <code>ThrowableSet</code>. */ public ThrowableSet remove(ThrowableSet s) { if ((exceptionsExcluded.size() > 0) || (s.exceptionsExcluded.size() > 0)) { throw new AlreadyHasExclusionsException( "ThrowableSet.Add(ThrowableSet): attempt to add to [" + this.toString() + "] after removals recorded."); } // Remove the exceptions return this.remove(s.exceptionsIncluded); }
throw new AlreadyHasExclusionsException("ThrowableSet.Add(ThrowableSet): attempt to add to [" + this.toString() + "] after removals recorded."); ThrowableSet result = getMemoizedAdds(s); if (result == null) { if (INSTRUMENTING) { Manager.v().addsExclusionWithoutSearch++; result = this.add(s.exceptionsIncluded); memoizedAdds.put(s, result); } else if (INSTRUMENTING) {
ThrowableSet result = getMemoizedAdds(e); if (result != null) { if (INSTRUMENTING) { throw new AlreadyHasExclusionsException( "ThrowableSet.add(RefType): adding" + e.toString() + " to the set [ " + this.toString() + "] where " + exclusionBase.toString() + " is excluded.");
ThrowableSet result = getMemoizedAdds(e); if (result != null) { if (INSTRUMENTING) { boolean eHasNoHierarchy = hasNoHierarchy(e); if ((eHasNoHierarchy && exclusionBase.equals(e)) || (!eHasNoHierarchy && hierarchy.canStoreType(e, exclusionBase))) { throw new AlreadyHasExclusionsException("ThrowableSet.add(RefType): adding" + e.toString() + " to the set [ " + this.toString() + "] where " + exclusionBase.toString() + " is excluded."); addToMemoizedAdds(e, this); return this; resultSet.add(e); result = Manager.v().registerSetIfNew(resultSet, this.exceptionsExcluded); addToMemoizedAdds(e, result); return result;
Unit catcher = dest.getTrap().getHandlerUnit(); RefType trapsType = dest.getTrap().getException().getType(); if (predThrowables == null || predThrowables.catchableAs(trapsType)) { if (alwaysAddSelfEdges || (selfThrowables != null && selfThrowables.catchableAs(trapsType))) { addEdge(unitToSuccs, unitToPreds, thrower, catcher);
thrownSet = throwAnalysis.mightThrow(unit); ThrowableSet.Pair catchableAs = thrownSet.whichCatchableAs(catcher); if (catchableAs.getCaught() != ThrowableSet.Manager.v().EMPTY) { result = addDestToMap(result, unit, trap, catchableAs.getCaught()); throw new IllegalStateException("ExceptionalUnitGraph.buildExceptionDests(): catchableAs.caught == EMPTY, but catchableAs.uncaught != thrownSet" + System.getProperty("line.separator") + body.getMethod().getSubSignature() + " Unit: " + unit.toString() + System.getProperty("line.separator") + " catchableAs.getUncaught() == " + catchableAs.getUncaught().toString() + System.getProperty("line.separator") + " thrownSet == " + thrownSet.toString());
ThrowableSet.Pair catchableAs = thrownSet.whichCatchableAs(catcher); if (!catchableAs.getCaught().equals(ThrowableSet.Manager.v().EMPTY)) { result = addDestToMap(result, unit, trap, catchableAs.getCaught()); unitToUncaughtThrowables.put(unit, catchableAs.getUncaught()); } else { assert thrownSet.equals(catchableAs.getUncaught()) : "ExceptionalUnitGraph.buildExceptionDests(): " + "catchableAs.caught == EMPTY, but catchableAs.uncaught != thrownSet" + System.getProperty("line.separator") + body.getMethod().getSubSignature() + " Unit: " + unit.toString() + System.getProperty("line.separator") + " catchableAs.getUncaught() == " + catchableAs.getUncaught().toString() + System.getProperty("line.separator") + " thrownSet == " + thrownSet.toString();
if (trapsForUnit != null) { for (Trap t : trapsForUnit) { Pair p = curStmtSet.whichCatchableAs(t.getException().getType()); curStmtSet = curStmtSet.remove(p.getCaught()); methodSet = methodSet.add(curStmtSet);
/** * <p> * Produce an abbreviated representation of this <code>ThrowableSet</code>, suitable for human consumption. The * abbreviations include: * </p> * * <ul> * * <li>The strings “<code>java.lang.</code>” is stripped from the beginning of exception names.</li> * * <li>The string “<code>Exception</code>” is stripped from the ends of exception names.</li> * * <li>Instances of <code>AnySubType</code> are indicated by surrounding the base type name with parentheses, rather than * with the string “ <code>Any_subtype_of_</code>”</li> * * <li>If this <code>ThrowableSet</code> includes all the elements of {@link ThrowableSet.Manager#VM_ERRORS VM_ERRORS}, * they are abbreviated as “<code>vmErrors</code>” rather than listed individually.</li> * * @return An abbreviated representation of the contents of this set. */ public String toAbbreviatedString() { return toAbbreviatedString(exceptionsIncluded, '+') + toAbbreviatedString(exceptionsExcluded, '-'); }
public String toString() { StringBuffer buf = new StringBuffer(); buf.append(throwables.toString()); buf.append(" -> "); if (trap == null) { buf.append("(escapes)"); } else { buf.append(trap.toString()); } return buf.toString(); } }
/** * Returns a string representation of this <code>ThrowableSet</code>. */ @Override public String toString() { StringBuffer buffer = new StringBuffer(this.toBriefString()); buffer.append(":\n "); for (RefLikeType ei : exceptionsIncluded) { buffer.append('+'); buffer.append(ei == null ? "null" : ei.toString()); // buffer.append(i.next().toString()); } for (RefLikeType ee : exceptionsExcluded) { buffer.append('-'); buffer.append(ee.toString()); } return buffer.toString(); }
for (Iterator<? extends RefLikeType> it = sortedThrowableIterator(s); it.hasNext();) { RefLikeType reflikeType = it.next(); RefType baseType = null;
boolean catcherHasNoHierarchy = hasNoHierarchy(catcher); caughtExcluded = addExceptionToSet(exclusion, caughtExcluded); } else { uncaughtExcluded = addExceptionToSet(exclusion, uncaughtExcluded); caughtIncluded = addExceptionToSet(inclusion, caughtIncluded); } else { uncaughtIncluded = addExceptionToSet(inclusion, uncaughtIncluded); caughtIncluded = addExceptionToSet(inclusion, caughtIncluded); } else { uncaughtIncluded = addExceptionToSet(inclusion, uncaughtIncluded); caughtIncluded = addExceptionToSet(inclusion, caughtIncluded); } else { if (base.getClassName().equals("java.lang.Throwable")) { caughtIncluded = addExceptionToSet(catcher, caughtIncluded); uncaughtIncluded = addExceptionToSet(inclusion, uncaughtIncluded); caughtIncluded = addExceptionToSet(inclusion, caughtIncluded); } else if (h.canStoreType(catcher, base)) { uncaughtIncluded = addExceptionToSet(inclusion, uncaughtIncluded); uncaughtExcluded = addExceptionToSet(AnySubType.v(catcher), uncaughtExcluded); caughtIncluded = addExceptionToSet(AnySubType.v(catcher), caughtIncluded); uncaughtIncluded = addExceptionToSet(inclusion, uncaughtIncluded);
caughtExcluded = addExceptionToSet(exclusion, caughtExcluded); } else { uncaughtExcluded = addExceptionToSet(exclusion, uncaughtExcluded); if (inclusion instanceof RefType) { if (h.canStoreType(inclusion, catcher)) { caughtIncluded = addExceptionToSet(inclusion, caughtIncluded); } else { uncaughtIncluded = addExceptionToSet(inclusion, uncaughtIncluded); addExceptionToSet(inclusion, caughtIncluded); } else if (h.canStoreType(catcher, base)) { = addExceptionToSet(inclusion, uncaughtIncluded); uncaughtExcluded = addExceptionToSet(AnySubType.v(catcher), uncaughtExcluded); caughtIncluded = addExceptionToSet(AnySubType.v(catcher), caughtIncluded); = addExceptionToSet(inclusion, uncaughtIncluded);
throw new AlreadyHasExclusionsException("ThrowableSet.Add(ThrowableSet): attempt to add to [" + this.toString() + "] after removals recorded."); ThrowableSet result = getMemoizedAdds(s); if (result == null) { if (INSTRUMENTING) { Manager.v().addsExclusionWithoutSearch++; result = this.add(s.exceptionsIncluded); memoizedAdds.put(s, result); } else if (INSTRUMENTING) {
ThrowableSet result = getMemoizedAdds(e); if (result != null) { if (INSTRUMENTING) { throw new AlreadyHasExclusionsException( "ThrowableSet.add(RefType): adding" + e.toString() + " to the set [ " + this.toString() + "] where " + exclusionBase.toString() + " is excluded.");
ThrowableSet result = getMemoizedAdds(e); if (result != null) { if (INSTRUMENTING) { boolean newBaseHasNoHierarchy = hasNoHierarchy(newBase); throw new AlreadyHasExclusionsException("ThrowableSet.add(" + e.toString() + ") to the set [ " + this.toString() + "] where " + exclusionBase.toString() + " is excluded."); result = this; addToMemoizedAdds(e, result); return result;