Resolve the last two Eclipse warnings about using raw types

Fixes bug #244.
This commit is contained in:
Ben Liblit 2018-04-13 12:51:58 -05:00
parent 0052213542
commit 6546d5d6a4
14 changed files with 36 additions and 30 deletions

View File

@ -348,7 +348,7 @@ public abstract class IRTests {
protected abstract <I extends InstanceKey> AbstractAnalysisEngine<I, CallGraphBuilder<I>, ?> getAnalysisEngine(String[] mainClassDescriptors, Collection<String> sources, List<String> libs);
public <I extends InstanceKey> Pair<CallGraph, PointerAnalysis<I>> runTest(Collection<String> sources, List<String> libs,
public <I extends InstanceKey> Pair<CallGraph, PointerAnalysis<? extends InstanceKey>> runTest(Collection<String> sources, List<String> libs,
String[] mainClassDescriptors, List<? extends IRAssertion> ca, boolean assertReachable) throws IllegalArgumentException, CancelException, IOException {
AbstractAnalysisEngine<I, CallGraphBuilder<I>, ?> engine = getAnalysisEngine(mainClassDescriptors, sources, libs);

View File

@ -318,13 +318,13 @@ public abstract class JavaIRTests extends IRTests {
}
@Test public void testInnerClassA() throws IllegalArgumentException, CancelException, IOException {
Pair<CallGraph, PointerAnalysis<InstanceKey>> x =
Pair<CallGraph, PointerAnalysis<? extends InstanceKey>> x =
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), new ArrayList<IRAssertion>(), true);
// can't do an IRAssertion() -- we need the pointer analysis
CallGraph cg = x.fst;
PointerAnalysis<InstanceKey> pa = x.snd;
PointerAnalysis<? extends InstanceKey> pa = x.snd;
Iterator<CGNode> iter = cg.iterator();
while ( iter.hasNext() ) {
@ -377,13 +377,13 @@ public abstract class JavaIRTests extends IRTests {
}
@Test public void testInnerClassSuper() throws IllegalArgumentException, CancelException, IOException {
Pair<CallGraph, PointerAnalysis<InstanceKey>> x =
Pair<CallGraph, PointerAnalysis<? extends InstanceKey>> x =
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), new ArrayList<IRAssertion>(), true);
// can't do an IRAssertion() -- we need the pointer analysis
CallGraph cg = x.fst;
PointerAnalysis<InstanceKey> pa = x.snd;
PointerAnalysis<? extends InstanceKey> pa = x.snd;
Iterator<CGNode> iter = cg.iterator();
while ( iter.hasNext() ) {
@ -534,15 +534,15 @@ public abstract class JavaIRTests extends IRTests {
}
@Test public void testMiniaturSliceBug() throws IllegalArgumentException, CancelException, IOException {
Pair<CallGraph, PointerAnalysis<InstanceKey>> x = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
Pair<CallGraph, PointerAnalysis<? extends InstanceKey>> x = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
PointerAnalysis<InstanceKey> pa = x.snd;
PointerAnalysis<? extends InstanceKey> pa = x.snd;
CallGraph cg = x.fst;
// test partial slice
MethodReference sliceRootRef = getSliceRootReference("MiniaturSliceBug", "validNonDispatchedCall", "(LIntWrapper;)V");
Set<CGNode> roots = cg.getNodes(sliceRootRef);
Pair<Collection<Statement>,SDG<InstanceKey>> y = AstJavaSlicer.computeAssertionSlice(cg, pa, roots, false);
Pair<Collection<Statement>,SDG<? extends InstanceKey>> y = AstJavaSlicer.computeAssertionSlice(cg, pa, roots, false);
Collection<Statement> slice = y.fst;
SlicerTest.dumpSlice(slice);
Assert.assertEquals(0, SlicerTest.countAllocations(slice));

View File

@ -40,7 +40,7 @@ public abstract class SyncDuplicatorTests extends IRTests {
Descriptor.findOrCreateUTF8(Language.JAVA, "(Ljava/lang/Object;)Z")), IInvokeInstruction.Dispatch.STATIC);
@Test public void testMonitor2() throws IllegalArgumentException, CancelException, IOException {
Pair<CallGraph, PointerAnalysis<InstanceKey>> result = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
Pair<CallGraph, PointerAnalysis<? extends InstanceKey>> result = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
System.err.println(result.fst);
}

View File

@ -17,6 +17,7 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.APILeak=error
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=error
@ -77,7 +78,7 @@ org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariable
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
@ -90,6 +91,7 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=error
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error

View File

@ -167,7 +167,7 @@ public abstract class JavaSourceAnalysisEngine<I extends InstanceKey> extends Ab
}
@Override
protected CallGraphBuilder<I> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
protected CallGraphBuilder<? super I> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
return new ZeroCFABuilderFactory().make(options, cache, cha, scope);
}
}

View File

@ -16,6 +16,7 @@ import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
import com.ibm.wala.ipa.cha.IClassHierarchy;
@ -26,7 +27,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
*/
public class ZeroCFABuilderFactory {
public CallGraphBuilder make(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope) {
public CallGraphBuilder<InstanceKey> make(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope) {
Util.addDefaultSelectors(options, cha);
Util.addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha);
return new AstJavaZeroXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.NONE);

View File

@ -89,10 +89,10 @@ public class AstJavaSlicer extends Slicer {
return gatherStatements(CG, partialRoots, o -> (o instanceof SSAGetInstruction) || (o instanceof SSAArrayLoadInstruction));
}
public static Pair<Collection<Statement>, SDG<InstanceKey>> computeAssertionSlice(CallGraph CG, PointerAnalysis<InstanceKey> pa,
public static Pair<Collection<Statement>, SDG<? extends InstanceKey>> computeAssertionSlice(CallGraph CG, PointerAnalysis<? extends InstanceKey> pa,
Collection<CGNode> partialRoots, boolean multiThreadedCode) throws IllegalArgumentException, CancelException {
CallGraph pcg = PartialCallGraph.make(CG, new LinkedHashSet<>(partialRoots));
SDG<InstanceKey> sdg = new SDG<>(pcg, pa, new AstJavaModRef<>(), DataDependenceOptions.FULL, ControlDependenceOptions.FULL);
SDG<? extends InstanceKey> sdg = new SDG<>(pcg, pa, new AstJavaModRef<>(), DataDependenceOptions.FULL, ControlDependenceOptions.FULL);
//System.err.println(("SDG:\n" + sdg));
Set<Statement> stmts = gatherAssertions(CG, partialRoots);
if (multiThreadedCode) {

View File

@ -17,6 +17,7 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.APILeak=error
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@ -77,7 +78,7 @@ org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariable
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
@ -90,6 +91,7 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=error
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error

View File

@ -15,6 +15,7 @@ import com.ibm.wala.cast.js.ipa.callgraph.JSAnalysisOptions;
import com.ibm.wala.cast.js.ipa.callgraph.JSZeroOrOneXCFABuilder;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
import com.ibm.wala.ipa.cha.IClassHierarchy;
@ -25,7 +26,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
*/
public class ZeroCFABuilderFactory {
public CallGraphBuilder make(JSAnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha) {
public CallGraphBuilder<InstanceKey> make(JSAnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha) {
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
options.setSelector(new StandardFunctionTargetSelector(cha, options.getMethodTargetSelector()));

View File

@ -205,7 +205,7 @@ public class SimpleThreadEscapeAnalysis extends AbstractAnalysisEngine<InstanceK
// extract data for analysis
//
CallGraph cg = getCallGraph();
PointerAnalysis<InstanceKey> pa = getPointerAnalysis();
PointerAnalysis<? extends InstanceKey> pa = getPointerAnalysis();
//
// collect all places where objects can escape their creating thread:
@ -252,7 +252,7 @@ public class SimpleThreadEscapeAnalysis extends AbstractAnalysisEngine<InstanceK
// pass 1: get abstract objects (instance keys) for escaping locations
//
for (PointerKey root : escapeAnalysisRoots) {
OrdinalSet<InstanceKey> objects = pa.getPointsToSet(root);
OrdinalSet<? extends InstanceKey> objects = pa.getPointsToSet(root);
for (InstanceKey obj : objects) {
escapingInstanceKeys.add(obj);
}
@ -270,7 +270,7 @@ public class SimpleThreadEscapeAnalysis extends AbstractAnalysisEngine<InstanceK
if (type.isArrayClass()) {
if (((ArrayClass) type).getElementClass() != null) {
PointerKey fk = heapModel.getPointerKeyForArrayContents(key);
OrdinalSet<InstanceKey> fobjects = pa.getPointsToSet(fk);
OrdinalSet<? extends InstanceKey> fobjects = pa.getPointsToSet(fk);
for (InstanceKey fobj : fobjects) {
if (!escapingInstanceKeys.contains(fobj)) {
newKeys.add(fobj);
@ -282,7 +282,7 @@ public class SimpleThreadEscapeAnalysis extends AbstractAnalysisEngine<InstanceK
for (IField f : fields) {
if (f.getFieldTypeReference().isReferenceType()) {
PointerKey fk = heapModel.getPointerKeyForInstanceField(key, f);
OrdinalSet<InstanceKey> fobjects = pa.getPointsToSet(fk);
OrdinalSet<? extends InstanceKey> fobjects = pa.getPointsToSet(fk);
for (InstanceKey fobj : fobjects) {
if (!escapingInstanceKeys.contains(fobj)) {
newKeys.add(fobj);

View File

@ -118,7 +118,7 @@ public abstract class AbstractAnalysisEngine<I extends InstanceKey, X extends Ca
/**
* Results of pointer analysis
*/
protected PointerAnalysis<I> pointerAnalysis;
protected PointerAnalysis<? super I> pointerAnalysis;
/**
* Graph view of flow of pointers between heap abstractions
@ -127,11 +127,11 @@ public abstract class AbstractAnalysisEngine<I extends InstanceKey, X extends Ca
private EntrypointBuilder entrypointBuilder = this::makeDefaultEntrypoints;
protected abstract X getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache2);
protected abstract CallGraphBuilder<? super I> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache2);
protected X buildCallGraph(IClassHierarchy cha, AnalysisOptions options, boolean savePointerAnalysis,
protected CallGraphBuilder<? super I> buildCallGraph(IClassHierarchy cha, AnalysisOptions options, boolean savePointerAnalysis,
IProgressMonitor monitor) throws IllegalArgumentException, CancelException {
X builder = getCallGraphBuilder(cha, options, cache);
CallGraphBuilder<? super I> builder = getCallGraphBuilder(cha, options, cache);
cg = builder.makeCallGraph(options, monitor);
@ -254,7 +254,7 @@ public abstract class AbstractAnalysisEngine<I extends InstanceKey, X extends Ca
return scope;
}
public PointerAnalysis<I> getPointerAnalysis() {
public PointerAnalysis<? super I> getPointerAnalysis() {
return pointerAnalysis;
}
@ -265,7 +265,7 @@ public abstract class AbstractAnalysisEngine<I extends InstanceKey, X extends Ca
return heapGraph;
}
public SDG<I> getSDG(DataDependenceOptions data, ControlDependenceOptions ctrl) {
public SDG<? super I> getSDG(DataDependenceOptions data, ControlDependenceOptions ctrl) {
return new SDG<>(getCallGraph(), getPointerAnalysis(), data, ctrl);
}
@ -301,7 +301,7 @@ public abstract class AbstractAnalysisEngine<I extends InstanceKey, X extends Ca
* @throws IllegalArgumentException
* @throws IOException
*/
public X defaultCallGraphBuilder() throws IllegalArgumentException, CancelException, IOException {
public CallGraphBuilder<? super I> defaultCallGraphBuilder() throws IllegalArgumentException, CancelException, IOException {
buildAnalysisScope();
IClassHierarchy cha = buildClassHierarchy();
setClassHierarchy(cha);

View File

@ -106,7 +106,7 @@ public class JDTJavaSourceAnalysisEngine<I extends InstanceKey> extends EclipseP
}
@Override
protected CallGraphBuilder<I> getCallGraphBuilder(IClassHierarchy cha,
protected CallGraphBuilder<? super I> getCallGraphBuilder(IClassHierarchy cha,
AnalysisOptions options, IAnalysisCacheView cache) {
return new ZeroCFABuilderFactory().make(options, cache, cha, scope);
}

View File

@ -113,7 +113,7 @@ public class EclipseJavaScriptAnalysisEngine<I extends InstanceKey> extends Ecli
}
@Override
protected CallGraphBuilder<I> getCallGraphBuilder(IClassHierarchy cha,
protected CallGraphBuilder<? super I> getCallGraphBuilder(IClassHierarchy cha,
AnalysisOptions options, IAnalysisCacheView cache) {
return new ZeroCFABuilderFactory().make((JSAnalysisOptions)options, cache, cha);
}

View File

@ -48,7 +48,7 @@ abstract public class EclipseProjectAnalysisEngine<P, I extends InstanceKey> ext
abstract protected EclipseProjectPath<?,P> createProjectPath(P project) throws IOException, CoreException;
@Override
abstract protected CallGraphBuilder<I> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache);
abstract protected CallGraphBuilder<? super I> getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache);
abstract protected AnalysisScope makeAnalysisScope();