Generalized Type.
This commit is contained in:
parent
79883b3def
commit
77b1ed71c7
|
@ -5,39 +5,38 @@ import java.util.LinkedList;
|
|||
|
||||
import com.ibm.wala.ipa.cfg.exceptionpruning.ExceptionFilter;
|
||||
import com.ibm.wala.ipa.cfg.exceptionpruning.FilteredException;
|
||||
import com.ibm.wala.ssa.SSAInstruction;
|
||||
|
||||
/**
|
||||
* Use this class to combine multiple {@link ExceptionFilter}
|
||||
*
|
||||
* @author Stephan Gocht <stephan@gobro.de>
|
||||
*/
|
||||
public class CombinedExceptionFilter implements ExceptionFilter<SSAInstruction> {
|
||||
private final Collection<ExceptionFilter<SSAInstruction>> exceptionFilter;
|
||||
public class CombinedExceptionFilter<Instruction> implements ExceptionFilter<Instruction> {
|
||||
private final Collection<ExceptionFilter<Instruction>> exceptionFilter;
|
||||
|
||||
public CombinedExceptionFilter() {
|
||||
this.exceptionFilter = new LinkedList<>();
|
||||
}
|
||||
|
||||
public CombinedExceptionFilter(
|
||||
Collection<ExceptionFilter<SSAInstruction>> exceptionFilter) {
|
||||
Collection<ExceptionFilter<Instruction>> exceptionFilter) {
|
||||
this.exceptionFilter = exceptionFilter;
|
||||
}
|
||||
|
||||
public boolean add(ExceptionFilter<SSAInstruction> e) {
|
||||
public boolean add(ExceptionFilter<Instruction> e) {
|
||||
return this.exceptionFilter.add(e);
|
||||
}
|
||||
|
||||
public boolean addAll(
|
||||
Collection<? extends ExceptionFilter<SSAInstruction>> c) {
|
||||
Collection<? extends ExceptionFilter<Instruction>> c) {
|
||||
return this.exceptionFilter.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean alwaysThrowsException(SSAInstruction instruction) {
|
||||
public boolean alwaysThrowsException(Instruction instruction) {
|
||||
boolean result = false;
|
||||
|
||||
for (final ExceptionFilter<SSAInstruction> filter : this.exceptionFilter) {
|
||||
for (final ExceptionFilter<Instruction> filter : this.exceptionFilter) {
|
||||
result |= filter.alwaysThrowsException(instruction);
|
||||
}
|
||||
|
||||
|
@ -46,9 +45,9 @@ public class CombinedExceptionFilter implements ExceptionFilter<SSAInstruction>
|
|||
|
||||
@Override
|
||||
public Collection<FilteredException> filteredExceptions(
|
||||
SSAInstruction instruction) {
|
||||
Instruction instruction) {
|
||||
final LinkedList<FilteredException> result = new LinkedList<>();
|
||||
for (final ExceptionFilter<SSAInstruction> filter : this.exceptionFilter) {
|
||||
for (final ExceptionFilter<Instruction> filter : this.exceptionFilter) {
|
||||
result.addAll(filter.filteredExceptions(instruction));
|
||||
}
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue