diff --git a/dataflow/src/main/java/org/checkerframework/dataflow/cfg/CFGBuilder.java b/dataflow/src/main/java/org/checkerframework/dataflow/cfg/CFGBuilder.java index ac92f15aa123..fd7eb542af2d 100644 --- a/dataflow/src/main/java/org/checkerframework/dataflow/cfg/CFGBuilder.java +++ b/dataflow/src/main/java/org/checkerframework/dataflow/cfg/CFGBuilder.java @@ -401,18 +401,21 @@ protected static class NodeWithExceptionsHolder extends ExtendedNode { protected final Node node; /** - * Map from exception type to labels of successors that may be reached as a result of that - * exception. + * Set of all possible pairs of the refined exception type {@link TypeMirror} and the + * corresponding target's label {@link Label} that may be reached as a result of the current + * exception node. */ - protected final Map> exceptions; + protected final Set> exceptions; /** * Construct a NodeWithExceptionsHolder for the given node and exceptions. * * @param node the node to hold - * @param exceptions the exceptions to hold + * @param exceptions set of all possible pairs of the refined exception type {@link + * TypeMirror} and the corresponding target's label {@link Label} that may be reached as + * a result of the exception node. */ - public NodeWithExceptionsHolder(Node node, Map> exceptions) { + public NodeWithExceptionsHolder(Node node, Set> exceptions) { super(ExtendedNodeType.EXCEPTION_NODE); this.node = node; this.exceptions = exceptions; @@ -421,9 +424,11 @@ public NodeWithExceptionsHolder(Node node, Map> exception /** * Get the exceptions for the node. * - * @return exceptions for the node + * @return set of all possible pairs of the refined exception type {@link TypeMirror} and + * the corresponding target's label {@link Label} that may be reached as a result of the + * current exception node. */ - public Map> getExceptions() { + public Set> getExceptions() { return exceptions; } @@ -581,11 +586,23 @@ private static String uniqueName() { */ protected static interface TryFrame { /** - * Given a type of thrown exception, add the set of possible control flow successor {@link - * Label}s to the argument set. Return true if the exception is known to be caught by one of - * those labels and false if it may propagate still further. + * Given a type of thrown exception, add to the argument set all possible pairs of the + * refined exception type {@link TypeMirror} and its control flow successor {@link Label} as + * a result of an exception thrown from a method invocation. + * + *

Return true if the exception is known to be caught by one of those labels and false if + * it may propagate still further. + * + * @param thrown the type of the exception that is declared to be thrown from a method + * invocation, waiting to be refined. + * @param causeLabelPairs the set of all possible pairs of the refined exception type {@link + * TypeMirror} and the corresponding target's label {@link Label} that may be reached as + * a result of {@code thrown}. + * @return true if {@code thrown} is known to be caught by one of those labels and false if + * it may propagate still further */ - public boolean possibleLabels(TypeMirror thrown, Set