Remove type arguments that Java 1.7+ can infer for us
This commit is contained in:
parent
b25e461bfe
commit
544a71ae72
|
@ -80,7 +80,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
|
|||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
|
|
|
@ -42,7 +42,7 @@ import java.util.Iterator;
|
|||
|
||||
public class BasicsGenerics {
|
||||
|
||||
static ArrayList<String> strs = new ArrayList<String>();
|
||||
static ArrayList<String> strs = new ArrayList<>();
|
||||
static ArrayList<Integer> ints = new ArrayList<>();
|
||||
|
||||
public BasicsGenerics() {
|
||||
|
|
|
@ -95,7 +95,7 @@ class MyGeneric<A extends Object, B extends IGeneric<A>> {
|
|||
}
|
||||
|
||||
public class CustomGenericsAndFields {
|
||||
static ConcreteGeneric2<String> cg2 = new ConcreteGeneric2<String>();
|
||||
static ConcreteGeneric2<String> cg2 = new ConcreteGeneric2<>();
|
||||
|
||||
static public ConcreteGeneric2<String> cg2WithSideEffects() {
|
||||
System.out.println("look at me! I'm a side effect!");
|
||||
|
@ -109,7 +109,7 @@ public class CustomGenericsAndFields {
|
|||
private void doit() {
|
||||
// Simple: concrete generic
|
||||
|
||||
ConcreteGeneric<String> absinthe = new ConcreteGeneric<String>();
|
||||
ConcreteGeneric<String> absinthe = new ConcreteGeneric<>();
|
||||
IGeneric<String> rye = absinthe;
|
||||
String foo = rye.bar("hello", "world");
|
||||
System.out.println(absinthe.foo() + foo);
|
||||
|
@ -118,7 +118,7 @@ public class CustomGenericsAndFields {
|
|||
|
||||
String thrownaway = cg2.bar("a","b");
|
||||
cg2.setFoo("real one");
|
||||
MyGeneric<String,ConcreteGeneric2<String>> mygeneric = new MyGeneric<String,ConcreteGeneric2<String>>("useless",cg2);
|
||||
MyGeneric<String,ConcreteGeneric2<String>> mygeneric = new MyGeneric<>("useless",cg2);
|
||||
String x = mygeneric.doFoo();
|
||||
System.out.println(x);
|
||||
String y = cg2.x;
|
||||
|
|
|
@ -49,7 +49,7 @@ public class GenericArrays {
|
|||
List<?>[] lsa = new List<?>[10]; // ok, array of unbounded wildcard type
|
||||
Object o = lsa;
|
||||
Object[] oa = (Object[]) o;
|
||||
List<Integer> li = new ArrayList<Integer>();
|
||||
List<Integer> li = new ArrayList<>();
|
||||
li.add(new Integer(3));
|
||||
oa[1] = li; // correct
|
||||
String s = (String) lsa[1].get(0); // run time error, but cast is explicit
|
||||
|
|
|
@ -64,7 +64,7 @@ public class GenericMemberClasses<T>
|
|||
}
|
||||
}
|
||||
public static void main(String args[]) {
|
||||
(new GenericMemberClasses<Object>()).doit();
|
||||
(new GenericMemberClasses<>()).doit();
|
||||
}
|
||||
|
||||
private void doit() {
|
||||
|
|
|
@ -47,14 +47,14 @@ public class GenericSuperSink {
|
|||
|
||||
private void doit() {
|
||||
Collection<? super String> sink;
|
||||
Collection<String> cs = new ArrayList<String>();
|
||||
Collection<String> cs = new ArrayList<>();
|
||||
cs.add("hello");
|
||||
|
||||
sink = new ArrayList<Object>();
|
||||
sink.add(cs.iterator().next());
|
||||
System.out.println(sink);
|
||||
|
||||
sink = new ArrayList<String>();
|
||||
sink = new ArrayList<>();
|
||||
sink.add(cs.iterator().next());
|
||||
System.out.println(sink);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class MethodGenerics {
|
|||
}
|
||||
|
||||
private void doit() {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
String array[] = new String[] { "coucou monde", "ciao mondo", "guten tag welt", "hola mundo", "shalom olam" };
|
||||
fromArrayToCollection(array, list);
|
||||
System.out.println(list);
|
||||
|
|
|
@ -64,14 +64,14 @@ public class Wildcards {
|
|||
}
|
||||
|
||||
private void doit() {
|
||||
ArrayList<String> e = new ArrayList<String>();
|
||||
ArrayList<String> e = new ArrayList<>();
|
||||
e.add("hello");
|
||||
e.add("goodbye");
|
||||
printCollection(e);
|
||||
printCollection1(e);
|
||||
printCollection2(e);
|
||||
|
||||
ArrayList<Integer> e3 = new ArrayList<Integer>();
|
||||
ArrayList<Integer> e3 = new ArrayList<>();
|
||||
e3.add(new Integer(123));
|
||||
e3.add(new Integer(42));
|
||||
printCollection(e3);
|
||||
|
|
|
@ -91,7 +91,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
|
|||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
|
||||
|
|
|
@ -141,7 +141,7 @@ public class ArrayBoundsGraph extends DirectedHyperGraph<Integer> {
|
|||
|
||||
final EdgeWeight edgeWeight = new AdditiveEdgeWeight(weight);
|
||||
|
||||
final DirectedHyperEdge<Integer> edge = new DirectedHyperEdge<Integer>();
|
||||
final DirectedHyperEdge<Integer> edge = new DirectedHyperEdge<>();
|
||||
edge.getDestination().add(dstNode);
|
||||
edge.getSource().add(srcNode);
|
||||
edge.setWeight(edgeWeight);
|
||||
|
@ -193,7 +193,7 @@ public class ArrayBoundsGraph extends DirectedHyperGraph<Integer> {
|
|||
public HyperNode<Integer> addNode(Integer value) {
|
||||
HyperNode<Integer> result;
|
||||
if (!this.getNodes().keySet().contains(value)) {
|
||||
result = new HyperNode<Integer>(value);
|
||||
result = new HyperNode<>(value);
|
||||
this.getNodes().put(value, result);
|
||||
} else {
|
||||
result = this.getNodes().get(value);
|
||||
|
@ -227,7 +227,7 @@ public class ArrayBoundsGraph extends DirectedHyperGraph<Integer> {
|
|||
throw new AssertionError("Source variables should only be created once.");
|
||||
}
|
||||
|
||||
SoftFinalHyperNode<Integer> node = new SoftFinalHyperNode<Integer>(var);
|
||||
SoftFinalHyperNode<Integer> node = new SoftFinalHyperNode<>(var);
|
||||
this.getNodes().put(var, node);
|
||||
|
||||
// final HyperNode<Integer> varNode = this.getNodes().get(var);
|
||||
|
@ -276,7 +276,7 @@ public class ArrayBoundsGraph extends DirectedHyperGraph<Integer> {
|
|||
public void markAsArrayAccess(Integer array, Integer index) {
|
||||
Set<Integer> indices;
|
||||
if (!this.arrayAccess.containsKey(array)) {
|
||||
indices = new HashSet<Integer>();
|
||||
indices = new HashSet<>();
|
||||
this.arrayAccess.put(array, indices);
|
||||
} else {
|
||||
indices = this.arrayAccess.get(array);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ArrayBoundsGraphBuilder {
|
|||
public ArrayBoundsGraphBuilder(IR ir) {
|
||||
this.ir = ir;
|
||||
|
||||
this.foundVariables = new HashSet<Integer>();
|
||||
this.foundVariables = new HashSet<>();
|
||||
this.defUse = new DefUse(ir);
|
||||
|
||||
this.arrayReferenceInstructions = new HashSet<>();
|
||||
|
@ -210,7 +210,7 @@ public class ArrayBoundsGraphBuilder {
|
|||
* @param graph
|
||||
*/
|
||||
private static void collapseNonPhiEdges(ArrayBoundsGraph graph) {
|
||||
final Map<HyperNode<Integer>, DirectedHyperEdge<Integer>> inEdges = new HashMap<HyperNode<Integer>, DirectedHyperEdge<Integer>>();
|
||||
final Map<HyperNode<Integer>, DirectedHyperEdge<Integer>> inEdges = new HashMap<>();
|
||||
final Set<DirectedHyperEdge<Integer>> edges = new HashSet<>();
|
||||
edges.addAll(graph.getEdges());
|
||||
for (final DirectedHyperEdge<Integer> edge : edges) {
|
||||
|
@ -323,7 +323,7 @@ public class ArrayBoundsGraphBuilder {
|
|||
}
|
||||
|
||||
private void exploreIr() {
|
||||
final Set<Integer> variablesUsedAsIndex = new HashSet<Integer>();
|
||||
final Set<Integer> variablesUsedAsIndex = new HashSet<>();
|
||||
for (final Set<Integer> variables : this.lowerBoundGraph
|
||||
.getArrayAccess().values()) {
|
||||
variablesUsedAsIndex.addAll(variables);
|
||||
|
@ -386,7 +386,7 @@ public class ArrayBoundsGraphBuilder {
|
|||
* the given variable.
|
||||
*/
|
||||
private void startDFS(int index) {
|
||||
final Stack<Integer> todo = new Stack<Integer>();
|
||||
final Stack<Integer> todo = new Stack<>();
|
||||
todo.push(index);
|
||||
|
||||
while (!todo.isEmpty()) {
|
||||
|
|
|
@ -21,8 +21,8 @@ public class DirectedHyperEdge<T> {
|
|||
private EdgeWeight weight;
|
||||
|
||||
public DirectedHyperEdge() {
|
||||
this.tail = new HashSet<HyperNode<T>>();
|
||||
this.head = new HashSet<HyperNode<T>>();
|
||||
this.tail = new HashSet<>();
|
||||
this.head = new HashSet<>();
|
||||
}
|
||||
|
||||
public Set<HyperNode<T>> getDestination() {
|
||||
|
|
|
@ -31,7 +31,7 @@ public class HyperNode<T> {
|
|||
|
||||
public HyperNode(T value) {
|
||||
this.value = value;
|
||||
this.outEdges = new HashSet<DirectedHyperEdge<T>>();
|
||||
this.outEdges = new HashSet<>();
|
||||
this.weight = Weight.NOT_SET;
|
||||
this.newWeight = Weight.NOT_SET;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class Exception2BitvectorTransformer {
|
|||
private void createValues(Set<TypeReference> exceptions) {
|
||||
TypeReference[] exceptionsArray = new TypeReference[exceptions.size()];
|
||||
exceptions.toArray(exceptionsArray);
|
||||
values = new ObjectArrayMapping<TypeReference>(exceptionsArray);
|
||||
values = new ObjectArrayMapping<>(exceptionsArray);
|
||||
}
|
||||
|
||||
public BitVector computeBitVector(Set<TypeReference> exceptions) {
|
||||
|
|
|
@ -93,7 +93,7 @@ public class ExceptionAnalysis {
|
|||
ExceptionTransferFunctionProvider transferFunctionProvider = new ExceptionTransferFunctionProvider(intraResult, callgraph,
|
||||
transformer);
|
||||
|
||||
Graph<CGNode> graph = new InvertedGraph<CGNode>(callgraph);
|
||||
Graph<CGNode> graph = new InvertedGraph<>(callgraph);
|
||||
BitVectorFramework<CGNode, TypeReference> problem = new BitVectorFramework<>(graph, transferFunctionProvider,
|
||||
transformer.getValues());
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ public class IntraproceduralExceptionAnalysis {
|
|||
* given block.
|
||||
*/
|
||||
private Set<TypeReference> collectCaughtExceptions(ISSABasicBlock block) {
|
||||
LinkedHashSet<TypeReference> result = new LinkedHashSet<TypeReference>();
|
||||
LinkedHashSet<TypeReference> result = new LinkedHashSet<>();
|
||||
List<ISSABasicBlock> exceptionalSuccessors = ir.getControlFlowGraph().getExceptionalSuccessors(block);
|
||||
for (ISSABasicBlock succ : exceptionalSuccessors) {
|
||||
if (succ.isCatchBlock()) {
|
||||
|
|
|
@ -36,9 +36,9 @@ public class IntraproceduralNullPointerAnalysis {
|
|||
|
||||
final int maxVarNum = ir.getSymbolTable().getMaxValueNumber();
|
||||
SSACFG cfg = ir.getControlFlowGraph();
|
||||
final NullPointerFrameWork<ISSABasicBlock> problem = new NullPointerFrameWork<ISSABasicBlock>(
|
||||
final NullPointerFrameWork<ISSABasicBlock> problem = new NullPointerFrameWork<>(
|
||||
cfg, ir);
|
||||
this.solver = new NullPointerSolver<ISSABasicBlock>(problem, maxVarNum,
|
||||
this.solver = new NullPointerSolver<>(problem, maxVarNum,
|
||||
ir, cfg.entry());
|
||||
try {
|
||||
this.solver.solve(NO_PROGRESS_MONITOR);
|
||||
|
|
|
@ -78,7 +78,7 @@ public class BasicHeapGraph<T extends InstanceKey> extends HeapGraphImpl<T> {
|
|||
final NumberedNodeManager<Object> nodeMgr = new NumberedNodeManager<Object>() {
|
||||
@Override
|
||||
public Iterator<Object> iterator() {
|
||||
return new CompoundIterator<Object>(pointerKeys.iterator(), P.getInstanceKeyMapping().iterator());
|
||||
return new CompoundIterator<>(pointerKeys.iterator(), P.getInstanceKeyMapping().iterator());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -130,7 +130,7 @@ public class BasicHeapGraph<T extends InstanceKey> extends HeapGraphImpl<T> {
|
|||
|
||||
@Override
|
||||
public Iterator<Object> iterateNodes(IntSet s) {
|
||||
return new NumberedNodeIterator<Object>(s, this);
|
||||
return new NumberedNodeIterator<>(s, this);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -146,7 +146,7 @@ public class BasicHeapGraph<T extends InstanceKey> extends HeapGraphImpl<T> {
|
|||
if (p == null) {
|
||||
return EmptyIterator.instance();
|
||||
} else {
|
||||
return new IntMapIterator<Object>(p.intIterator(), toNode);
|
||||
return new IntMapIterator<>(p.intIterator(), toNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ public class BasicHeapGraph<T extends InstanceKey> extends HeapGraphImpl<T> {
|
|||
return EmptyIterator.instance();
|
||||
}
|
||||
SparseIntSet s = factory.make(succ);
|
||||
return new IntMapIterator<Object>(s.intIterator(), toNode);
|
||||
return new IntMapIterator<>(s.intIterator(), toNode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -332,7 +332,7 @@ public class BasicHeapGraph<T extends InstanceKey> extends HeapGraphImpl<T> {
|
|||
*/
|
||||
private void computePredecessorsForLocals(NumberedNodeManager<Object> nodeManager, BasicNaturalRelation R) {
|
||||
|
||||
ArrayList<LocalPointerKey> list = new ArrayList<LocalPointerKey>();
|
||||
ArrayList<LocalPointerKey> list = new ArrayList<>();
|
||||
for (Object n : nodeManager) {
|
||||
if (n instanceof LocalPointerKey) {
|
||||
list.add((LocalPointerKey) n);
|
||||
|
|
|
@ -46,7 +46,7 @@ public abstract class HeapGraphImpl<T extends InstanceKey> implements HeapGraph<
|
|||
|
||||
@Override
|
||||
public Iterator<Object> iterateNodes(IntSet s) {
|
||||
return new NumberedNodeIterator<Object>(s, this);
|
||||
return new NumberedNodeIterator<>(s, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -176,17 +176,17 @@ public abstract class AbstractReflectionInterpreter implements SSAContextInterpr
|
|||
/**
|
||||
* List of synthetic allocation statements we model for this specialized instance
|
||||
*/
|
||||
final protected ArrayList<SSAInstruction> allocations = new ArrayList<SSAInstruction>();
|
||||
final protected ArrayList<SSAInstruction> allocations = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* List of synthetic invoke instructions we model for this specialized instance.
|
||||
*/
|
||||
final protected ArrayList<SSAInstruction> calls = new ArrayList<SSAInstruction>();
|
||||
final protected ArrayList<SSAInstruction> calls = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* List of all instructions
|
||||
*/
|
||||
protected final ArrayList<SSAInstruction> allInstructions = new ArrayList<SSAInstruction>();
|
||||
protected final ArrayList<SSAInstruction> allInstructions = new ArrayList<>();
|
||||
|
||||
private final SSAInstructionFactory insts = declaringClass.getClassLoader().getInstructionFactory();
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ public class ClassFactoryContextInterpreter implements SSAContextInterpreter {
|
|||
JavaTypeContext context = (JavaTypeContext) node.getContext();
|
||||
TypeReference tr = context.getType().getTypeReference();
|
||||
if (tr != null) {
|
||||
return new NonNullSingletonIterator<NewSiteReference>(NewSiteReference.make(0, tr));
|
||||
return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr));
|
||||
}
|
||||
return EmptyIterator.instance();
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ public class ClassFactoryContextInterpreter implements SSAContextInterpreter {
|
|||
|
||||
private static SSAInstruction[] makeStatements(JavaTypeContext context) {
|
||||
SSAInstructionFactory insts = context.getType().getType().getClassLoader().getInstructionFactory();
|
||||
ArrayList<SSAInstruction> statements = new ArrayList<SSAInstruction>();
|
||||
ArrayList<SSAInstruction> statements = new ArrayList<>();
|
||||
// vn1 is the string parameter
|
||||
int retValue = 2;
|
||||
TypeReference tr = context.getType().getTypeReference();
|
||||
|
|
|
@ -127,7 +127,7 @@ public class ClassNewInstanceContextInterpreter extends AbstractReflectionInterp
|
|||
JavaTypeContext context = (JavaTypeContext) node.getContext();
|
||||
TypeReference tr = context.getType().getTypeReference();
|
||||
if (tr != null) {
|
||||
return new NonNullSingletonIterator<NewSiteReference>(NewSiteReference.make(0, tr));
|
||||
return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr));
|
||||
}
|
||||
return EmptyIterator.instance();
|
||||
}
|
||||
|
|
|
@ -141,13 +141,13 @@ public class CloneInterpreter implements SSAContextInterpreter {
|
|||
}
|
||||
assert understands(node);
|
||||
IClass cls = ContextUtil.getConcreteClassFromContext(node.getContext());
|
||||
return new NonNullSingletonIterator<NewSiteReference>(NewSiteReference.make(NEW_PC, cls.getReference()));
|
||||
return new NonNullSingletonIterator<>(NewSiteReference.make(NEW_PC, cls.getReference()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<CallSiteReference> iterateCallSites(CGNode node) {
|
||||
assert understands(node);
|
||||
return new NonNullSingletonIterator<CallSiteReference>(ARRAYCOPY_SITE);
|
||||
return new NonNullSingletonIterator<>(ARRAYCOPY_SITE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -156,7 +156,7 @@ public class CloneInterpreter implements SSAContextInterpreter {
|
|||
private SSAInstruction[] makeStatements(IClass klass) {
|
||||
assert klass != null;
|
||||
|
||||
ArrayList<SSAInstruction> statements = new ArrayList<SSAInstruction>();
|
||||
ArrayList<SSAInstruction> statements = new ArrayList<>();
|
||||
// value number 1 is "this".
|
||||
int nextLocal = 2;
|
||||
|
||||
|
|
|
@ -348,7 +348,7 @@ public class FactoryBypassInterpreter extends AbstractReflectionInterpreter {
|
|||
/**
|
||||
* List of synthetic invoke instructions we model for this specialized instance.
|
||||
*/
|
||||
final private ArrayList<SSAInstruction> calls = new ArrayList<SSAInstruction>();
|
||||
final private ArrayList<SSAInstruction> calls = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* The method being modelled
|
||||
|
|
|
@ -107,7 +107,7 @@ public class GetClassContextInterpeter implements SSAContextInterpreter {
|
|||
}
|
||||
|
||||
private static SSAInstruction[] makeStatements(JavaTypeContext context) {
|
||||
ArrayList<SSAInstruction> statements = new ArrayList<SSAInstruction>();
|
||||
ArrayList<SSAInstruction> statements = new ArrayList<>();
|
||||
int nextLocal = 2;
|
||||
int retValue = nextLocal++;
|
||||
TypeReference tr = context.getType().getTypeReference();
|
||||
|
|
|
@ -133,7 +133,7 @@ public class GetMethodContextInterpreter implements SSAContextInterpreter {
|
|||
GetMethodContext context = (GetMethodContext) node.getContext();
|
||||
TypeReference tr = context.getType().getTypeReference();
|
||||
if (tr != null) {
|
||||
return new NonNullSingletonIterator<NewSiteReference>(NewSiteReference.make(0, tr));
|
||||
return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr));
|
||||
}
|
||||
return EmptyIterator.instance();
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ public class GetMethodContextInterpreter implements SSAContextInterpreter {
|
|||
GetMethodContext context,
|
||||
Map<Integer, ConstantValue> constants
|
||||
) {
|
||||
ArrayList<SSAInstruction> statements = new ArrayList<SSAInstruction>();
|
||||
ArrayList<SSAInstruction> statements = new ArrayList<>();
|
||||
int nextLocal = ref.getNumberOfParameters() + 2;
|
||||
IClass cls = context.getType().getType();
|
||||
SSAInstructionFactory insts = context.getType().getType().getClassLoader().getInstructionFactory();
|
||||
|
|
|
@ -132,7 +132,7 @@ public class GetMethodContextSelector implements ContextSelector {
|
|||
*/
|
||||
protected static ConstantKey<String> makeConstantKey(IClassHierarchy cha,String str) {
|
||||
IClass cls = cha.lookupClass(TypeReference.JavaLangString);
|
||||
ConstantKey<String> ck = new ConstantKey<String>(str,cls);
|
||||
ConstantKey<String> ck = new ConstantKey<>(str,cls);
|
||||
return ck;
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
|
|||
JavaTypeContext context = (JavaTypeContext) node.getContext();
|
||||
TypeReference tr = context.getType().getTypeReference();
|
||||
if (tr != null) {
|
||||
return new NonNullSingletonIterator<NewSiteReference>(NewSiteReference.make(0, tr));
|
||||
return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr));
|
||||
}
|
||||
return EmptyIterator.instance();
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
|
|||
*/
|
||||
private static SSAInstruction[] getMethodArrayStatements(MethodReference ref, Collection<IMethod> returnValues, JavaTypeContext context,
|
||||
Map<Integer, ConstantValue> constants) {
|
||||
ArrayList<SSAInstruction> statements = new ArrayList<SSAInstruction>();
|
||||
ArrayList<SSAInstruction> statements = new ArrayList<>();
|
||||
int nextLocal = ref.getNumberOfParameters() + 2;
|
||||
int retValue = nextLocal++;
|
||||
IClass cls = context.getType().getType();
|
||||
|
@ -329,7 +329,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
|
|||
*/
|
||||
private static SSAInstruction[] getParticularMethodStatements(MethodReference ref, Collection<IMethod> returnValues,
|
||||
JavaTypeContext context, Map<Integer, ConstantValue> constants) {
|
||||
ArrayList<SSAInstruction> statements = new ArrayList<SSAInstruction>();
|
||||
ArrayList<SSAInstruction> statements = new ArrayList<>();
|
||||
int nextLocal = ref.getNumberOfParameters() + 2;
|
||||
IClass cls = context.getType().getType();
|
||||
SSAInstructionFactory insts = context.getType().getType().getClassLoader().getInstructionFactory();
|
||||
|
|
|
@ -209,8 +209,8 @@ public class MethodHandles {
|
|||
|
||||
public Iterator<FieldReference> iterateFields(CGNode node, Predicate<SSAInstruction> filter) {
|
||||
return
|
||||
new MapIterator<SSAInstruction,FieldReference>(
|
||||
new FilterIterator<SSAInstruction>(getIR(node).iterateNormalInstructions(), filter),
|
||||
new MapIterator<>(
|
||||
new FilterIterator<>(getIR(node).iterateNormalInstructions(), filter),
|
||||
object -> ((SSAFieldAccessInstruction)object).getDeclaredField());
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ public class MethodHandles {
|
|||
code.addStatement(insts.LoadMetadataInstruction(code.getNextProgramCounter(), 2, TypeReference.JavaLangInvokeMethodType, ref.getDescriptor()));
|
||||
code.addStatement(insts.ReturnInstruction(code.getNextProgramCounter(), 2, false));
|
||||
}
|
||||
irs.put(node, new SoftReference<IR>(m.makeIR(node.getContext(), SSAOptions.defaultOptions())));
|
||||
irs.put(node, new SoftReference<>(m.makeIR(node.getContext(), SSAOptions.defaultOptions())));
|
||||
}
|
||||
|
||||
return irs.get(node).get();
|
||||
|
|
|
@ -187,7 +187,7 @@ public abstract class AbstractIntStackMachine implements FixedPointConstants {
|
|||
}
|
||||
};
|
||||
|
||||
IKilldallFramework<BasicBlock, MachineState> problem = new BasicFramework<BasicBlock, MachineState>(cfg, xferFunctions);
|
||||
IKilldallFramework<BasicBlock, MachineState> problem = new BasicFramework<>(cfg, xferFunctions);
|
||||
solver = new DataflowSolver<BasicBlock, MachineState>(problem) {
|
||||
private MachineState entry;
|
||||
|
||||
|
|
|
@ -52,25 +52,25 @@ public abstract class AbstractCFG<I, T extends IBasicBlock<I>> implements Contro
|
|||
/**
|
||||
* An object to track nodes in this cfg
|
||||
*/
|
||||
final private DelegatingNumberedNodeManager<T> nodeManager = new DelegatingNumberedNodeManager<T>();
|
||||
final private DelegatingNumberedNodeManager<T> nodeManager = new DelegatingNumberedNodeManager<>();
|
||||
|
||||
/**
|
||||
* An object to track most normal edges in this cfg
|
||||
*/
|
||||
final private SparseNumberedEdgeManager<T> normalEdgeManager = new SparseNumberedEdgeManager<T>(nodeManager, 2,
|
||||
final private SparseNumberedEdgeManager<T> normalEdgeManager = new SparseNumberedEdgeManager<>(nodeManager, 2,
|
||||
BasicNaturalRelation.SIMPLE);
|
||||
|
||||
/**
|
||||
* An object to track not-to-exit exceptional edges in this cfg
|
||||
*/
|
||||
final private SparseNumberedEdgeManager<T> exceptionalEdgeManager = new SparseNumberedEdgeManager<T>(nodeManager, 0,
|
||||
final private SparseNumberedEdgeManager<T> exceptionalEdgeManager = new SparseNumberedEdgeManager<>(nodeManager, 0,
|
||||
BasicNaturalRelation.SIMPLE);
|
||||
|
||||
/**
|
||||
* An object to track not-to-exit exceptional edges in this cfg, indexed by block number. exceptionalEdges[i] is a list of block
|
||||
* numbers that are non-exit exceptional successors of block i, in order of increasing "catch scope".
|
||||
*/
|
||||
final private SimpleVector<SimpleIntVector> exceptionalSuccessors = new SimpleVector<SimpleIntVector>();
|
||||
final private SimpleVector<SimpleIntVector> exceptionalSuccessors = new SimpleVector<>();
|
||||
|
||||
/**
|
||||
* Which basic blocks have a normal edge to exit()?
|
||||
|
@ -305,9 +305,9 @@ public abstract class AbstractCFG<I, T extends IBasicBlock<I>> implements Contro
|
|||
public Iterator<T> getSuccNodes(T N) {
|
||||
int number = getNumber(N);
|
||||
if (normalToExit.get(number) && exceptionalToExit.get(number)) {
|
||||
return new CompoundIterator<T>(iterateNormalSuccessorsWithoutExit(number), iterateExceptionalSuccessors(number));
|
||||
return new CompoundIterator<>(iterateNormalSuccessorsWithoutExit(number), iterateExceptionalSuccessors(number));
|
||||
} else {
|
||||
return new CompoundIterator<T>(iterateNormalSuccessors(number), iterateExceptionalSuccessors(number));
|
||||
return new CompoundIterator<>(iterateNormalSuccessors(number), iterateExceptionalSuccessors(number));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ public abstract class AbstractCFG<I, T extends IBasicBlock<I>> implements Contro
|
|||
*/
|
||||
private Iterator<T> iterateExceptionalSuccessors(int number) {
|
||||
if (exceptionalEdgeManager.hasAnySuccessor(number)) {
|
||||
List<T> result = new ArrayList<T>();
|
||||
List<T> result = new ArrayList<>();
|
||||
SimpleIntVector v = exceptionalSuccessors.get(number);
|
||||
for (int i = 0; i <= v.getMaxIndex(); i++) {
|
||||
result.add(getNode(v.get(i)));
|
||||
|
@ -328,7 +328,7 @@ public abstract class AbstractCFG<I, T extends IBasicBlock<I>> implements Contro
|
|||
return result.iterator();
|
||||
} else {
|
||||
if (exceptionalToExit.get(number)) {
|
||||
return new NonNullSingletonIterator<T>(exit());
|
||||
return new NonNullSingletonIterator<>(exit());
|
||||
} else {
|
||||
return EmptyIterator.instance();
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ public abstract class AbstractCFG<I, T extends IBasicBlock<I>> implements Contro
|
|||
private Iterator<T> iterateNormalSuccessors(int number) {
|
||||
if (fallThru.get(number)) {
|
||||
if (normalToExit.get(number)) {
|
||||
return new IteratorPlusTwo<T>(normalEdgeManager.getSuccNodes(number), getNode(number + 1), exit());
|
||||
return new IteratorPlusTwo<>(normalEdgeManager.getSuccNodes(number), getNode(number + 1), exit());
|
||||
} else {
|
||||
return IteratorPlusOne.make(normalEdgeManager.getSuccNodes(number), getNode(number + 1));
|
||||
}
|
||||
|
@ -591,7 +591,7 @@ public abstract class AbstractCFG<I, T extends IBasicBlock<I>> implements Contro
|
|||
if (b == null) {
|
||||
throw new IllegalArgumentException("b is null");
|
||||
}
|
||||
List<T> result = new ArrayList<T>();
|
||||
List<T> result = new ArrayList<>();
|
||||
for (Iterator<T> it = iterateExceptionalSuccessors(b.getNumber()); it.hasNext();) {
|
||||
result.add(it.next());
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ public abstract class AbstractCFG<I, T extends IBasicBlock<I>> implements Contro
|
|||
*/
|
||||
@Override
|
||||
public Iterator<T> iterateNodes(IntSet s) {
|
||||
return new NumberedNodeIterator<T>(s, this);
|
||||
return new NumberedNodeIterator<>(s, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -393,7 +393,7 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
|
|||
|
||||
public void addPhi(SSAPhiInstruction phiInstruction) {
|
||||
if (phis == null) {
|
||||
phis = new ArrayList<SSAPhiInstruction>(1);
|
||||
phis = new ArrayList<>(1);
|
||||
}
|
||||
phis.add(phiInstruction);
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
|
|||
|
||||
public void addPi(SSAPiInstruction piInstruction) {
|
||||
if (pis == null) {
|
||||
pis = new ArrayList<SSAPiInstruction>(1);
|
||||
pis = new ArrayList<>(1);
|
||||
}
|
||||
pis.add(piInstruction);
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
|
|||
|
||||
@Override
|
||||
public Iterator<SSAInstruction> iterator() {
|
||||
return new ArrayIterator<SSAInstruction>(getInstructions(), getFirstInstructionIndex(), getLastInstructionIndex());
|
||||
return new ArrayIterator<>(getInstructions(), getFirstInstructionIndex(), getLastInstructionIndex());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -360,7 +360,7 @@ public class ShrikeCFG extends AbstractCFG<IInstruction, ShrikeCFG.BasicBlock> i
|
|||
IClass caughtClass = cha.lookupClass(caughtException);
|
||||
// the set "caught" should be the set of exceptions that MUST
|
||||
// have been caught by the handlers in scope
|
||||
ArrayList<TypeReference> caught = new ArrayList<TypeReference>(exceptionTypes.size());
|
||||
ArrayList<TypeReference> caught = new ArrayList<>(exceptionTypes.size());
|
||||
// check if we should add an edge to the catch block.
|
||||
for (TypeReference t : exceptionTypes) {
|
||||
if (t != null) {
|
||||
|
@ -493,7 +493,7 @@ public class ShrikeCFG extends AbstractCFG<IInstruction, ShrikeCFG.BasicBlock> i
|
|||
|
||||
@Override
|
||||
public Iterator<IInstruction> iterator() {
|
||||
return new ArrayIterator<IInstruction>(getInstructions(), getFirstInstructionIndex(), getLastInstructionIndex());
|
||||
return new ArrayIterator<>(getInstructions(), getFirstInstructionIndex(), getLastInstructionIndex());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ControlDependenceGraph<T> extends AbstractNumberedGraph<T> {
|
|||
private Map<T, Set<T>> buildControlDependence(boolean wantEdgeLabels) {
|
||||
Map<T, Set<T>> controlDependence = HashMapFactory.make(cfg.getNumberOfNodes());
|
||||
|
||||
DominanceFrontiers<T> RDF = new DominanceFrontiers<T>(GraphInverter.invert(cfg), cfg.exit());
|
||||
DominanceFrontiers<T> RDF = new DominanceFrontiers<>(GraphInverter.invert(cfg), cfg.exit());
|
||||
|
||||
if (wantEdgeLabels) {
|
||||
edgeLabels = HashMapFactory.make();
|
||||
|
|
|
@ -76,7 +76,7 @@ public final class AnalysisUtil {
|
|||
* @return a Set of all blocks that contain an invoke
|
||||
*/
|
||||
public static Set<IExplodedBasicBlock> extractInvokeBlocks(final ControlFlowGraph<SSAInstruction, IExplodedBasicBlock> cfg) {
|
||||
final HashSet<IExplodedBasicBlock> invokeBlocks = new HashSet<IExplodedBasicBlock>();
|
||||
final HashSet<IExplodedBasicBlock> invokeBlocks = new HashSet<>();
|
||||
|
||||
for (final IExplodedBasicBlock block : cfg) {
|
||||
if (block.getInstruction() instanceof SSAAbstractInvokeInstruction) {
|
||||
|
|
|
@ -78,7 +78,7 @@ public final class InterprocNullPointerAnalysis {
|
|||
private InterprocNullPointerAnalysis(final TypeReference[] ignoredExceptions, final MethodState defaultMethodState, boolean optHasExceptions) {
|
||||
this.ignoredExceptions = ignoredExceptions;
|
||||
this.defaultMethodState = defaultMethodState;
|
||||
this.states = new HashMap<CGNode, IntraprocAnalysisState>();
|
||||
this.states = new HashMap<>();
|
||||
this.optHasExceptions = optHasExceptions;
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ public final class InterprocNullPointerAnalysis {
|
|||
private Map<CGNode, Map<SSAAbstractInvokeInstruction, ParameterState>> analysisFirstPass(final CGNode startNode,
|
||||
final ParameterState paramState, final IProgressMonitor progress) throws UnsoundGraphException, CancelException {
|
||||
final Map<CGNode, Map<SSAAbstractInvokeInstruction, ParameterState>> result =
|
||||
new HashMap<CGNode, Map<SSAAbstractInvokeInstruction, ParameterState>>();
|
||||
new HashMap<>();
|
||||
final IR ir = startNode.getIR();
|
||||
|
||||
if (!startNode.getMethod().isStatic()) {
|
||||
|
@ -195,7 +195,7 @@ public final class InterprocNullPointerAnalysis {
|
|||
final Set<CGNode> targets = cgFiltered.getPossibleTargets(startNode, invokeInstruction.getCallSite());
|
||||
|
||||
for (final CGNode target : targets) {
|
||||
final HashMap<SSAAbstractInvokeInstruction, ParameterState> stateMap = new HashMap<SSAAbstractInvokeInstruction, ParameterState>();
|
||||
final HashMap<SSAAbstractInvokeInstruction, ParameterState> stateMap = new HashMap<>();
|
||||
stateMap.put(invokeInstruction, paramStateOfInvokeBlock);
|
||||
result.put(target, stateMap);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ public final class InterprocNullPointerAnalysis {
|
|||
* Reduces the Callgraph to only the nodes that we need
|
||||
*/
|
||||
private static CallGraph computeFilteredCallgraph(final CallGraph cg) {
|
||||
final HashSet<Atom> filterSet = new HashSet<Atom>();
|
||||
final HashSet<Atom> filterSet = new HashSet<>();
|
||||
final Atom worldClinit = Atom.findOrCreateAsciiAtom("fakeWorldClinit");
|
||||
filterSet.add(worldClinit);
|
||||
filterSet.add(MethodReference.initAtom);
|
||||
|
@ -254,14 +254,14 @@ public final class InterprocNullPointerAnalysis {
|
|||
* @return the filtered CallGraph
|
||||
*/
|
||||
private CallGraph filter(final CallGraph fullCG) {
|
||||
final HashSet<CGNode> nodes = new HashSet<CGNode>();
|
||||
final HashSet<CGNode> nodes = new HashSet<>();
|
||||
|
||||
// fill all nodes into a set
|
||||
for (final CGNode n : fullCG) {
|
||||
nodes.add(n);
|
||||
}
|
||||
|
||||
final HashSet<CGNode> nodesToRemove = new HashSet<CGNode>();
|
||||
final HashSet<CGNode> nodesToRemove = new HashSet<>();
|
||||
// collect all nodes that we do not need
|
||||
for (final CGNode node : nodes) {
|
||||
for (final Atom method : filter) {
|
||||
|
@ -272,7 +272,7 @@ public final class InterprocNullPointerAnalysis {
|
|||
}
|
||||
nodes.removeAll(nodesToRemove);
|
||||
|
||||
final HashSet<CGNode> partialRoots = new HashSet<CGNode>();
|
||||
final HashSet<CGNode> partialRoots = new HashSet<>();
|
||||
partialRoots.add(fullCG.getFakeRootNode());
|
||||
|
||||
// delete the nodes
|
||||
|
|
|
@ -39,10 +39,10 @@ final class IntraprocAnalysisState implements ExceptionPruningAnalysis<SSAInstru
|
|||
|
||||
private final ControlFlowGraph<SSAInstruction, IExplodedBasicBlock> cfg;
|
||||
private final HashMap<IExplodedBasicBlock, NullPointerState> statesOfSsaVars =
|
||||
new HashMap<IExplodedBasicBlock, NullPointerState>();
|
||||
private final HashMap<IExplodedBasicBlock, Object[]> valuesOfSsaVars = new HashMap<IExplodedBasicBlock, Object[]>();
|
||||
new HashMap<>();
|
||||
private final HashMap<IExplodedBasicBlock, Object[]> valuesOfSsaVars = new HashMap<>();
|
||||
private final HashMap<IExplodedBasicBlock, int[]> numbersOfSsaVarsThatAreParemerters =
|
||||
new HashMap<IExplodedBasicBlock, int[]>();
|
||||
new HashMap<>();
|
||||
private final boolean noAnalysisPossible;
|
||||
private final int deletedEdges;
|
||||
private boolean throwsException = true;
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ExplodedCFGNullPointerAnalysis implements ExceptionPruningAnalysis<
|
|||
public int compute(IProgressMonitor progress) throws UnsoundGraphException, CancelException {
|
||||
ControlFlowGraph<SSAInstruction, IExplodedBasicBlock> orig = ExplodedControlFlowGraph.make(ir);
|
||||
|
||||
intra = new IntraprocNullPointerAnalysis<IExplodedBasicBlock>(ir, orig, ignoredExceptions, initialState, mState);
|
||||
intra = new IntraprocNullPointerAnalysis<>(ir, orig, ignoredExceptions, initialState, mState);
|
||||
intra.run(progress);
|
||||
|
||||
return intra.getNumberOfDeletedEdges();
|
||||
|
|
|
@ -84,7 +84,7 @@ public class IntraprocNullPointerAnalysis<T extends ISSABasicBlock> {
|
|||
maxVarNum = ir.getSymbolTable().getMaxValueNumber();
|
||||
}
|
||||
|
||||
this.ignoreExceptions = new HashSet<TypeReference>();
|
||||
this.ignoreExceptions = new HashSet<>();
|
||||
|
||||
if (ignoreExceptions != null) {
|
||||
for (TypeReference tRef : ignoreExceptions) {
|
||||
|
@ -98,7 +98,7 @@ public class IntraprocNullPointerAnalysis<T extends ISSABasicBlock> {
|
|||
|
||||
private static <T extends ISSABasicBlock> List<T>
|
||||
searchNodesWithPathToCatchAll(ControlFlowGraph<SSAInstruction, T> cfg) {
|
||||
final List<T> nodes = new LinkedList<T>();
|
||||
final List<T> nodes = new LinkedList<>();
|
||||
|
||||
for (final T exp : cfg) {
|
||||
final List<T> excSucc = cfg.getExceptionalSuccessors(exp);
|
||||
|
@ -134,9 +134,9 @@ public class IntraprocNullPointerAnalysis<T extends ISSABasicBlock> {
|
|||
pruned = cfg;
|
||||
} else {
|
||||
final List<T> catched = searchNodesWithPathToCatchAll(cfg);
|
||||
final NullPointerFrameWork<T> problem = new NullPointerFrameWork<T>(cfg, ir);
|
||||
final NullPointerFrameWork<T> problem = new NullPointerFrameWork<>(cfg, ir);
|
||||
|
||||
solver = new NullPointerSolver<T>(problem, maxVarNum, cfg.entry(), ir, initialState);
|
||||
solver = new NullPointerSolver<>(problem, maxVarNum, cfg.entry(), ir, initialState);
|
||||
|
||||
solver.solve(progress);
|
||||
|
||||
|
@ -151,7 +151,7 @@ public class IntraprocNullPointerAnalysis<T extends ISSABasicBlock> {
|
|||
for (T node : deleted) {
|
||||
deletedEdges += deleted.getSuccNodeCount(node);
|
||||
}
|
||||
final NegativeGraphFilter<T> filter = new NegativeGraphFilter<T>(deleted);
|
||||
final NegativeGraphFilter<T> filter = new NegativeGraphFilter<>(deleted);
|
||||
|
||||
final PrunedCFG<SSAInstruction, T> newCfg = PrunedCFG.make(cfg, filter);
|
||||
|
||||
|
@ -201,7 +201,7 @@ public class IntraprocNullPointerAnalysis<T extends ISSABasicBlock> {
|
|||
|
||||
private final Graph<T> deleted;
|
||||
private NegativeCFGBuilderVisitor() {
|
||||
this.deleted = new SparseNumberedGraph<T>(2);
|
||||
this.deleted = new SparseNumberedGraph<>(2);
|
||||
for (T bb : cfg) {
|
||||
deleted.addNode(bb);
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ public class IntraprocNullPointerAnalysis<T extends ISSABasicBlock> {
|
|||
return mState != null && !mState.throwsException((SSAAbstractInvokeInstruction) instr);
|
||||
} else {
|
||||
Collection<TypeReference> exc = instr.getExceptionTypes();
|
||||
Set<TypeReference> myExcs = new HashSet<TypeReference>(exc);
|
||||
Set<TypeReference> myExcs = new HashSet<>(exc);
|
||||
myExcs.removeAll(ignoreExceptions);
|
||||
|
||||
return myExcs.size() == 1 && myExcs.contains(TypeReference.JavaLangNullPointerException);
|
||||
|
@ -259,7 +259,7 @@ public class IntraprocNullPointerAnalysis<T extends ISSABasicBlock> {
|
|||
return mState != null && !mState.throwsException((SSAAbstractInvokeInstruction) instr);
|
||||
} else {
|
||||
Collection<TypeReference> exc = instr.getExceptionTypes();
|
||||
Set<TypeReference> myExcs = new HashSet<TypeReference>(exc);
|
||||
Set<TypeReference> myExcs = new HashSet<>(exc);
|
||||
myExcs.removeAll(ignoreExceptions);
|
||||
|
||||
return myExcs.isEmpty();
|
||||
|
|
|
@ -38,7 +38,7 @@ public class MutableCFG<X, T extends IBasicBlock<X>> extends SparseNumberedGraph
|
|||
}
|
||||
|
||||
public static <I, T extends IBasicBlock<I>> MutableCFG<I, T> copyFrom(ControlFlowGraph<I, T> cfg) {
|
||||
MutableCFG<I, T> mutable = new MutableCFG<I, T>(cfg);
|
||||
MutableCFG<I, T> mutable = new MutableCFG<>(cfg);
|
||||
|
||||
for (T node : cfg) {
|
||||
mutable.addNode(node);
|
||||
|
@ -108,7 +108,7 @@ public class MutableCFG<X, T extends IBasicBlock<X>> extends SparseNumberedGraph
|
|||
public List<T> getExceptionalSuccessors(T b) {
|
||||
final List<T> origSucc = orig.getExceptionalSuccessors(b);
|
||||
final IntSet allSuccs = this.getSuccNodeNumbers(b);
|
||||
final List<T> thisSuccs = new LinkedList<T>();
|
||||
final List<T> thisSuccs = new LinkedList<>();
|
||||
|
||||
for (final T block : origSucc) {
|
||||
if (allSuccs.contains(block.getNumber())) {
|
||||
|
@ -122,7 +122,7 @@ public class MutableCFG<X, T extends IBasicBlock<X>> extends SparseNumberedGraph
|
|||
@Override
|
||||
public Collection<T> getNormalSuccessors(T b) {
|
||||
final List<T> excSuccs = getExceptionalSuccessors(b);
|
||||
final List<T> thisSuccs = new LinkedList<T>();
|
||||
final List<T> thisSuccs = new LinkedList<>();
|
||||
|
||||
final Iterator<T> succs = getSuccNodes(b);
|
||||
while (succs.hasNext()) {
|
||||
|
@ -139,7 +139,7 @@ public class MutableCFG<X, T extends IBasicBlock<X>> extends SparseNumberedGraph
|
|||
public Collection<T> getExceptionalPredecessors(T b) {
|
||||
final Collection<T> origPreds = orig.getExceptionalPredecessors(b);
|
||||
final IntSet allPreds = this.getPredNodeNumbers(b);
|
||||
final List<T> thisPreds = new LinkedList<T>();
|
||||
final List<T> thisPreds = new LinkedList<>();
|
||||
|
||||
for (final T block : origPreds) {
|
||||
if (allPreds.contains(block.getNumber())) {
|
||||
|
@ -153,7 +153,7 @@ public class MutableCFG<X, T extends IBasicBlock<X>> extends SparseNumberedGraph
|
|||
@Override
|
||||
public Collection<T> getNormalPredecessors(T b) {
|
||||
final Collection<T> excPreds = getExceptionalPredecessors(b);
|
||||
final List<T> thisPreds = new LinkedList<T>();
|
||||
final List<T> thisPreds = new LinkedList<>();
|
||||
|
||||
final Iterator<T> preds = getPredNodes(b);
|
||||
while (preds.hasNext()) {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class NullPointerFrameWork<T extends ISSABasicBlock> implements IKilldall
|
|||
this.flow = cfg;
|
||||
}
|
||||
|
||||
this.transferFunct = new NullPointerTransferFunctionProvider<T>(cfg, ir);
|
||||
this.transferFunct = new NullPointerTransferFunctionProvider<>(cfg, ir);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ParameterState extends AbstractVariable<ParameterState> {
|
|||
public static final int NO_THIS_PTR = -1;
|
||||
|
||||
// maps the parmeter's varNum --> State
|
||||
private final HashMap<Integer, State> params = new HashMap<Integer, State>();
|
||||
private final HashMap<Integer, State> params = new HashMap<>();
|
||||
|
||||
public static ParameterState createDefault(IMethod m) {
|
||||
ParameterState p = new ParameterState();
|
||||
|
|
|
@ -45,7 +45,7 @@ public class SSACFGNullPointerAnalysis implements ExceptionPruningAnalysis<SSAIn
|
|||
public int compute(IProgressMonitor progress) throws UnsoundGraphException, CancelException {
|
||||
ControlFlowGraph<SSAInstruction, ISSABasicBlock> orig = ir.getControlFlowGraph();
|
||||
|
||||
intra = new IntraprocNullPointerAnalysis<ISSABasicBlock>(ir, orig, ignoredExceptions, initialState, mState);
|
||||
intra = new IntraprocNullPointerAnalysis<>(ir, orig, ignoredExceptions, initialState, mState);
|
||||
intra.run(progress);
|
||||
|
||||
return intra.getNumberOfDeletedEdges();
|
||||
|
|
|
@ -77,7 +77,7 @@ public abstract class AbstractURLModule implements Module, ModuleEntry {
|
|||
|
||||
@Override
|
||||
public Iterator<ModuleEntry> getEntries() {
|
||||
return new NonNullSingletonIterator<ModuleEntry>(this);
|
||||
return new NonNullSingletonIterator<>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -306,7 +306,7 @@ public abstract class BytecodeClass<T extends IClassLoader> implements IClass {
|
|||
*/
|
||||
@Override
|
||||
public Collection<IField> getAllFields() {
|
||||
Collection<IField> result = new LinkedList<IField>();
|
||||
Collection<IField> result = new LinkedList<>();
|
||||
result.addAll(getAllInstanceFields());
|
||||
result.addAll(getAllStaticFields());
|
||||
return result;
|
||||
|
@ -359,7 +359,7 @@ public abstract class BytecodeClass<T extends IClassLoader> implements IClass {
|
|||
*/
|
||||
@Override
|
||||
public Collection<IField> getAllInstanceFields() {
|
||||
Collection<IField> result = new LinkedList<IField>(getDeclaredInstanceFields());
|
||||
Collection<IField> result = new LinkedList<>(getDeclaredInstanceFields());
|
||||
IClass s = getSuperclass();
|
||||
while (s != null) {
|
||||
result.addAll(s.getDeclaredInstanceFields());
|
||||
|
@ -373,7 +373,7 @@ public abstract class BytecodeClass<T extends IClassLoader> implements IClass {
|
|||
*/
|
||||
@Override
|
||||
public Collection<IField> getAllStaticFields() {
|
||||
Collection<IField> result = new LinkedList<IField>(getDeclaredStaticFields());
|
||||
Collection<IField> result = new LinkedList<>(getDeclaredStaticFields());
|
||||
IClass s = getSuperclass();
|
||||
while (s != null) {
|
||||
result.addAll(s.getDeclaredStaticFields());
|
||||
|
@ -387,7 +387,7 @@ public abstract class BytecodeClass<T extends IClassLoader> implements IClass {
|
|||
*/
|
||||
@Override
|
||||
public Collection<IMethod> getAllMethods() {
|
||||
Collection<IMethod> result = new LinkedList<IMethod>();
|
||||
Collection<IMethod> result = new LinkedList<>();
|
||||
Iterator<IMethod> declaredMethods = getDeclaredMethods().iterator();
|
||||
while (declaredMethods.hasNext()) {
|
||||
result.add(declaredMethods.next());
|
||||
|
@ -459,7 +459,7 @@ public abstract class BytecodeClass<T extends IClassLoader> implements IClass {
|
|||
IMethod inherit = superclass.getMethod(selector);
|
||||
if (inherit != null) {
|
||||
if (inheritCache == null) {
|
||||
inheritCache = new BimodalMap<Selector, IMethod>(5);
|
||||
inheritCache = new BimodalMap<>(5);
|
||||
}
|
||||
inheritCache.put(selector, inherit);
|
||||
return inherit;
|
||||
|
@ -473,7 +473,7 @@ public abstract class BytecodeClass<T extends IClassLoader> implements IClass {
|
|||
for(IMethod m : iface.getDeclaredMethods()) {
|
||||
if (!m.isAbstract() && m.getSelector().equals(selector)) {
|
||||
if (inheritCache == null) {
|
||||
inheritCache = new BimodalMap<Selector, IMethod>(5);
|
||||
inheritCache = new BimodalMap<>(5);
|
||||
}
|
||||
inheritCache.put(selector, m);
|
||||
|
||||
|
@ -484,7 +484,7 @@ public abstract class BytecodeClass<T extends IClassLoader> implements IClass {
|
|||
|
||||
// no method found
|
||||
if (inheritCache == null) {
|
||||
inheritCache = new BimodalMap<Selector, IMethod>(5);
|
||||
inheritCache = new BimodalMap<>(5);
|
||||
}
|
||||
inheritCache.put(selector, null);
|
||||
return null;
|
||||
|
@ -536,7 +536,7 @@ public abstract class BytecodeClass<T extends IClassLoader> implements IClass {
|
|||
* classes can not be loaded
|
||||
*/
|
||||
private Collection<IClass> array2IClassSet(ImmutableByteArray[] interfaces) {
|
||||
ArrayList<IClass> result = new ArrayList<IClass>(interfaces.length);
|
||||
ArrayList<IClass> result = new ArrayList<>(interfaces.length);
|
||||
for (ImmutableByteArray name : interfaces) {
|
||||
IClass klass = null;
|
||||
klass = loader.lookupClass(TypeName.findOrCreate(name));
|
||||
|
@ -551,7 +551,7 @@ public abstract class BytecodeClass<T extends IClassLoader> implements IClass {
|
|||
|
||||
protected List<IField> findDeclaredField(Atom name) {
|
||||
|
||||
List<IField> result = new ArrayList<IField>(1);
|
||||
List<IField> result = new ArrayList<>(1);
|
||||
|
||||
if (instanceFields != null) {
|
||||
for (IField instanceField : instanceFields) {
|
||||
|
@ -599,7 +599,7 @@ public abstract class BytecodeClass<T extends IClassLoader> implements IClass {
|
|||
if (methods.length > 5) {
|
||||
tmpMethodMap = HashMapFactory.make(methods.length);
|
||||
} else {
|
||||
tmpMethodMap= new SmallMap<Selector, IMethod>();
|
||||
tmpMethodMap= new SmallMap<>();
|
||||
}
|
||||
for (IMethod m : methods) {
|
||||
tmpMethodMap.put(m.getReference().getSelector(), m);
|
||||
|
|
|
@ -206,7 +206,7 @@ public class CodeScanner {
|
|||
|
||||
private static List<FieldReference> getFieldsReadFromShrikeBT(ShrikeCTMethod M) throws InvalidClassFileException {
|
||||
// TODO move the logic here from ShrikeCTMethodWrapper
|
||||
LinkedList<FieldReference> result = new LinkedList<FieldReference>();
|
||||
LinkedList<FieldReference> result = new LinkedList<>();
|
||||
for (Iterator<FieldReference> it = M.getFieldsRead(); it.hasNext();) {
|
||||
result.add(it.next());
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ public class CodeScanner {
|
|||
|
||||
private static List<FieldReference> getFieldsWrittenFromShrikeBT(ShrikeCTMethod M) throws InvalidClassFileException {
|
||||
// TODO move the logic here from ShrikeCTMethodWrapper
|
||||
LinkedList<FieldReference> result = new LinkedList<FieldReference>();
|
||||
LinkedList<FieldReference> result = new LinkedList<>();
|
||||
for (Iterator<FieldReference> it = M.getFieldsWritten(); it.hasNext();) {
|
||||
result.add(it.next());
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public class CodeScanner {
|
|||
|
||||
private static List<TypeReference> getArraysWrittenFromShrikeBT(ShrikeCTMethod M) throws InvalidClassFileException {
|
||||
// TODO move the logic here from ShrikeCTMethodWrapper
|
||||
List<TypeReference> result = new LinkedList<TypeReference>();
|
||||
List<TypeReference> result = new LinkedList<>();
|
||||
for (Iterator<TypeReference> it = M.getArraysWritten(); it.hasNext();) {
|
||||
result.add(it.next());
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ public class CodeScanner {
|
|||
* @return List of InvokeInstruction
|
||||
*/
|
||||
private static List<CallSiteReference> getCallSites(SSAInstruction[] statements) {
|
||||
final List<CallSiteReference> result = new LinkedList<CallSiteReference>();
|
||||
final List<CallSiteReference> result = new LinkedList<>();
|
||||
Visitor v = new Visitor() {
|
||||
@Override
|
||||
public void visitInvoke(SSAInvokeInstruction instruction) {
|
||||
|
@ -311,7 +311,7 @@ public class CodeScanner {
|
|||
* @return List of InvokeInstruction
|
||||
*/
|
||||
private static List<NewSiteReference> getNewSites(SSAInstruction[] statements) {
|
||||
final List<NewSiteReference> result = new LinkedList<NewSiteReference>();
|
||||
final List<NewSiteReference> result = new LinkedList<>();
|
||||
Visitor v = new Visitor() {
|
||||
@Override
|
||||
public void visitNew(SSANewInstruction instruction) {
|
||||
|
@ -335,7 +335,7 @@ public class CodeScanner {
|
|||
if (statements == null) {
|
||||
throw new IllegalArgumentException("statements == null");
|
||||
}
|
||||
final List<FieldReference> result = new LinkedList<FieldReference>();
|
||||
final List<FieldReference> result = new LinkedList<>();
|
||||
Visitor v = new Visitor() {
|
||||
@Override
|
||||
public void visitGet(SSAGetInstruction instruction) {
|
||||
|
@ -359,7 +359,7 @@ public class CodeScanner {
|
|||
if (statements == null) {
|
||||
throw new IllegalArgumentException("statements == null");
|
||||
}
|
||||
final List<FieldReference> result = new LinkedList<FieldReference>();
|
||||
final List<FieldReference> result = new LinkedList<>();
|
||||
Visitor v = new Visitor() {
|
||||
@Override
|
||||
public void visitPut(SSAPutInstruction instruction) {
|
||||
|
@ -383,7 +383,7 @@ public class CodeScanner {
|
|||
if (statements == null) {
|
||||
throw new IllegalArgumentException("statements == null");
|
||||
}
|
||||
final List<TypeReference> result = new LinkedList<TypeReference>();
|
||||
final List<TypeReference> result = new LinkedList<>();
|
||||
Visitor v = new Visitor() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,7 @@ public class CompoundModule implements ModuleEntry, Module, SourceModule {
|
|||
|
||||
@Override
|
||||
public Iterator<ModuleEntry> getEntries() {
|
||||
return new NonNullSingletonIterator<ModuleEntry>(this);
|
||||
return new NonNullSingletonIterator<>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,7 +103,7 @@ public class CompoundModule implements ModuleEntry, Module, SourceModule {
|
|||
}
|
||||
|
||||
public class Reader extends java.io.Reader {
|
||||
private final List<Pair<Integer,URL>> locations = new ArrayList<Pair<Integer,URL>>();
|
||||
private final List<Pair<Integer,URL>> locations = new ArrayList<>();
|
||||
private int line = 0;
|
||||
private int index = 0;
|
||||
private LineNumberReader currentReader;
|
||||
|
|
|
@ -49,7 +49,7 @@ public abstract class FileModule implements Module, ModuleEntry {
|
|||
*/
|
||||
@Override
|
||||
public Iterator<ModuleEntry> getEntries() {
|
||||
return new NonNullSingletonIterator<ModuleEntry>(this);
|
||||
return new NonNullSingletonIterator<>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -561,7 +561,7 @@ public class JavaLanguage extends LanguageImpl implements BytecodeLanguage, Cons
|
|||
if (target == null) {
|
||||
throw new IllegalArgumentException("target is null");
|
||||
}
|
||||
ArrayList<TypeReference> set = new ArrayList<TypeReference>(cha.getJavaLangRuntimeExceptionTypes());
|
||||
ArrayList<TypeReference> set = new ArrayList<>(cha.getJavaLangRuntimeExceptionTypes());
|
||||
set.addAll(cha.getJavaLangErrorTypes());
|
||||
|
||||
IClass klass = cha.lookupClass(target.getDeclaringClass());
|
||||
|
|
|
@ -145,7 +145,7 @@ public abstract class ShrikeBTMethod implements IMethod, BytecodeConstants {
|
|||
}
|
||||
if (result == null) {
|
||||
result = computeBCInfo();
|
||||
bcInfo = new SoftReference<BytecodeInfo>(result);
|
||||
bcInfo = new SoftReference<>(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -80,8 +80,8 @@ public final class ShrikeClass extends JVMClass<IClassLoader> {
|
|||
private void computeFields() throws InvalidClassFileException {
|
||||
ClassReader cr = reader.get();
|
||||
int fieldCount = cr.getFieldCount();
|
||||
List<FieldImpl> instanceList = new ArrayList<FieldImpl>(fieldCount);
|
||||
List<FieldImpl> staticList = new ArrayList<FieldImpl>(fieldCount);
|
||||
List<FieldImpl> instanceList = new ArrayList<>(fieldCount);
|
||||
List<FieldImpl> staticList = new ArrayList<>(fieldCount);
|
||||
try {
|
||||
for (int i = 0; i < fieldCount; i++) {
|
||||
int accessFlags = cr.getFieldAccessFlags(i);
|
||||
|
|
|
@ -265,7 +265,7 @@ public abstract class AbstractAnalysisEngine<I extends InstanceKey> implements A
|
|||
}
|
||||
|
||||
public SDG<I> getSDG(DataDependenceOptions data, ControlDependenceOptions ctrl) {
|
||||
return new SDG<I>(getCallGraph(), getPointerAnalysis(), data, ctrl);
|
||||
return new SDG<>(getCallGraph(), getPointerAnalysis(), data, ctrl);
|
||||
}
|
||||
|
||||
public String getExclusionsFile() {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class BackwardsSupergraph<T, P> implements ISupergraph<T, P> {
|
|||
}
|
||||
|
||||
public static <T, P> BackwardsSupergraph<T, P> make(ISupergraph<T, P> forwardGraph) {
|
||||
return new BackwardsSupergraph<T, P>(forwardGraph);
|
||||
return new BackwardsSupergraph<>(forwardGraph);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -99,7 +99,7 @@ public class BackwardsSupergraph<T, P> implements ISupergraph<T, P> {
|
|||
System.err.println("called nodes: "
|
||||
+ Iterator2Collection.toSet(new FilterIterator<>(getSuccNodes(ret), exitFilter)));
|
||||
}
|
||||
return new FilterIterator<T>(getSuccNodes(ret), exitFilter);
|
||||
return new FilterIterator<>(getSuccNodes(ret), exitFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,7 +113,7 @@ public class BackwardsSupergraph<T, P> implements ISupergraph<T, P> {
|
|||
Predicate<T> sameProc = o -> getProcOf(ret).equals(getProcOf(o)) && !delegate.isExit(o);
|
||||
Iterator<T> sameProcPreds = new FilterIterator<>(allPreds, sameProc);
|
||||
Predicate<T> notCall = o -> !delegate.isCall(o);
|
||||
return new FilterIterator<T>(sameProcPreds, notCall);
|
||||
return new FilterIterator<>(sameProcPreds, notCall);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -28,7 +28,7 @@ public class BoundedPartiallyBalancedSolver<T, P, F> extends PartiallyBalancedTa
|
|||
|
||||
public static <T, P, F> BoundedPartiallyBalancedSolver<T, P, F> createdBoundedPartiallyBalancedSolver(PartiallyBalancedTabulationProblem<T, P, F> p, int bound,
|
||||
IProgressMonitor monitor) {
|
||||
return new BoundedPartiallyBalancedSolver<T, P, F>(p, bound, monitor);
|
||||
return new BoundedPartiallyBalancedSolver<>(p, bound, monitor);
|
||||
}
|
||||
|
||||
private final int bound;
|
||||
|
|
|
@ -26,7 +26,7 @@ public class BoundedTabulationSolver<T, P, F> extends TabulationSolver<T, P, F>
|
|||
|
||||
public static <T, P, F> BoundedTabulationSolver<T, P, F> createBoundedTabulationSolver(TabulationProblem<T, P, F> p, int bound,
|
||||
IProgressMonitor monitor) {
|
||||
return new BoundedTabulationSolver<T, P, F>(p, bound, monitor);
|
||||
return new BoundedTabulationSolver<>(p, bound, monitor);
|
||||
}
|
||||
|
||||
private final int bound;
|
||||
|
|
|
@ -34,14 +34,14 @@ public class CallFlowEdges {
|
|||
* TODO: more representation optimization. A special representation for triples? sparse representations for CFG? exploit shorts
|
||||
* for ints?
|
||||
*/
|
||||
private final SparseVector<IBinaryNaturalRelation> edges = new SparseVector<IBinaryNaturalRelation>(1, 1.1f);
|
||||
private final SparseVector<IBinaryNaturalRelation> edges = new SparseVector<>(1, 1.1f);
|
||||
|
||||
/**
|
||||
* a map from integer d1 -> int set.
|
||||
*
|
||||
* for fact d1, identityPaths[d1] gives the set of block numbers C s.t. for c \in C, <c, d1> -> <s_p, d1> is an edge.
|
||||
*/
|
||||
private final SparseVector<IntSet> identityEdges = new SparseVector<IntSet>(1, 1.1f);
|
||||
private final SparseVector<IntSet> identityEdges = new SparseVector<>(1, 1.1f);
|
||||
|
||||
public CallFlowEdges() {
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ public class ICFGSupergraph implements ISupergraph<BasicBlockInContext<IExploded
|
|||
@Override
|
||||
public Iterator<? extends BasicBlockInContext<IExplodedBasicBlock>> getCalledNodes(BasicBlockInContext<IExplodedBasicBlock> call) {
|
||||
final Predicate<BasicBlockInContext<IExplodedBasicBlock>> isEntryFilter = BasicBlockInContext::isEntryBlock;
|
||||
return new FilterIterator<BasicBlockInContext<IExplodedBasicBlock>>(getSuccNodes(call), isEntryFilter);
|
||||
return new FilterIterator<>(getSuccNodes(call), isEntryFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -114,7 +114,7 @@ public class ICFGSupergraph implements ISupergraph<BasicBlockInContext<IExploded
|
|||
@Override
|
||||
public BasicBlockInContext<IExplodedBasicBlock> getLocalBlock(CGNode procedure, int i) {
|
||||
IExplodedBasicBlock b = icfg.getCFG(procedure).getNode(i);
|
||||
return new BasicBlockInContext<IExplodedBasicBlock>(procedure, b);
|
||||
return new BasicBlockInContext<>(procedure, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,7 +50,7 @@ public class LocalPathEdges {
|
|||
* TODO: more representation optimization. A special representation for triples? sparse representations for CFG? exploit shorts
|
||||
* for ints?
|
||||
*/
|
||||
private final SparseVector<IBinaryNaturalRelation> paths = new SparseVector<IBinaryNaturalRelation>(1, 1.1f);
|
||||
private final SparseVector<IBinaryNaturalRelation> paths = new SparseVector<>(1, 1.1f);
|
||||
|
||||
/**
|
||||
* If this is non-null, it holds a redundant representation of the paths information, designed to make getReachable(II) faster.
|
||||
|
@ -75,20 +75,20 @@ public class LocalPathEdges {
|
|||
*
|
||||
* for fact d1, identityPaths[d1] gives the set of block numbers N s.t. for n \in N, <s_p, d1> -> <n, d1> is a path edge.
|
||||
*/
|
||||
private final SparseVector<IntSet> identityPaths = new SparseVector<IntSet>(1, 1.1f);
|
||||
private final SparseVector<IntSet> identityPaths = new SparseVector<>(1, 1.1f);
|
||||
|
||||
/**
|
||||
* a map from integer d2 -> int set
|
||||
*
|
||||
* for fact d2, zeroPaths[d2] gives the set of block numbers N s.t. for n \in N, <s_p, 0> -> <n, d2> is a path edge.
|
||||
*/
|
||||
private final SparseVector<IntSet> zeroPaths = new SparseVector<IntSet>(1, 1.1f);
|
||||
private final SparseVector<IntSet> zeroPaths = new SparseVector<>(1, 1.1f);
|
||||
|
||||
/**
|
||||
* @param fastMerge if true, the representation uses extra space in order to support faster merge operations
|
||||
*/
|
||||
public LocalPathEdges(boolean fastMerge) {
|
||||
altPaths = fastMerge ? new SparseVector<IBinaryNaturalRelation>(1, 1.1f) : null;
|
||||
altPaths = fastMerge ? new SparseVector<>(1, 1.1f) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,7 +39,7 @@ public class LocalSummaryEdges {
|
|||
*
|
||||
* TODO: more representation optimization.
|
||||
*/
|
||||
private final SparseVector<IBinaryNaturalRelation> summaries = new SparseVector<IBinaryNaturalRelation>(1, 1.1f);
|
||||
private final SparseVector<IBinaryNaturalRelation> summaries = new SparseVector<>(1, 1.1f);
|
||||
|
||||
/**
|
||||
* Let (s_p,x) be an entry-exit pair, and let l := the long whose high word is s_p and low word is x.
|
||||
|
|
|
@ -31,7 +31,7 @@ public class PartiallyBalancedTabulationSolver<T, P, F> extends TabulationSolver
|
|||
|
||||
public static <T, P, F> PartiallyBalancedTabulationSolver<T, P, F> createPartiallyBalancedTabulationSolver(
|
||||
PartiallyBalancedTabulationProblem<T, P, F> p, IProgressMonitor monitor) {
|
||||
return new PartiallyBalancedTabulationSolver<T, P, F>(p, monitor);
|
||||
return new PartiallyBalancedTabulationSolver<>(p, monitor);
|
||||
}
|
||||
|
||||
private final Collection<Pair<T,Integer>> unbalancedSeeds = HashSetFactory.make();
|
||||
|
|
|
@ -30,7 +30,7 @@ public final class PathEdge<T> {
|
|||
if (n == null) {
|
||||
throw new IllegalArgumentException("null n");
|
||||
}
|
||||
return new PathEdge<T>(s_p, d1, n, d2);
|
||||
return new PathEdge<>(s_p, d1, n, d2);
|
||||
}
|
||||
|
||||
private PathEdge(T s_p, int d1, T n, int d2) {
|
||||
|
|
|
@ -191,7 +191,7 @@ public class TabulationSolver<T, P, F> {
|
|||
* @throws IllegalArgumentException if p is null
|
||||
*/
|
||||
public static <T, P, F> TabulationSolver<T, P, F> make(TabulationProblem<T, P, F> p) {
|
||||
return new TabulationSolver<T, P, F>(p, null);
|
||||
return new TabulationSolver<>(p, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -911,7 +911,7 @@ public class TabulationSolver<T, P, F> {
|
|||
public String toString() {
|
||||
|
||||
StringBuffer result = new StringBuffer();
|
||||
TreeMap<Object, TreeSet<T>> map = new TreeMap<Object, TreeSet<T>>(ToStringComparator.instance());
|
||||
TreeMap<Object, TreeSet<T>> map = new TreeMap<>(ToStringComparator.instance());
|
||||
|
||||
Comparator<Object> c = (o1, o2) -> {
|
||||
if (!(o1 instanceof IBasicBlock)) {
|
||||
|
@ -925,7 +925,7 @@ public class TabulationSolver<T, P, F> {
|
|||
P proc = supergraph.getProcOf(n);
|
||||
TreeSet<T> s = map.get(proc);
|
||||
if (s == null) {
|
||||
s = new TreeSet<T>(c);
|
||||
s = new TreeSet<>(c);
|
||||
map.put(proc, s);
|
||||
}
|
||||
s.add(n);
|
||||
|
|
|
@ -768,17 +768,17 @@ public class DemandRefinementPointsTo extends AbstractDemandPointsTo {
|
|||
/**
|
||||
* forward worklist: for initially processing points-to queries
|
||||
*/
|
||||
private final Collection<PointerKeyAndState> initWorklist = new LinkedHashSet<PointerKeyAndState>();
|
||||
private final Collection<PointerKeyAndState> initWorklist = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
* worklist for variables whose points-to set has been updated
|
||||
*/
|
||||
private final Collection<PointerKeyAndState> pointsToWorklist = new LinkedHashSet<PointerKeyAndState>();
|
||||
private final Collection<PointerKeyAndState> pointsToWorklist = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
* worklist for variables whose tracked points-to set has been updated
|
||||
*/
|
||||
private final Collection<PointerKeyAndState> trackedPointsToWorklist = new LinkedHashSet<PointerKeyAndState>();
|
||||
private final Collection<PointerKeyAndState> trackedPointsToWorklist = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
* maps a pointer key to those on-the-fly virtual calls for which it is the receiver
|
||||
|
@ -843,7 +843,7 @@ public class DemandRefinementPointsTo extends AbstractDemandPointsTo {
|
|||
private OrdinalSet<InstanceKeyAndState> makeOrdinalSet(IntSet intSet) {
|
||||
// make a copy here, to avoid comodification during iteration
|
||||
// TODO remove the copying, do it only at necessary call sites
|
||||
return new OrdinalSet<InstanceKeyAndState>(intSetFactory.makeCopy(intSet), ikAndStates);
|
||||
return new OrdinalSet<>(intSetFactory.makeCopy(intSet), ikAndStates);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1974,7 +1974,7 @@ public class DemandRefinementPointsTo extends AbstractDemandPointsTo {
|
|||
private boolean doTopLevelTraversal(PointerKey pk, final Predicate<InstanceKey> pred, final PointsToComputer ptoComputer,
|
||||
PointerAnalysis<InstanceKey> pa) {
|
||||
final Set<PointerKeyAndState> visited = HashSetFactory.make();
|
||||
final LinkedList<PointerKeyAndState> worklist = new LinkedList<PointerKeyAndState>();
|
||||
final LinkedList<PointerKeyAndState> worklist = new LinkedList<>();
|
||||
|
||||
class Helper {
|
||||
|
||||
|
@ -2385,7 +2385,7 @@ public class DemandRefinementPointsTo extends AbstractDemandPointsTo {
|
|||
// here we compute the number of unique *method* targets, as opposed to call graph nodes.
|
||||
// if we have a context-sensitive call graph, with many targets representing clones of
|
||||
// the same method, we don't want to count the clones twice
|
||||
Set<IMethod> methodTargets = new HashSet<IMethod>();
|
||||
Set<IMethod> methodTargets = new HashSet<>();
|
||||
for (CGNode node : possibleTargets) {
|
||||
methodTargets.add(node.getMethod());
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class SimpleDemandPointsTo extends AbstractDemandPointsTo {
|
|||
System.err.println(g.toString());
|
||||
}
|
||||
|
||||
SlowDFSDiscoverTimeIterator<Object> dfs = new SlowDFSDiscoverTimeIterator<Object>(g, pk);
|
||||
SlowDFSDiscoverTimeIterator<Object> dfs = new SlowDFSDiscoverTimeIterator<>(g, pk);
|
||||
Collection<InstanceKey> keys = HashSetFactory.make();
|
||||
while (dfs.hasNext()) {
|
||||
Object o = dfs.next();
|
||||
|
|
|
@ -50,7 +50,7 @@ public class DummyStateMachine<T> implements StateMachine<T> {
|
|||
|
||||
@Override
|
||||
public StateMachine<T> make() {
|
||||
return new DummyStateMachine<T>();
|
||||
return new DummyStateMachine<>();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ public abstract class AbstractDemandFlowGraph extends AbstractFlowGraph {
|
|||
return EmptyIterator.instance();
|
||||
}
|
||||
int paramPos = pk.getValueNumber() - 1;
|
||||
ArrayList<PointerKeyAndCallSite> paramSuccs = new ArrayList<PointerKeyAndCallSite>();
|
||||
ArrayList<PointerKeyAndCallSite> paramSuccs = new ArrayList<>();
|
||||
// iterate over callers
|
||||
for (CGNode caller : cg) {
|
||||
// TODO optimization: we don't need to add the graph if null is passed
|
||||
|
@ -155,7 +155,7 @@ public abstract class AbstractDemandFlowGraph extends AbstractFlowGraph {
|
|||
if (instrs == null) {
|
||||
return EmptyIterator.instance();
|
||||
}
|
||||
ArrayList<PointerKeyAndCallSite> paramPreds = new ArrayList<PointerKeyAndCallSite>();
|
||||
ArrayList<PointerKeyAndCallSite> paramPreds = new ArrayList<>();
|
||||
for (SSAAbstractInvokeInstruction callInstr : instrs) {
|
||||
for (int i = 0; i < callInstr.getNumberOfUses(); i++) {
|
||||
if (pk.getValueNumber() != callInstr.getUse(i))
|
||||
|
@ -185,7 +185,7 @@ public abstract class AbstractDemandFlowGraph extends AbstractFlowGraph {
|
|||
SSAAbstractInvokeInstruction callInstr = callDefs.get(pk);
|
||||
if (callInstr == null)
|
||||
return EmptyIterator.instance();
|
||||
ArrayList<PointerKeyAndCallSite> returnSuccs = new ArrayList<PointerKeyAndCallSite>();
|
||||
ArrayList<PointerKeyAndCallSite> returnSuccs = new ArrayList<>();
|
||||
boolean isExceptional = pk.getValueNumber() == callInstr.getException();
|
||||
|
||||
CallSiteReference callSiteRef = callInstr.getCallSite();
|
||||
|
@ -212,7 +212,7 @@ public abstract class AbstractDemandFlowGraph extends AbstractFlowGraph {
|
|||
return EmptyIterator.instance();
|
||||
}
|
||||
boolean isExceptional = pk == heapModel.getPointerKeyForExceptionalReturnValue(cgNode);
|
||||
ArrayList<PointerKeyAndCallSite> returnPreds = new ArrayList<PointerKeyAndCallSite>();
|
||||
ArrayList<PointerKeyAndCallSite> returnPreds = new ArrayList<>();
|
||||
// iterate over callers
|
||||
for (CGNode caller : cg) {
|
||||
// TODO we don't need to add the graph if null is passed
|
||||
|
|
|
@ -271,7 +271,7 @@ public abstract class AbstractFlowGraph extends SlowSparseNumberedLabeledGraph<O
|
|||
for (MemoryAccess a : writes) {
|
||||
addSubgraphForNode(a.getNode());
|
||||
}
|
||||
ArrayList<PointerKey> written = new ArrayList<PointerKey>();
|
||||
ArrayList<PointerKey> written = new ArrayList<>();
|
||||
for (MemoryAccess a : writes) {
|
||||
IR ir = a.getNode().getIR();
|
||||
SSAPutInstruction s = (SSAPutInstruction) ir.getInstructions()[a.getInstructionIndex()];
|
||||
|
@ -332,7 +332,7 @@ public abstract class AbstractFlowGraph extends SlowSparseNumberedLabeledGraph<O
|
|||
for (MemoryAccess a : reads) {
|
||||
addSubgraphForNode(a.getNode());
|
||||
}
|
||||
ArrayList<PointerKey> readInto = new ArrayList<PointerKey>();
|
||||
ArrayList<PointerKey> readInto = new ArrayList<>();
|
||||
for (MemoryAccess a : reads) {
|
||||
IR ir = a.getNode().getIR();
|
||||
SSAGetInstruction s = (SSAGetInstruction) ir.getInstructions()[a.getInstructionIndex()];
|
||||
|
@ -355,7 +355,7 @@ public abstract class AbstractFlowGraph extends SlowSparseNumberedLabeledGraph<O
|
|||
for (MemoryAccess a : arrayWrites) {
|
||||
addSubgraphForNode(a.getNode());
|
||||
}
|
||||
ArrayList<PointerKey> written = new ArrayList<PointerKey>();
|
||||
ArrayList<PointerKey> written = new ArrayList<>();
|
||||
for (MemoryAccess a : arrayWrites) {
|
||||
final CGNode node = a.getNode();
|
||||
IR ir = node.getIR();
|
||||
|
@ -388,7 +388,7 @@ public abstract class AbstractFlowGraph extends SlowSparseNumberedLabeledGraph<O
|
|||
for (MemoryAccess a : arrayReads) {
|
||||
addSubgraphForNode(a.getNode());
|
||||
}
|
||||
ArrayList<PointerKey> read = new ArrayList<PointerKey>();
|
||||
ArrayList<PointerKey> read = new ArrayList<>();
|
||||
for (MemoryAccess a : arrayReads) {
|
||||
IR ir = a.getNode().getIR();
|
||||
SSAArrayLoadInstruction s = (SSAArrayLoadInstruction) ir.getInstructions()[a.getInstructionIndex()];
|
||||
|
|
|
@ -52,7 +52,7 @@ public class PABasedMemoryAccessMap implements MemoryAccessMap {
|
|||
private final Map<PointerKey, Set<Statement>> invRef;
|
||||
|
||||
public PABasedMemoryAccessMap(CallGraph cg, PointerAnalysis<InstanceKey> pa) {
|
||||
this(pa, new SDG<InstanceKey>(cg, pa, DataDependenceOptions.NO_BASE_NO_HEAP_NO_EXCEPTIONS, ControlDependenceOptions.NONE));
|
||||
this(pa, new SDG<>(cg, pa, DataDependenceOptions.NO_BASE_NO_HEAP_NO_EXCEPTIONS, ControlDependenceOptions.NONE));
|
||||
}
|
||||
|
||||
public PABasedMemoryAccessMap(PointerAnalysis<InstanceKey> pa, SDG<InstanceKey> sdg) {
|
||||
|
@ -71,7 +71,7 @@ public class PABasedMemoryAccessMap implements MemoryAccessMap {
|
|||
|
||||
@Override
|
||||
public Collection<MemoryAccess> getArrayReads(PointerKey arrayRef) {
|
||||
Collection<MemoryAccess> memAccesses = new ArrayList<MemoryAccess>();
|
||||
Collection<MemoryAccess> memAccesses = new ArrayList<>();
|
||||
if (DEBUG) {
|
||||
System.err.println(("looking at reads of array ref " + arrayRef));
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class PABasedMemoryAccessMap implements MemoryAccessMap {
|
|||
|
||||
@Override
|
||||
public Collection<MemoryAccess> getArrayWrites(PointerKey arrayRef) {
|
||||
Collection<MemoryAccess> memAccesses = new ArrayList<MemoryAccess>();
|
||||
Collection<MemoryAccess> memAccesses = new ArrayList<>();
|
||||
if (DEBUG) {
|
||||
System.err.println(("looking at writes to array ref " + arrayRef));
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class PABasedMemoryAccessMap implements MemoryAccessMap {
|
|||
|
||||
@Override
|
||||
public Collection<MemoryAccess> getFieldReads(PointerKey baseRef, IField field) {
|
||||
Collection<MemoryAccess> memAccesses = new ArrayList<MemoryAccess>();
|
||||
Collection<MemoryAccess> memAccesses = new ArrayList<>();
|
||||
for (InstanceKey ik : pa.getPointsToSet(baseRef)) {
|
||||
PointerKey ifk = heapModel.getPointerKeyForInstanceField(ik, field);
|
||||
convertStmtsToMemoryAccess(invRef.get(ifk), memAccesses);
|
||||
|
@ -110,7 +110,7 @@ public class PABasedMemoryAccessMap implements MemoryAccessMap {
|
|||
|
||||
@Override
|
||||
public Collection<MemoryAccess> getFieldWrites(PointerKey baseRef, IField field) {
|
||||
Collection<MemoryAccess> memAccesses = new ArrayList<MemoryAccess>();
|
||||
Collection<MemoryAccess> memAccesses = new ArrayList<>();
|
||||
for (InstanceKey ik : pa.getPointsToSet(baseRef)) {
|
||||
PointerKey ifk = heapModel.getPointerKeyForInstanceField(ik, field);
|
||||
convertStmtsToMemoryAccess(invMod.get(ifk), memAccesses);
|
||||
|
@ -120,14 +120,14 @@ public class PABasedMemoryAccessMap implements MemoryAccessMap {
|
|||
|
||||
@Override
|
||||
public Collection<MemoryAccess> getStaticFieldReads(IField field) {
|
||||
Collection<MemoryAccess> result = new ArrayList<MemoryAccess>();
|
||||
Collection<MemoryAccess> result = new ArrayList<>();
|
||||
convertStmtsToMemoryAccess(invRef.get(heapModel.getPointerKeyForStaticField(field)), result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<MemoryAccess> getStaticFieldWrites(IField field) {
|
||||
Collection<MemoryAccess> result = new ArrayList<MemoryAccess>();
|
||||
Collection<MemoryAccess> result = new ArrayList<>();
|
||||
convertStmtsToMemoryAccess(invMod.get(heapModel.getPointerKeyForStaticField(field)), result);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -437,7 +437,7 @@ public class SimpleMemoryAccessMap implements MemoryAccessMap {
|
|||
}
|
||||
|
||||
public void repOk() {
|
||||
for (MemoryAccess m : Iterator2Iterable.make(new CompoundIterator<MemoryAccess>(arrayReads.iterator(), arrayWrites.iterator()))) {
|
||||
for (MemoryAccess m : Iterator2Iterable.make(new CompoundIterator<>(arrayReads.iterator(), arrayWrites.iterator()))) {
|
||||
CGNode node = m.getNode();
|
||||
IR ir = node.getIR();
|
||||
assert ir != null : "null IR for " + node + " but we have a memory access";
|
||||
|
|
|
@ -118,7 +118,7 @@ public class AnalysisScope {
|
|||
*/
|
||||
private SetOfClasses exclusions;
|
||||
|
||||
final protected LinkedHashMap<Atom, ClassLoaderReference> loadersByName = new LinkedHashMap<Atom, ClassLoaderReference>();
|
||||
final protected LinkedHashMap<Atom, ClassLoaderReference> loadersByName = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Special class loader for array instances
|
||||
|
@ -131,7 +131,7 @@ public class AnalysisScope {
|
|||
|
||||
protected AnalysisScope(Collection<? extends Language> languages) {
|
||||
super();
|
||||
this.languages = new HashMap<Atom, Language>();
|
||||
this.languages = new HashMap<>();
|
||||
for (Language l : languages) {
|
||||
this.languages.put(l.getName(), l);
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ public class AnalysisScope {
|
|||
private JarFile getRtJar() {
|
||||
return RtJar.getRtJar(
|
||||
new MapIterator<Module,JarFile>(
|
||||
new FilterIterator<Module>(getModules(getPrimordialLoader()).iterator(), JarFileModule.class::isInstance), M -> ((JarFileModule) M).getJarFile()));
|
||||
new FilterIterator<>(getModules(getPrimordialLoader()).iterator(), JarFileModule.class::isInstance), M -> ((JarFileModule) M).getJarFile()));
|
||||
}
|
||||
|
||||
public String getJavaLibraryVersion() throws IllegalStateException {
|
||||
|
@ -434,7 +434,7 @@ public class AnalysisScope {
|
|||
// Note: 'arrayClassLoader' object will be built from scratch in remote process
|
||||
|
||||
// represent modules map as a set of strings (corresponding to analysis scope file lines.
|
||||
List<String> moduleLines = new ArrayList<String>();
|
||||
List<String> moduleLines = new ArrayList<>();
|
||||
for (Map.Entry<ClassLoaderReference, List<Module>> e : moduleMap.entrySet()) {
|
||||
ClassLoaderReference lrReference = e.getKey();
|
||||
String moduleLdr = lrReference.getName().toString();
|
||||
|
@ -467,7 +467,7 @@ public class AnalysisScope {
|
|||
}
|
||||
|
||||
// represent loaderImplByRef map as set of strings
|
||||
List<String> ldrImplLines = new ArrayList<String>();
|
||||
List<String> ldrImplLines = new ArrayList<>();
|
||||
for (Map.Entry<ClassLoaderReference, String> e : loaderImplByRef.entrySet()) {
|
||||
ClassLoaderReference lrReference = e.getKey();
|
||||
String ldrName = lrReference.getName().toString();
|
||||
|
|
|
@ -41,13 +41,13 @@ public class CallGraphTransitiveClosure {
|
|||
public static <T> Map<CGNode, OrdinalSet<T>> transitiveClosure(CallGraph cg, Map<CGNode, Collection<T>> nodeResults) {
|
||||
try {
|
||||
// invert the call graph, to compute the bottom-up result
|
||||
GenReach<CGNode, T> gr = new GenReach<CGNode, T>(GraphInverter.invert(cg), nodeResults);
|
||||
BitVectorSolver<CGNode> solver = new BitVectorSolver<CGNode>(gr);
|
||||
GenReach<CGNode, T> gr = new GenReach<>(GraphInverter.invert(cg), nodeResults);
|
||||
BitVectorSolver<CGNode> solver = new BitVectorSolver<>(gr);
|
||||
solver.solve(null);
|
||||
Map<CGNode, OrdinalSet<T>> result = HashMapFactory.make();
|
||||
for (CGNode n : cg) {
|
||||
BitVectorVariable bv = solver.getOut(n);
|
||||
result.put(n, new OrdinalSet<T>(bv.getValue(), gr.getLatticeValues()));
|
||||
result.put(n, new OrdinalSet<>(bv.getValue(), gr.getLatticeValues()));
|
||||
}
|
||||
return result;
|
||||
} catch (CancelException e) {
|
||||
|
|
|
@ -28,7 +28,7 @@ public interface ContextItem {
|
|||
}
|
||||
|
||||
public static <T> Value make(T v) {
|
||||
return new Value<T>(v);
|
||||
return new Value<>(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -160,7 +160,7 @@ public class CHACallGraph extends BasicCallGraph<CHAContextInterpreter> {
|
|||
public Set<CGNode> getPossibleTargets(CGNode node, CallSiteReference site) {
|
||||
return Iterator2Collection.toSet(
|
||||
new MapIterator<IMethod,CGNode>(
|
||||
new FilterIterator<IMethod>(
|
||||
new FilterIterator<>(
|
||||
getPossibleTargets(site),
|
||||
this::isRelevantMethod
|
||||
),
|
||||
|
@ -182,7 +182,7 @@ public class CHACallGraph extends BasicCallGraph<CHAContextInterpreter> {
|
|||
@Override
|
||||
public Iterator<CallSiteReference> getPossibleSites(final CGNode src, final CGNode target) {
|
||||
return
|
||||
new FilterIterator<CallSiteReference>(getInterpreter(src).iterateCallSites(src),
|
||||
new FilterIterator<>(getInterpreter(src).iterateCallSites(src),
|
||||
o -> getPossibleTargets(src, o).contains(target));
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ public class CHACallGraph extends BasicCallGraph<CHAContextInterpreter> {
|
|||
return n;
|
||||
}
|
||||
|
||||
private Stack<CGNode> newNodes = new Stack<CGNode>();
|
||||
private Stack<CGNode> newNodes = new Stack<>();
|
||||
|
||||
private void closure() throws CancelException {
|
||||
while (! newNodes.isEmpty()) {
|
||||
|
@ -290,7 +290,7 @@ public class CHACallGraph extends BasicCallGraph<CHAContextInterpreter> {
|
|||
preds.add(node);
|
||||
}
|
||||
}
|
||||
predecessors.put(n, new SoftReference<Set<CGNode>>(preds));
|
||||
predecessors.put(n, new SoftReference<>(preds));
|
||||
return preds;
|
||||
}
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ public class CHACallGraph extends BasicCallGraph<CHAContextInterpreter> {
|
|||
|
||||
@Override
|
||||
public Iterator<CGNode> getSuccNodes(final CGNode n) {
|
||||
return new FilterIterator<CGNode>(new ComposedIterator<CallSiteReference, CGNode>(n.iterateCallSites()) {
|
||||
return new FilterIterator<>(new ComposedIterator<CallSiteReference, CGNode>(n.iterateCallSites()) {
|
||||
@Override
|
||||
public Iterator<? extends CGNode> makeInner(CallSiteReference outer) {
|
||||
return getPossibleTargets(n, outer).iterator();
|
||||
|
|
|
@ -54,7 +54,7 @@ import com.ibm.wala.util.warnings.Warnings;
|
|||
*/
|
||||
public abstract class AbstractRootMethod extends SyntheticMethod {
|
||||
|
||||
final protected ArrayList<SSAInstruction> statements = new ArrayList<SSAInstruction>();
|
||||
final protected ArrayList<SSAInstruction> statements = new ArrayList<>();
|
||||
|
||||
private Map<ConstantValue, Integer> constant2ValueNumber = HashMapFactory.make();
|
||||
|
||||
|
@ -361,7 +361,7 @@ public abstract class AbstractRootMethod extends SyntheticMethod {
|
|||
|
||||
@Override
|
||||
public Iterator<NewSiteReference> iterateNewSites(CGNode node) {
|
||||
ArrayList<NewSiteReference> result = new ArrayList<NewSiteReference>();
|
||||
ArrayList<NewSiteReference> result = new ArrayList<>();
|
||||
SSAInstruction[] statements = getStatements(options.getSSAOptions());
|
||||
for (SSAInstruction statement : statements) {
|
||||
if (statement instanceof SSANewInstruction) {
|
||||
|
@ -373,7 +373,7 @@ public abstract class AbstractRootMethod extends SyntheticMethod {
|
|||
}
|
||||
|
||||
public Iterator<SSAInstruction> getInvokeStatements() {
|
||||
ArrayList<SSAInstruction> result = new ArrayList<SSAInstruction>();
|
||||
ArrayList<SSAInstruction> result = new ArrayList<>();
|
||||
SSAInstruction[] statements = getStatements(options.getSSAOptions());
|
||||
for (SSAInstruction statement : statements) {
|
||||
if (statement instanceof SSAInvokeInstruction) {
|
||||
|
|
|
@ -45,7 +45,7 @@ public abstract class BasicCallGraph<T> extends AbstractNumberedGraph<CGNode> im
|
|||
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private final DelegatingNumberedNodeManager<CGNode> nodeManager = new DelegatingNumberedNodeManager<CGNode>();
|
||||
private final DelegatingNumberedNodeManager<CGNode> nodeManager = new DelegatingNumberedNodeManager<>();
|
||||
|
||||
/**
|
||||
* A fake root node for the graph
|
||||
|
@ -231,7 +231,7 @@ public abstract class BasicCallGraph<T> extends AbstractNumberedGraph<CGNode> im
|
|||
@Override
|
||||
public String toString() {
|
||||
StringBuffer result = new StringBuffer("");
|
||||
for (Iterator<CGNode> i = DFS.iterateDiscoverTime(this, new NonNullSingletonIterator<CGNode>(getFakeRootNode())); i.hasNext();) {
|
||||
for (Iterator<CGNode> i = DFS.iterateDiscoverTime(this, new NonNullSingletonIterator<>(getFakeRootNode())); i.hasNext();) {
|
||||
CGNode n = i.next();
|
||||
result.append(nodeToString(this, n) + "\n");
|
||||
}
|
||||
|
|
|
@ -137,12 +137,12 @@ public class ExplicitCallGraph extends BasicCallGraph<SSAContextInterpreter> imp
|
|||
* A Mapping from call site program counter (int) -> Object, where Object is a CGNode if we've discovered exactly one target for
|
||||
* the site, or an IntSet of node numbers if we've discovered more than one target for the site.
|
||||
*/
|
||||
protected final SparseVector<Object> targets = new SparseVector<Object>();
|
||||
protected final SparseVector<Object> targets = new SparseVector<>();
|
||||
|
||||
private final MutableSharedBitVectorIntSet allTargets = new MutableSharedBitVectorIntSet();
|
||||
|
||||
private WeakReference<IR> ir = new WeakReference<IR>(null);
|
||||
private WeakReference<DefUse> du = new WeakReference<DefUse>(null);
|
||||
private WeakReference<IR> ir = new WeakReference<>(null);
|
||||
private WeakReference<DefUse> du = new WeakReference<>(null);
|
||||
|
||||
/**
|
||||
* @param method
|
||||
|
@ -186,7 +186,7 @@ public class ExplicitCallGraph extends BasicCallGraph<SSAContextInterpreter> imp
|
|||
*/
|
||||
protected Iterator<CallSiteReference> getPossibleSites(final CGNode to) {
|
||||
final int n = getCallGraph().getNumber(to);
|
||||
return new FilterIterator<CallSiteReference>(iterateCallSites(), o -> {
|
||||
return new FilterIterator<>(iterateCallSites(), o -> {
|
||||
IntSet s = getPossibleTargetNumbers(o);
|
||||
return s == null ? false : s.contains(n);
|
||||
});
|
||||
|
@ -304,7 +304,7 @@ public class ExplicitCallGraph extends BasicCallGraph<SSAContextInterpreter> imp
|
|||
IR ir = this.ir.get();
|
||||
if (ir == null) {
|
||||
ir = getCallGraph().getInterpreter(this).getIR(this);
|
||||
this.ir = new WeakReference<IR>(ir);
|
||||
this.ir = new WeakReference<>(ir);
|
||||
}
|
||||
return ir;
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ public class ExplicitCallGraph extends BasicCallGraph<SSAContextInterpreter> imp
|
|||
DefUse du = this.du.get();
|
||||
if (du == null) {
|
||||
du = getCallGraph().getInterpreter(this).getDU(this);
|
||||
this.du = new WeakReference<DefUse>(du);
|
||||
this.du = new WeakReference<>(du);
|
||||
}
|
||||
return du;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ public class ExplicitCallGraph extends BasicCallGraph<SSAContextInterpreter> imp
|
|||
if (s == null) {
|
||||
return EmptyIterator.instance();
|
||||
} else {
|
||||
return new IntMapIterator<CGNode>(s.intIterator(), toNode);
|
||||
return new IntMapIterator<>(s.intIterator(), toNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -400,7 +400,7 @@ public class ExplicitCallGraph extends BasicCallGraph<SSAContextInterpreter> imp
|
|||
@Override
|
||||
public Iterator<CGNode> getSuccNodes(CGNode N) {
|
||||
ExplicitNode n = (ExplicitNode) N;
|
||||
return new IntMapIterator<CGNode>(n.getAllTargetNumbers().intIterator(), toNode);
|
||||
return new IntMapIterator<>(n.getAllTargetNumbers().intIterator(), toNode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -112,7 +112,7 @@ public class PartialCallGraph extends DelegatingGraph<CGNode> implements CallGra
|
|||
|
||||
@Override
|
||||
public Iterator<CGNode> iterateNodes(IntSet nodes) {
|
||||
return new FilterIterator<CGNode>(cg.iterateNodes(nodes), this::containsNode);
|
||||
return new FilterIterator<>(cg.iterateNodes(nodes), this::containsNode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,7 +46,7 @@ public abstract class AbstractPointerAnalysis implements PointerAnalysis<Instanc
|
|||
@Override
|
||||
public HeapGraph<InstanceKey> getHeapGraph() {
|
||||
if (heapGraph == null) {
|
||||
heapGraph = new BasicHeapGraph<InstanceKey>(this, cg);
|
||||
heapGraph = new BasicHeapGraph<>(this, cg);
|
||||
}
|
||||
return heapGraph;
|
||||
}
|
||||
|
|
|
@ -91,8 +91,8 @@ public class AllocationSite implements InstanceKey {
|
|||
|
||||
@Override
|
||||
public Iterator<Pair<CGNode, NewSiteReference>> getCreationSites(CallGraph CG) {
|
||||
return new MapIterator<CGNode, Pair<CGNode, NewSiteReference>>(
|
||||
new FilterIterator<CGNode>(
|
||||
return new MapIterator<>(
|
||||
new FilterIterator<>(
|
||||
CG.getNodes(method.getReference()).iterator(),
|
||||
o -> o.getMethod().equals(method)
|
||||
),
|
||||
|
|
|
@ -50,7 +50,7 @@ public abstract class AllocationSiteInNode extends AbstractTypeInNode {
|
|||
|
||||
@Override
|
||||
public Iterator<Pair<CGNode, NewSiteReference>> getCreationSites(CallGraph CG) {
|
||||
return new NonNullSingletonIterator<Pair<CGNode, NewSiteReference>>(Pair.make(getNode(), getSite()));
|
||||
return new NonNullSingletonIterator<>(Pair.make(getNode(), getSite()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ public class AllocationSiteInNodeFactory implements InstanceKeyFactory {
|
|||
@Override
|
||||
public <T> InstanceKey getInstanceKeyForConstant(TypeReference type, T S) {
|
||||
if (options.getUseConstantSpecificKeys()) {
|
||||
return new ConstantKey<T>(S, cha.lookupClass(type));
|
||||
return new ConstantKey<>(S, cha.lookupClass(type));
|
||||
} else {
|
||||
return new ConcreteTypeKey(cha.lookupClass(type));
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class ClassBasedInstanceKeys implements InstanceKeyFactory {
|
|||
return null;
|
||||
} else {
|
||||
if (options.getUseConstantSpecificKeys()) {
|
||||
return new ConstantKey<T>(S, cha.lookupClass(type));
|
||||
return new ConstantKey<>(S, cha.lookupClass(type));
|
||||
} else {
|
||||
return new ConcreteTypeKey(cha.lookupClass(type));
|
||||
}
|
||||
|
@ -136,17 +136,17 @@ public class ClassBasedInstanceKeys implements InstanceKeyFactory {
|
|||
return new ConcreteTypeKey(cls);
|
||||
} else {
|
||||
// return the IClass itself, wrapped as a constant!
|
||||
return new ConstantKey<IClass>(klass, cls);
|
||||
return new ConstantKey<>(klass, cls);
|
||||
}
|
||||
} else if (obj instanceof MethodReference) {
|
||||
IMethod m = cha.resolveMethod((MethodReference)obj);
|
||||
if (m == null) {
|
||||
return new ConcreteTypeKey(cls);
|
||||
} else {
|
||||
return new ConstantKey<IMethod>(m, cls);
|
||||
return new ConstantKey<>(m, cls);
|
||||
}
|
||||
} else if (obj instanceof Descriptor) {
|
||||
return new ConstantKey<Descriptor>((Descriptor)obj, cls);
|
||||
return new ConstantKey<>((Descriptor)obj, cls);
|
||||
} else {
|
||||
// other cases
|
||||
throw new Error();
|
||||
|
|
|
@ -104,8 +104,8 @@ public final class ConcreteTypeKey implements InstanceKey {
|
|||
return new ComposedIterator<CGNode, Pair<CGNode, NewSiteReference>>(CG.iterator()) {
|
||||
@Override
|
||||
public Iterator<? extends Pair<CGNode, NewSiteReference>> makeInner(final CGNode outer) {
|
||||
return new MapIterator<NewSiteReference, Pair<CGNode, NewSiteReference>>(
|
||||
new FilterIterator<NewSiteReference>(
|
||||
return new MapIterator<>(
|
||||
new FilterIterator<>(
|
||||
outer.iterateNewSites(),
|
||||
o -> o.getDeclaredType().equals(type.getReference())
|
||||
),
|
||||
|
|
|
@ -135,7 +135,7 @@ public class PointerAnalysisImpl extends AbstractPointerAnalysis {
|
|||
return OrdinalSet.empty();
|
||||
} else {
|
||||
IntSet S = v.getValue();
|
||||
return new OrdinalSet<InstanceKey>(S, instanceKeys);
|
||||
return new OrdinalSet<>(S, instanceKeys);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ public class PointerAnalysisImpl extends AbstractPointerAnalysis {
|
|||
}
|
||||
}
|
||||
}
|
||||
return new OrdinalSet<InstanceKey>(S, instanceKeys);
|
||||
return new OrdinalSet<>(S, instanceKeys);
|
||||
}
|
||||
|
||||
private OrdinalSet<InstanceKey> computeImplicitPointsToSetAtPhi(CGNode node, SSAPhiInstruction instruction) {
|
||||
|
@ -277,7 +277,7 @@ public class PointerAnalysisImpl extends AbstractPointerAnalysis {
|
|||
}
|
||||
}
|
||||
}
|
||||
return new OrdinalSet<InstanceKey>(S, instanceKeys);
|
||||
return new OrdinalSet<>(S, instanceKeys);
|
||||
}
|
||||
|
||||
private OrdinalSet<InstanceKey> computeImplicitPointsToSetAtALoad(CGNode node, SSAArrayLoadInstruction instruction) {
|
||||
|
@ -292,7 +292,7 @@ public class PointerAnalysisImpl extends AbstractPointerAnalysis {
|
|||
S.addAll(set);
|
||||
}
|
||||
}
|
||||
return new OrdinalSet<InstanceKey>(S, instanceKeys);
|
||||
return new OrdinalSet<>(S, instanceKeys);
|
||||
}
|
||||
|
||||
private OrdinalSet<InstanceKey> computeImplicitPointsToSetAtGet(CGNode node, SSAGetInstruction instruction) {
|
||||
|
@ -321,7 +321,7 @@ public class PointerAnalysisImpl extends AbstractPointerAnalysis {
|
|||
}
|
||||
}
|
||||
}
|
||||
return new OrdinalSet<InstanceKey>(S, instanceKeys);
|
||||
return new OrdinalSet<>(S, instanceKeys);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ public class PointerAnalysisImpl extends AbstractPointerAnalysis {
|
|||
}
|
||||
}
|
||||
}
|
||||
return new OrdinalSet<InstanceKey>(S, instanceKeys);
|
||||
return new OrdinalSet<>(S, instanceKeys);
|
||||
}
|
||||
|
||||
private OrdinalSet<InstanceKey> computeImplicitPointsToSetAtCheckCast(CGNode node, SSACheckCastInstruction instruction) {
|
||||
|
@ -397,7 +397,7 @@ public class PointerAnalysisImpl extends AbstractPointerAnalysis {
|
|||
}
|
||||
}
|
||||
}
|
||||
return new OrdinalSet<InstanceKey>(S, instanceKeys);
|
||||
return new OrdinalSet<>(S, instanceKeys);
|
||||
}
|
||||
|
||||
private OrdinalSet<InstanceKey> computeImplicitPointsToSetAtCall(LocalPointerKey lpk, CGNode node, SSAInvokeInstruction call) {
|
||||
|
@ -420,7 +420,7 @@ public class PointerAnalysisImpl extends AbstractPointerAnalysis {
|
|||
assert index != -1 : "instance " + element + " not mapped!";
|
||||
}
|
||||
}
|
||||
return new OrdinalSet<InstanceKey>(s, instanceKeys);
|
||||
return new OrdinalSet<>(s, instanceKeys);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -435,7 +435,7 @@ public class PointerAnalysisImpl extends AbstractPointerAnalysis {
|
|||
S.addAll(set);
|
||||
}
|
||||
}
|
||||
return new OrdinalSet<InstanceKey>(S, instanceKeys);
|
||||
return new OrdinalSet<>(S, instanceKeys);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -41,7 +41,7 @@ public class PointsToMap {
|
|||
* <li>UNIFIED
|
||||
* </ul>
|
||||
*/
|
||||
private final IVector<Object> pointsToSets = new SimpleVector<Object>();
|
||||
private final IVector<Object> pointsToSets = new SimpleVector<>();
|
||||
|
||||
private final IntegerUnionFind uf = new IntegerUnionFind();
|
||||
|
||||
|
@ -200,7 +200,7 @@ public class PointsToMap {
|
|||
* @return {@link Iterator}<{@link PointerKey}>
|
||||
*/
|
||||
public Iterator<PointerKey> getTransitiveRoots() {
|
||||
return new FilterIterator<PointerKey>(iterateKeys(), this::isTransitiveRoot);
|
||||
return new FilterIterator<>(iterateKeys(), this::isTransitiveRoot);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,12 +56,12 @@ public class PropagationGraph implements IFixedPointSystem<PointsToSetVariable>
|
|||
/**
|
||||
* Track nodes (PointsToSet Variables and AbstractEquations)
|
||||
*/
|
||||
private final NumberedNodeManager<INodeWithNumber> nodeManager = new DelegatingNumberedNodeManager<INodeWithNumber>();
|
||||
private final NumberedNodeManager<INodeWithNumber> nodeManager = new DelegatingNumberedNodeManager<>();
|
||||
|
||||
/**
|
||||
* Track edges (equations) that are not represented implicitly
|
||||
*/
|
||||
private final NumberedEdgeManager<INodeWithNumber> edgeManager = new SparseNumberedEdgeManager<INodeWithNumber>(nodeManager, 2,
|
||||
private final NumberedEdgeManager<INodeWithNumber> edgeManager = new SparseNumberedEdgeManager<>(nodeManager, 2,
|
||||
BasicNaturalRelation.SIMPLE);
|
||||
|
||||
private final DelegateGraph delegateGraph = new DelegateGraph();
|
||||
|
@ -75,14 +75,14 @@ public class PropagationGraph implements IFixedPointSystem<PointsToSetVariable>
|
|||
* for UnaryOperator op, let R be implicitMap.get(op) then (i,j) \in R implies i op j is an equation in the graph
|
||||
*
|
||||
*/
|
||||
private final SmallMap<UnaryOperator<PointsToSetVariable>, IBinaryNaturalRelation> implicitUnaryMap = new SmallMap<UnaryOperator<PointsToSetVariable>, IBinaryNaturalRelation>();
|
||||
private final SmallMap<UnaryOperator<PointsToSetVariable>, IBinaryNaturalRelation> implicitUnaryMap = new SmallMap<>();
|
||||
|
||||
/**
|
||||
* The inverse of relations in the implicit map
|
||||
*
|
||||
* for UnaryOperator op, let R be invImplicitMap.get(op) then (i,j) \in R implies j op i is an equation in the graph
|
||||
*/
|
||||
private final SmallMap<UnaryOperator<PointsToSetVariable>, IBinaryNaturalRelation> invImplicitUnaryMap = new SmallMap<UnaryOperator<PointsToSetVariable>, IBinaryNaturalRelation>();
|
||||
private final SmallMap<UnaryOperator<PointsToSetVariable>, IBinaryNaturalRelation> invImplicitUnaryMap = new SmallMap<>();
|
||||
|
||||
/**
|
||||
* Number of implicit unary equations registered
|
||||
|
@ -271,7 +271,7 @@ public class PropagationGraph implements IFixedPointSystem<PointsToSetVariable>
|
|||
@Override
|
||||
public Iterator<AbstractStatement> getStatements() {
|
||||
Iterator<AbstractStatement> it = IteratorUtil.filter(delegateGraph.iterator(), AbstractStatement.class);
|
||||
return new CompoundIterator<AbstractStatement>(it, new GlobalImplicitIterator());
|
||||
return new CompoundIterator<>(it, new GlobalImplicitIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -668,10 +668,10 @@ public class PropagationGraph implements IFixedPointSystem<PointsToSetVariable>
|
|||
IBinaryNaturalRelation R = (IBinaryNaturalRelation) invImplicitUnaryMap.getValue(i);
|
||||
IntSet s = R.getRelated(number);
|
||||
if (s != null) {
|
||||
result = new CompoundIterator<INodeWithNumber>(new ImplicitUseIterator(op, v, s), result);
|
||||
result = new CompoundIterator<>(new ImplicitUseIterator(op, v, s), result);
|
||||
}
|
||||
}
|
||||
List<AbstractStatement> list = new ArrayList<AbstractStatement>();
|
||||
List<AbstractStatement> list = new ArrayList<>();
|
||||
while (result.hasNext()) {
|
||||
list.add((AbstractStatement) result.next());
|
||||
}
|
||||
|
@ -694,11 +694,11 @@ public class PropagationGraph implements IFixedPointSystem<PointsToSetVariable>
|
|||
IBinaryNaturalRelation R = (IBinaryNaturalRelation) implicitUnaryMap.getValue(i);
|
||||
IntSet s = R.getRelated(number);
|
||||
if (s != null) {
|
||||
result = new CompoundIterator<INodeWithNumber>(new ImplicitDefIterator(op, s, v), result);
|
||||
result = new CompoundIterator<>(new ImplicitDefIterator(op, s, v), result);
|
||||
}
|
||||
}
|
||||
|
||||
List<AbstractStatement> list = new ArrayList<AbstractStatement>();
|
||||
List<AbstractStatement> list = new ArrayList<>();
|
||||
while (result.hasNext()) {
|
||||
list.add((AbstractStatement) result.next());
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ public class PropagationSystem extends DefaultFixedPointSolver<PointsToSetVariab
|
|||
* @return an List of instance keys corresponding to the integers in a set
|
||||
*/
|
||||
List<InstanceKey> getInstances(IntSet set) {
|
||||
LinkedList<InstanceKey> result = new LinkedList<InstanceKey>();
|
||||
LinkedList<InstanceKey> result = new LinkedList<>();
|
||||
for (IntIterator it = set.intIterator(); it.hasNext();) {
|
||||
int j = it.next();
|
||||
result.add(getInstanceKey(j));
|
||||
|
|
|
@ -483,7 +483,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
|
|||
System.err.println("getIncomingPEIs " + bb);
|
||||
}
|
||||
ControlFlowGraph<SSAInstruction, ISSABasicBlock> g = ir.getControlFlowGraph();
|
||||
List<ProgramCounter> result = new ArrayList<ProgramCounter>(g.getPredNodeCount(bb));
|
||||
List<ProgramCounter> result = new ArrayList<>(g.getPredNodeCount(bb));
|
||||
for (Iterator<ISSABasicBlock> it = g.getPredNodes(bb); it.hasNext();) {
|
||||
BasicBlock pred = (BasicBlock) it.next();
|
||||
if (DEBUG) {
|
||||
|
@ -1167,7 +1167,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
|
|||
System.err.println("Add side effect, dispatch to " + instruction + " for " + params);
|
||||
}
|
||||
|
||||
final List<PointerKey> pks = new ArrayList<PointerKey>(params.size());
|
||||
final List<PointerKey> pks = new ArrayList<>(params.size());
|
||||
params.foreach(x -> {
|
||||
if (!contentsAreInvariant(symbolTable, du, instruction.getUse(x))) {
|
||||
pks.add(getBuilder().getPointerKeyForLocal(node, instruction.getUse(x)));
|
||||
|
|
|
@ -54,8 +54,8 @@ public class SmushedAllocationSiteInNode extends AbstractTypeInNode {
|
|||
|
||||
@Override
|
||||
public Iterator<Pair<CGNode, NewSiteReference>> getCreationSites(CallGraph CG) {
|
||||
return new MapIterator<NewSiteReference,Pair<CGNode, NewSiteReference>>(
|
||||
new FilterIterator<NewSiteReference>(
|
||||
return new MapIterator<>(
|
||||
new FilterIterator<>(
|
||||
getNode().iterateNewSites(),
|
||||
o -> o.getDeclaredType().equals(getConcreteType().getReference())),
|
||||
object -> Pair.make(getNode(), object));
|
||||
|
|
|
@ -83,7 +83,7 @@ public class SmushedAllocationSiteInstanceKeys implements InstanceKeyFactory {
|
|||
@Override
|
||||
public <T> InstanceKey getInstanceKeyForConstant(TypeReference type, T S) {
|
||||
if (options.getUseConstantSpecificKeys())
|
||||
return new ConstantKey<T>(S, cha.lookupClass(type));
|
||||
return new ConstantKey<>(S, cha.lookupClass(type));
|
||||
else
|
||||
return new ConcreteTypeKey(cha.lookupClass(type));
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ public class ZeroXInstanceKeys implements InstanceKeyFactory {
|
|||
throw new IllegalArgumentException("null type");
|
||||
}
|
||||
if (disambiguateConstants() || isReflectiveType(type)) {
|
||||
return new ConstantKey<T>(S, getClassHierarchy().lookupClass(type));
|
||||
return new ConstantKey<>(S, getClassHierarchy().lookupClass(type));
|
||||
} else {
|
||||
return classBased.getInstanceKeyForConstant(type, S);
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ public class TypeBasedPointerAnalysis extends AbstractPointerAnalysis {
|
|||
int index = getInstanceKeyMapping().add(new ConcreteTypeKey(klass));
|
||||
s.add(index);
|
||||
}
|
||||
return new OrdinalSet<InstanceKey>(s, getInstanceKeyMapping());
|
||||
return new OrdinalSet<>(s, getInstanceKeyMapping());
|
||||
}
|
||||
|
||||
private IClass inferType(PointerKey key) {
|
||||
|
|
|
@ -70,9 +70,9 @@ public final class CallGraphPruning {
|
|||
System.out.println("Running optimization with depth: " + depth);
|
||||
}
|
||||
|
||||
this.marked = new LinkedList<CGNode>();
|
||||
this.keep = new HashSet<CGNode>();
|
||||
this.visited = new LinkedList<CGNode>();
|
||||
this.marked = new LinkedList<>();
|
||||
this.keep = new HashSet<>();
|
||||
this.visited = new LinkedList<>();
|
||||
this.depth = depth;
|
||||
this.pruningPolicy = policy;
|
||||
|
||||
|
@ -107,8 +107,8 @@ public final class CallGraphPruning {
|
|||
|
||||
private void addDepth(CGNode node) {
|
||||
|
||||
LinkedList<CGNode> A = new LinkedList<CGNode>();
|
||||
LinkedList<CGNode> B = new LinkedList<CGNode>();
|
||||
LinkedList<CGNode> A = new LinkedList<>();
|
||||
LinkedList<CGNode> B = new LinkedList<>();
|
||||
int i = depth;
|
||||
A.add(node);
|
||||
while (i > 0) {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class PrunedCallGraph implements CallGraph {
|
|||
@Override
|
||||
public Iterator<CGNode> iterator() {
|
||||
Iterator<CGNode> tmp = cg.iterator();
|
||||
Collection<CGNode> col = new LinkedList<CGNode>();
|
||||
Collection<CGNode> col = new LinkedList<>();
|
||||
while (tmp.hasNext()) {
|
||||
CGNode n = tmp.next();
|
||||
if (keep.contains(n)) {
|
||||
|
@ -96,7 +96,7 @@ public class PrunedCallGraph implements CallGraph {
|
|||
@Override
|
||||
public Iterator<CGNode> getPredNodes(CGNode n) {
|
||||
Iterator<CGNode> tmp = cg.getPredNodes(n);
|
||||
Collection<CGNode> col = new LinkedList<CGNode>();
|
||||
Collection<CGNode> col = new LinkedList<>();
|
||||
while (tmp.hasNext()) {
|
||||
CGNode no = tmp.next();
|
||||
if (keep.contains(no) && !removedEdge(no, n)) {
|
||||
|
@ -124,7 +124,7 @@ public class PrunedCallGraph implements CallGraph {
|
|||
@Override
|
||||
public Iterator<CGNode> getSuccNodes(CGNode n) {
|
||||
Iterator<CGNode> tmp = cg.getSuccNodes(n);
|
||||
Collection<CGNode> col = new LinkedList<CGNode>();
|
||||
Collection<CGNode> col = new LinkedList<>();
|
||||
while (tmp.hasNext()) {
|
||||
CGNode no = tmp.next();
|
||||
if (keep.contains(no) && !removedEdge(n, no)) {
|
||||
|
@ -218,7 +218,7 @@ public class PrunedCallGraph implements CallGraph {
|
|||
@Override
|
||||
public Iterator<CGNode> iterateNodes(IntSet s) {
|
||||
Iterator<CGNode> tmp = cg.iterateNodes(s);
|
||||
Collection<CGNode> col = new LinkedList<CGNode>();
|
||||
Collection<CGNode> col = new LinkedList<>();
|
||||
while (tmp.hasNext()) {
|
||||
CGNode n = tmp.next();
|
||||
if (keep.contains(n)) {
|
||||
|
@ -287,7 +287,7 @@ public class PrunedCallGraph implements CallGraph {
|
|||
@Override
|
||||
public Collection<CGNode> getEntrypointNodes() {
|
||||
Collection<CGNode> tmp = cg.getEntrypointNodes();
|
||||
Set<CGNode> ret = new HashSet<CGNode>();
|
||||
Set<CGNode> ret = new HashSet<>();
|
||||
for (CGNode n : tmp) {
|
||||
if (keep.contains(n)) {
|
||||
ret.add(n);
|
||||
|
@ -310,7 +310,7 @@ public class PrunedCallGraph implements CallGraph {
|
|||
@Override
|
||||
public Set<CGNode> getNodes(MethodReference m) {
|
||||
Set<CGNode> tmp = cg.getNodes(m);
|
||||
Set<CGNode> ret = new HashSet<CGNode>();
|
||||
Set<CGNode> ret = new HashSet<>();
|
||||
for (CGNode n : tmp) {
|
||||
if (keep.contains(n)) {
|
||||
ret.add(n);
|
||||
|
@ -332,7 +332,7 @@ public class PrunedCallGraph implements CallGraph {
|
|||
return null;
|
||||
}
|
||||
Set<CGNode> tmp = cg.getPossibleTargets(node, site);
|
||||
Set<CGNode> ret = new HashSet<CGNode>();
|
||||
Set<CGNode> ret = new HashSet<>();
|
||||
for (CGNode n : tmp) {
|
||||
if (keep.contains(n) && !removedEdge(node, n)) {
|
||||
ret.add(n);
|
||||
|
|
|
@ -55,7 +55,7 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
/**
|
||||
* Graph implementation we delegate to.
|
||||
*/
|
||||
final private NumberedGraph<BasicBlockInContext<T>> g = new SlowSparseNumberedGraph<BasicBlockInContext<T>>(2);
|
||||
final private NumberedGraph<BasicBlockInContext<T>> g = new SlowSparseNumberedGraph<>(2);
|
||||
|
||||
/**
|
||||
* Governing call graph
|
||||
|
@ -190,8 +190,8 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
|
||||
if (pb.equals(cfg.entry())) {
|
||||
// entry block has no instructions
|
||||
BasicBlockInContext<T> p = new BasicBlockInContext<T>(n, pb);
|
||||
BasicBlockInContext<T> b = new BasicBlockInContext<T>(n, bb);
|
||||
BasicBlockInContext<T> p = new BasicBlockInContext<>(n, pb);
|
||||
BasicBlockInContext<T> b = new BasicBlockInContext<>(n, bb);
|
||||
g.addEdge(p, b);
|
||||
continue;
|
||||
}
|
||||
|
@ -204,14 +204,14 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
if (inst instanceof SSAAbstractInvokeInstruction) {
|
||||
if (CALL_TO_RETURN_EDGES) {
|
||||
// Add a "normal" edge from the predecessor block to this block.
|
||||
BasicBlockInContext<T> p = new BasicBlockInContext<T>(n, pb);
|
||||
BasicBlockInContext<T> b = new BasicBlockInContext<T>(n, bb);
|
||||
BasicBlockInContext<T> p = new BasicBlockInContext<>(n, pb);
|
||||
BasicBlockInContext<T> b = new BasicBlockInContext<>(n, bb);
|
||||
g.addEdge(p, b);
|
||||
}
|
||||
} else {
|
||||
// previous instruction is not a call instruction.
|
||||
BasicBlockInContext<T> p = new BasicBlockInContext<T>(n, pb);
|
||||
BasicBlockInContext<T> b = new BasicBlockInContext<T>(n, bb);
|
||||
BasicBlockInContext<T> p = new BasicBlockInContext<>(n, pb);
|
||||
BasicBlockInContext<T> b = new BasicBlockInContext<>(n, bb);
|
||||
if (!g.containsNode(p) || !g.containsNode(b)) {
|
||||
assert g.containsNode(p) : "IPCFG does not contain " + p;
|
||||
assert g.containsNode(b) : "IPCFG does not contain " + b;
|
||||
|
@ -238,9 +238,9 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
private void addEdgesFromExitToReturn(CGNode caller, T returnBlock, CGNode target,
|
||||
ControlFlowGraph<SSAInstruction, ? extends T> targetCFG) {
|
||||
T texit = targetCFG.exit();
|
||||
BasicBlockInContext<T> exit = new BasicBlockInContext<T>(target, texit);
|
||||
BasicBlockInContext<T> exit = new BasicBlockInContext<>(target, texit);
|
||||
addNodeForBasicBlockIfNeeded(exit);
|
||||
BasicBlockInContext<T> ret = new BasicBlockInContext<T>(caller, returnBlock);
|
||||
BasicBlockInContext<T> ret = new BasicBlockInContext<>(caller, returnBlock);
|
||||
if (!g.containsNode(exit) || !g.containsNode(ret)) {
|
||||
assert g.containsNode(exit) : "IPCFG does not contain " + exit;
|
||||
assert g.containsNode(ret) : "IPCFG does not contain " + ret;
|
||||
|
@ -261,9 +261,9 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
private void addEdgesFromCallToEntry(CGNode caller, T callBlock, CGNode target,
|
||||
ControlFlowGraph<SSAInstruction, ? extends T> targetCFG) {
|
||||
T tentry = targetCFG.entry();
|
||||
BasicBlockInContext<T> entry = new BasicBlockInContext<T>(target, tentry);
|
||||
BasicBlockInContext<T> entry = new BasicBlockInContext<>(target, tentry);
|
||||
addNodeForBasicBlockIfNeeded(entry);
|
||||
BasicBlockInContext<T> call = new BasicBlockInContext<T>(caller, callBlock);
|
||||
BasicBlockInContext<T> call = new BasicBlockInContext<>(caller, callBlock);
|
||||
if (!g.containsNode(entry) || !g.containsNode(call)) {
|
||||
assert g.containsNode(entry) : "IPCFG does not contain " + entry;
|
||||
assert g.containsNode(call) : "IPCFG does not contain " + call;
|
||||
|
@ -325,16 +325,16 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
System.err.println("Adding edge " + ccfg.getBlockForInstruction(i) + " to " + entryBlock);
|
||||
}
|
||||
T callerBB = ccfg.getBlockForInstruction(i);
|
||||
BasicBlockInContext<T> b1 = new BasicBlockInContext<T>(caller, callerBB);
|
||||
BasicBlockInContext<T> b1 = new BasicBlockInContext<>(caller, callerBB);
|
||||
// need to add a node for caller basic block, in case we haven't processed caller yet
|
||||
addNodeForBasicBlockIfNeeded(b1);
|
||||
BasicBlockInContext<T> b2 = new BasicBlockInContext<T>(n, entryBlock);
|
||||
BasicBlockInContext<T> b2 = new BasicBlockInContext<>(n, entryBlock);
|
||||
g.addEdge(b1, b2);
|
||||
// also add edges from exit node to all return nodes (successor of call bb)
|
||||
for (Iterator<? extends T> succIter = ccfg.getSuccNodes(callerBB); succIter.hasNext();) {
|
||||
T returnBB = succIter.next();
|
||||
BasicBlockInContext<T> b3 = new BasicBlockInContext<T>(n, exitBlock);
|
||||
BasicBlockInContext<T> b4 = new BasicBlockInContext<T>(caller, returnBB);
|
||||
BasicBlockInContext<T> b3 = new BasicBlockInContext<>(n, exitBlock);
|
||||
BasicBlockInContext<T> b4 = new BasicBlockInContext<>(caller, returnBB);
|
||||
addNodeForBasicBlockIfNeeded(b4);
|
||||
g.addEdge(b3, b4);
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
if (DEBUG_LEVEL > 1) {
|
||||
System.err.println("IPCFG Add basic block " + bb);
|
||||
}
|
||||
BasicBlockInContext<T> b = new BasicBlockInContext<T>(N, bb);
|
||||
BasicBlockInContext<T> b = new BasicBlockInContext<>(N, bb);
|
||||
addNodeForBasicBlockIfNeeded(b);
|
||||
}
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
ControlFlowGraph<SSAInstruction, T> cfg = getCFG(n);
|
||||
if (cfg != null) {
|
||||
for (T bb : cfg) {
|
||||
BasicBlockInContext<T> block = new BasicBlockInContext<T>(n, bb);
|
||||
BasicBlockInContext<T> block = new BasicBlockInContext<>(n, bb);
|
||||
if (hasCall(block)) {
|
||||
addCalleeEdgesForCall(n, block);
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
ControlFlowGraph<SSAInstruction, T> cfg = getCFG(returnBlock);
|
||||
for (Iterator<? extends T> it = cfg.getPredNodes(returnBlock.getDelegate()); it.hasNext();) {
|
||||
T b = it.next();
|
||||
final BasicBlockInContext<T> block = new BasicBlockInContext<T>(node, b);
|
||||
final BasicBlockInContext<T> block = new BasicBlockInContext<>(node, b);
|
||||
if (hasCall(block)) {
|
||||
addCalleeEdgesForCall(node, block);
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
addEdgesFromExitToReturn(n, retBlock, tn, tcfg);
|
||||
if (irrelevantTargets) {
|
||||
// Add a "normal" edge from the call block to the return block.
|
||||
g.addEdge(callBlock, new BasicBlockInContext<T>(n, retBlock));
|
||||
g.addEdge(callBlock, new BasicBlockInContext<>(n, retBlock));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -813,7 +813,7 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
ControlFlowGraph<SSAInstruction, ? extends T> cfg = getCFG(n);
|
||||
if (cfg != null) {
|
||||
T entry = cfg.entry();
|
||||
return new BasicBlockInContext<T>(n, entry);
|
||||
return new BasicBlockInContext<>(n, entry);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -822,7 +822,7 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
public BasicBlockInContext<T> getExit(CGNode n) {
|
||||
ControlFlowGraph<SSAInstruction, ? extends T> cfg = getCFG(n);
|
||||
T entry = cfg.exit();
|
||||
return new BasicBlockInContext<T>(n, entry);
|
||||
return new BasicBlockInContext<>(n, entry);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -839,7 +839,7 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
// a successor node is a return site if it is in the same
|
||||
// procedure, and is not the entry() node.
|
||||
Predicate<BasicBlockInContext> isReturn = other -> !other.isEntryBlock() && node.equals(other.getNode());
|
||||
return new FilterIterator<BasicBlockInContext<T>>(getSuccNodes(callBlock), isReturn);
|
||||
return new FilterIterator<>(getSuccNodes(callBlock), isReturn);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -855,7 +855,7 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
final CGNode node = returnBlock.getNode();
|
||||
|
||||
Predicate<T> dispatchFilter = callBlock -> {
|
||||
BasicBlockInContext<T> bb = new BasicBlockInContext<T>(node, callBlock);
|
||||
BasicBlockInContext<T> bb = new BasicBlockInContext<>(node, callBlock);
|
||||
if (!hasCall(bb, cfg)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -869,10 +869,10 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
|
||||
Function<T, BasicBlockInContext<T>> toContext = object -> {
|
||||
T b = object;
|
||||
return new BasicBlockInContext<T>(node, b);
|
||||
return new BasicBlockInContext<>(node, b);
|
||||
};
|
||||
MapIterator<T, BasicBlockInContext<T>> m = new MapIterator<T, BasicBlockInContext<T>>(it, toContext);
|
||||
return new FilterIterator<BasicBlockInContext<T>>(m, isCall);
|
||||
MapIterator<T, BasicBlockInContext<T>> m = new MapIterator<>(it, toContext);
|
||||
return new FilterIterator<>(m, isCall);
|
||||
}
|
||||
|
||||
private final Predicate<BasicBlockInContext<T>> isCall = this::hasCall;
|
||||
|
@ -884,7 +884,7 @@ public abstract class AbstractInterproceduralCFG<T extends ISSABasicBlock> imple
|
|||
ControlFlowGraph<SSAInstruction, T> cfg = getCFG(bb);
|
||||
for (Iterator<? extends T> it = cfg.getPredNodes(bb.getDelegate()); it.hasNext();) {
|
||||
T b = it.next();
|
||||
if (hasCall(new BasicBlockInContext<T>(bb.getNode(), b))) {
|
||||
if (hasCall(new BasicBlockInContext<>(bb.getNode(), b))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ExceptionPrunedCFG {
|
|||
}
|
||||
|
||||
public static <I, T extends IBasicBlock<I>> PrunedCFG<I, T> make(ControlFlowGraph<I, T> cfg) {
|
||||
return PrunedCFG.make(cfg, new ExceptionEdgePruner<I, T>(cfg));
|
||||
return PrunedCFG.make(cfg, new ExceptionEdgePruner<>(cfg));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class PrunedCFG<I, T extends IBasicBlock<I>> extends AbstractNumberedGrap
|
|||
if (cfg == null) {
|
||||
throw new IllegalArgumentException("cfg is null");
|
||||
}
|
||||
return new PrunedCFG<I, T>(cfg, filter);
|
||||
return new PrunedCFG<>(cfg, filter);
|
||||
}
|
||||
|
||||
private static class FilteredCFGEdges<I, T extends IBasicBlock<I>> implements NumberedEdgeManager<T> {
|
||||
|
@ -68,24 +68,24 @@ public class PrunedCFG<I, T extends IBasicBlock<I>> extends AbstractNumberedGrap
|
|||
}
|
||||
|
||||
public Iterator<T> getExceptionalSuccessors(final T N) {
|
||||
return new FilterIterator<T>(cfg.getExceptionalSuccessors(N).iterator(), o -> currentCFGNodes.containsNode(o) && filter.hasExceptionalEdge(N, o));
|
||||
return new FilterIterator<>(cfg.getExceptionalSuccessors(N).iterator(), o -> currentCFGNodes.containsNode(o) && filter.hasExceptionalEdge(N, o));
|
||||
}
|
||||
|
||||
public Iterator<T> getNormalSuccessors(final T N) {
|
||||
return new FilterIterator<T>(cfg.getNormalSuccessors(N).iterator(), o -> currentCFGNodes.containsNode(o) && filter.hasNormalEdge(N, o));
|
||||
return new FilterIterator<>(cfg.getNormalSuccessors(N).iterator(), o -> currentCFGNodes.containsNode(o) && filter.hasNormalEdge(N, o));
|
||||
}
|
||||
|
||||
public Iterator<T> getExceptionalPredecessors(final T N) {
|
||||
return new FilterIterator<T>(cfg.getExceptionalPredecessors(N).iterator(), o -> currentCFGNodes.containsNode(o) && filter.hasExceptionalEdge(o, N));
|
||||
return new FilterIterator<>(cfg.getExceptionalPredecessors(N).iterator(), o -> currentCFGNodes.containsNode(o) && filter.hasExceptionalEdge(o, N));
|
||||
}
|
||||
|
||||
public Iterator<T> getNormalPredecessors(final T N) {
|
||||
return new FilterIterator<T>(cfg.getNormalPredecessors(N).iterator(), o -> currentCFGNodes.containsNode(o) && filter.hasNormalEdge(o, N));
|
||||
return new FilterIterator<>(cfg.getNormalPredecessors(N).iterator(), o -> currentCFGNodes.containsNode(o) && filter.hasNormalEdge(o, N));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<T> getSuccNodes(final T N) {
|
||||
return new FilterIterator<T>(cfg.getSuccNodes(N), o -> currentCFGNodes.containsNode(o) && (filter.hasNormalEdge(N, o) || filter.hasExceptionalEdge(N, o)));
|
||||
return new FilterIterator<>(cfg.getSuccNodes(N), o -> currentCFGNodes.containsNode(o) && (filter.hasNormalEdge(N, o) || filter.hasExceptionalEdge(N, o)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -105,7 +105,7 @@ public class PrunedCFG<I, T extends IBasicBlock<I>> extends AbstractNumberedGrap
|
|||
|
||||
@Override
|
||||
public Iterator<T> getPredNodes(final T N) {
|
||||
return new FilterIterator<T>(cfg.getPredNodes(N), o -> currentCFGNodes.containsNode(o) && (filter.hasNormalEdge(o, N) || filter.hasExceptionalEdge(o, N)));
|
||||
return new FilterIterator<>(cfg.getPredNodes(N), o -> currentCFGNodes.containsNode(o) && (filter.hasNormalEdge(o, N) || filter.hasExceptionalEdge(o, N)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -200,7 +200,7 @@ public class PrunedCFG<I, T extends IBasicBlock<I>> extends AbstractNumberedGrap
|
|||
}
|
||||
|
||||
private Iterator<T> filterNodes(Iterator<T> nodeIterator) {
|
||||
return new FilterIterator<T>(nodeIterator, subset::contains);
|
||||
return new FilterIterator<>(nodeIterator, subset::contains);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -243,7 +243,7 @@ public class PrunedCFG<I, T extends IBasicBlock<I>> extends AbstractNumberedGrap
|
|||
private PrunedCFG(final ControlFlowGraph<I, T> cfg, final EdgeFilter<T> filter) {
|
||||
this.cfg = cfg;
|
||||
Graph<T> temp = new AbstractNumberedGraph<T>() {
|
||||
private final NumberedEdgeManager<T> edges = new FilteredCFGEdges<I, T>(cfg, cfg, filter);
|
||||
private final NumberedEdgeManager<T> edges = new FilteredCFGEdges<>(cfg, cfg, filter);
|
||||
|
||||
@Override
|
||||
protected NumberedNodeManager<T> getNodeManager() {
|
||||
|
@ -262,8 +262,8 @@ public class PrunedCFG<I, T extends IBasicBlock<I>> extends AbstractNumberedGrap
|
|||
reachable.add(cfg.entry());
|
||||
reachable.add(cfg.exit());
|
||||
|
||||
this.nodes = new FilteredNodes<T>(cfg, reachable);
|
||||
this.edges = new FilteredCFGEdges<I, T>(cfg, nodes, filter);
|
||||
this.nodes = new FilteredNodes<>(cfg, reachable);
|
||||
this.edges = new FilteredCFGEdges<>(cfg, nodes, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -278,7 +278,7 @@ public class PrunedCFG<I, T extends IBasicBlock<I>> extends AbstractNumberedGrap
|
|||
|
||||
@Override
|
||||
public List<T> getExceptionalSuccessors(final T N) {
|
||||
ArrayList<T> result = new ArrayList<T>();
|
||||
ArrayList<T> result = new ArrayList<>();
|
||||
for (Iterator<T> it = edges.getExceptionalSuccessors(N); it.hasNext();) {
|
||||
result.add(it.next());
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ArrayOutOfBoundFilter implements ExceptionFilter<SSAInstruction> {
|
|||
.getBoundsCheckNecessary().get(instruction);
|
||||
if (unnecessary == UnnecessaryCheck.BOTH) {
|
||||
|
||||
final LinkedList<FilteredException> result = new LinkedList<FilteredException>();
|
||||
final LinkedList<FilteredException> result = new LinkedList<>();
|
||||
result.add(new FilteredException(
|
||||
TypeReference.JavaLangArrayIndexOutOfBoundsException));
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ ExceptionFilter<SSAInstruction> {
|
|||
public Collection<FilteredException> filteredExceptions(
|
||||
SSAInstruction instruction) {
|
||||
if (this.analysis.nullPointerExceptionThrowState(instruction) == State.NOT_NULL) {
|
||||
final LinkedList<FilteredException> result = new LinkedList<FilteredException>();
|
||||
final LinkedList<FilteredException> result = new LinkedList<>();
|
||||
result.add(new FilteredException(
|
||||
TypeReference.JavaLangNullPointerException));
|
||||
return result;
|
||||
|
|
|
@ -40,7 +40,7 @@ public class CombinedInterproceduralExceptionFilter<Instruction> implements Inte
|
|||
|
||||
@Override
|
||||
public ExceptionFilter<Instruction> getFilter(CGNode node) {
|
||||
CombinedExceptionFilter<Instruction> result = new CombinedExceptionFilter<Instruction>();
|
||||
CombinedExceptionFilter<Instruction> result = new CombinedExceptionFilter<>();
|
||||
for (InterproceduralExceptionFilter<Instruction> exceptionFilter:filter) {
|
||||
result.add(exceptionFilter.getFilter(node));
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue