Fix nearly all Eclipse warnings about using raw types
Along the way, I also converted many "for (;;)" loops into modern "for (:)" loops. I didn't systematically look for all opportunities to do this, though. I merely made this change where I was already converting raw Iterator uses into modern Iterator<...> uses. Better use of generics also allowed many casts to become statically redundant. I have removed all such redundant casts. Only three raw-types warnings remain after this batch of fixes. All three involve raw uses of CallGraphBuilder. I've tried to fix these too, but it quickly snowballs into a cascade of changes that may or may not eventually reach a statically-type-save fixed point. I may give these last few problem areas another go in the future. For now, though, the hundreds of other fixes seem worth keeping even if there are a few stragglers. This commit may change some public APIs, but only by making weaker type signatures stronger by replacing raw types with generic types. For example, we may change something like "Set" into "Set<String>", but we're not adding new arguments, changing any underlying (post-generics-erasure) types, etc.
This commit is contained in:
parent
cdce02573e
commit
e316471d88
|
@ -55,7 +55,7 @@ public class ArraysAndSuch {
|
|||
|
||||
os1.clone();
|
||||
if ( os1.equals(os2) ) {
|
||||
Class x = os1.getClass();
|
||||
Class<? extends Object[]> x = os1.getClass();
|
||||
os1.notify();
|
||||
os1.toString();
|
||||
try {
|
||||
|
|
|
@ -378,8 +378,8 @@ public abstract class IRTests {
|
|||
Set<IMethod> unreachable = HashSetFactory.make();
|
||||
IClassHierarchy cha = cg.getClassHierarchy();
|
||||
IClassLoader sourceLoader = cha.getLoader(JavaSourceAnalysisScope.SOURCE);
|
||||
for (Iterator iter = sourceLoader.iterateAllClasses(); iter.hasNext();) {
|
||||
IClass clazz = (IClass) iter.next();
|
||||
for (Iterator<IClass> iter = sourceLoader.iterateAllClasses(); iter.hasNext();) {
|
||||
IClass clazz = iter.next();
|
||||
|
||||
System.err.println(clazz);
|
||||
if (clazz.isInterface())
|
||||
|
@ -389,7 +389,7 @@ public abstract class IRTests {
|
|||
if (m.isAbstract()) {
|
||||
System.err.println(m);
|
||||
} else {
|
||||
Iterator nodeIter = cg.getNodes(m.getReference()).iterator();
|
||||
Iterator<CGNode> nodeIter = cg.getNodes(m.getReference()).iterator();
|
||||
if (!nodeIter.hasNext()) {
|
||||
if (m instanceof AstMethod) {
|
||||
String fn = ((AstClass)m.getDeclaringClass()).getSourcePosition().getURL().getFile();
|
||||
|
@ -400,7 +400,7 @@ public abstract class IRTests {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
CGNode node = (CGNode) nodeIter.next();
|
||||
CGNode node = nodeIter.next();
|
||||
System.err.println(node.getIR());
|
||||
}
|
||||
}
|
||||
|
@ -450,7 +450,7 @@ public abstract class IRTests {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void populateScope(JavaSourceAnalysisEngine engine, Collection<String> sources, List<String> libs) {
|
||||
public static void populateScope(JavaSourceAnalysisEngine<?> engine, Collection<String> sources, List<String> libs) {
|
||||
boolean foundLib = false;
|
||||
for (String lib : libs) {
|
||||
File libFile = new File(lib);
|
||||
|
|
|
@ -158,7 +158,7 @@ public class SynchronizedBlockDuplicator extends
|
|||
}
|
||||
|
||||
@Override
|
||||
protected CAstNode flowOutTo(Map nodeMap, CAstNode oldSource, Object label, CAstNode oldTarget, CAstControlFlowMap orig,
|
||||
protected CAstNode flowOutTo(Map<Pair<CAstNode, UnwindKey>, CAstNode> nodeMap, CAstNode oldSource, Object label, CAstNode oldTarget, CAstControlFlowMap orig,
|
||||
CAstSourcePositionMap src) {
|
||||
assert oldTarget == CAstControlFlowMap.EXCEPTION_TO_EXIT;
|
||||
return oldTarget;
|
||||
|
|
|
@ -182,7 +182,7 @@ public class AstJavaSSAPropagationCallGraphBuilder extends AstSSAPropagationCall
|
|||
system.newSideEffect(new UnaryOperator<PointsToSetVariable>() {
|
||||
@Override
|
||||
public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) {
|
||||
IntSetVariable tv = rhs;
|
||||
IntSetVariable<?> tv = rhs;
|
||||
if (tv.getValue() != null) {
|
||||
tv.getValue().foreach(new IntSetAction() {
|
||||
@Override
|
||||
|
|
|
@ -12,7 +12,6 @@ package com.ibm.wala.cast.java.ipa.callgraph;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import com.ibm.wala.cast.ipa.callgraph.ScopeMappingInstanceKeys;
|
||||
|
@ -42,8 +41,7 @@ public class JavaScopeMappingInstanceKeys extends ScopeMappingInstanceKeys {
|
|||
if (isPossiblyLexicalClass(cls)) {
|
||||
Set<LexicalParent> result = HashSetFactory.make();
|
||||
|
||||
for (Iterator MS = cls.getAllMethods().iterator(); MS.hasNext();) {
|
||||
IMethod m = (IMethod) MS.next();
|
||||
for (IMethod m : cls.getAllMethods()) {
|
||||
if ((m instanceof AstMethod) && !m.isStatic()) {
|
||||
AstMethod M = (AstMethod) m;
|
||||
LexicalParent[] parents = M.getParents();
|
||||
|
|
|
@ -100,11 +100,11 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
public class JavaClass extends AstClass {
|
||||
protected final IClass enclosingClass;
|
||||
|
||||
protected final Collection superTypeNames;
|
||||
protected final Collection<TypeName> superTypeNames;
|
||||
|
||||
private final Collection<Annotation> annotations;
|
||||
|
||||
public JavaClass(String typeName, Collection superTypeNames, CAstSourcePositionMap.Position position, Collection qualifiers,
|
||||
public JavaClass(String typeName, Collection<TypeName> superTypeNames, CAstSourcePositionMap.Position position, Collection<CAstQualifier> qualifiers,
|
||||
JavaSourceLoaderImpl loader, IClass enclosingClass, Collection<Annotation> annotations) {
|
||||
super(position, TypeName.string2TypeName(typeName), loader, (short) mapToInt(qualifiers), new HashMap<Atom, IField>(), new HashMap<Selector, IMethod>());
|
||||
this.superTypeNames = superTypeNames;
|
||||
|
@ -125,8 +125,8 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
@Override
|
||||
public IClass getSuperclass() {
|
||||
boolean excludedSupertype=false;
|
||||
for (Iterator iter = superTypeNames.iterator(); iter.hasNext();) {
|
||||
TypeName name = (TypeName) iter.next();
|
||||
for (Iterator<TypeName> iter = superTypeNames.iterator(); iter.hasNext();) {
|
||||
TypeName name = iter.next();
|
||||
IClass domoType = lookupClass(name);
|
||||
if (domoType != null && !domoType.isInterface()) {
|
||||
return domoType;
|
||||
|
@ -156,8 +156,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
@Override
|
||||
public Collection<IClass> getDirectInterfaces() {
|
||||
List<IClass> result = new ArrayList<>();
|
||||
for (Iterator iter = superTypeNames.iterator(); iter.hasNext();) {
|
||||
TypeName name = (TypeName) iter.next();
|
||||
for (TypeName name : superTypeNames) {
|
||||
IClass domoType = lookupClass(name);
|
||||
if (domoType != null && domoType.isInterface()) {
|
||||
result.add(domoType);
|
||||
|
@ -170,7 +169,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
return result;
|
||||
}
|
||||
|
||||
private void addMethod(CAstEntity methodEntity, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
private void addMethod(CAstEntity methodEntity, IClass owner, AbstractCFG<?, ?> cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
Map<IBasicBlock<SSAInstruction>, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
declaredMethods.put(Util.methodEntityToSelector(methodEntity), new ConcreteJavaMethod(methodEntity, owner, cfg, symtab,
|
||||
hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo));
|
||||
|
@ -251,7 +250,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
|
||||
private final TypeReference[] exceptionTypes;
|
||||
|
||||
public JavaEntityMethod(CAstEntity methodEntity, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
public JavaEntityMethod(CAstEntity methodEntity, IClass owner, AbstractCFG<?, ?> cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
Map<IBasicBlock<SSAInstruction>, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
super(owner, methodEntity.getQualifiers(), cfg, symtab, MethodReference.findOrCreate(owner.getReference(), Util
|
||||
.methodEntityToSelector(methodEntity)), hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo, JavaSourceLoaderImpl.this.getAnnotations(methodEntity));
|
||||
|
@ -310,13 +309,13 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
|
||||
private TypeReference[] computeExceptionTypes(CAstEntity methodEntity) {
|
||||
CAstType.Function fType = (Function) methodEntity.getType();
|
||||
Collection exceptionTypes = fType.getExceptionTypes();
|
||||
Collection<CAstType> exceptionTypes = fType.getExceptionTypes();
|
||||
|
||||
TypeReference[] result = new TypeReference[exceptionTypes.size()];
|
||||
int i = 0;
|
||||
for (Iterator iter = exceptionTypes.iterator(); iter.hasNext(); i++) {
|
||||
CAstType type = (CAstType) iter.next();
|
||||
for (CAstType type : exceptionTypes) {
|
||||
result[i] = TypeReference.findOrCreate(JavaSourceLoaderImpl.this.getReference(), type.getName());
|
||||
++i;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -369,7 +368,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
* @author rfuhrer
|
||||
*/
|
||||
public class ConcreteJavaMethod extends JavaEntityMethod {
|
||||
public ConcreteJavaMethod(CAstEntity methodEntity, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
public ConcreteJavaMethod(CAstEntity methodEntity, IClass owner, AbstractCFG<?, ?> cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
Map<IBasicBlock<SSAInstruction>, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
super(methodEntity, owner, cfg, symtab, hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo);
|
||||
}
|
||||
|
@ -451,11 +450,9 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
}
|
||||
}
|
||||
|
||||
public static int mapToInt(Collection/* <CAstQualifier> */qualifiers) {
|
||||
public static int mapToInt(Collection<CAstQualifier> qualifiers) {
|
||||
int result = 0;
|
||||
for (Iterator iter = qualifiers.iterator(); iter.hasNext();) {
|
||||
CAstQualifier q = (CAstQualifier) iter.next();
|
||||
|
||||
for (CAstQualifier q : qualifiers) {
|
||||
if (q == CAstQualifier.PUBLIC)
|
||||
result |= ClassConstants.ACC_PUBLIC;
|
||||
if (q == CAstQualifier.PROTECTED)
|
||||
|
@ -522,7 +519,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
/** END Custom change: Optional deletion of fTypeMap */
|
||||
}
|
||||
|
||||
public void defineFunction(CAstEntity n, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
public void defineFunction(CAstEntity n, IClass owner, AbstractCFG<?, ?> cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
Map<IBasicBlock<SSAInstruction>, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
((JavaClass) owner).addMethod(n, owner, cfg, symtab, hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo);
|
||||
}
|
||||
|
@ -541,8 +538,8 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
|
||||
public IClass defineType(CAstEntity type, String typeName, CAstEntity owner) {
|
||||
Collection<TypeName> superTypeNames = new ArrayList<>();
|
||||
for (Iterator superTypes = type.getType().getSupertypes().iterator(); superTypes.hasNext();) {
|
||||
superTypeNames.add(toWALATypeName(((CAstType) superTypes.next())));
|
||||
for (CAstType superType : type.getType().getSupertypes()) {
|
||||
superTypeNames.add(toWALATypeName(superType));
|
||||
}
|
||||
|
||||
JavaClass javaClass = new JavaClass(typeName, superTypeNames, type.getPosition(), type.getQualifiers(), this,
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
package com.ibm.wala.cast.java.loader;
|
||||
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.ibm.wala.cast.tree.CAstEntity;
|
||||
import com.ibm.wala.cast.tree.CAstType;
|
||||
import com.ibm.wala.types.Descriptor;
|
||||
|
@ -34,11 +32,9 @@ public class Util {
|
|||
new TypeName[signature.getArgumentCount()];
|
||||
|
||||
int i= 0;
|
||||
for(Iterator iter= signature.getArgumentTypes().iterator();
|
||||
iter.hasNext(); i++)
|
||||
{
|
||||
CAstType argType= (CAstType) iter.next();
|
||||
for (CAstType argType : signature.getArgumentTypes()) {
|
||||
argTypeNames[i]= TypeName.string2TypeName(argType.getName());
|
||||
++i;
|
||||
}
|
||||
|
||||
Descriptor desc= Descriptor.findOrCreate(argTypeNames, retTypeName);
|
||||
|
|
|
@ -29,7 +29,7 @@ public class Java2IRTranslator {
|
|||
|
||||
protected final JavaSourceLoaderImpl fLoader;
|
||||
|
||||
CAstRewriterFactory castRewriterFactory = null;
|
||||
CAstRewriterFactory<?, ?> castRewriterFactory = null;
|
||||
|
||||
public Java2IRTranslator(JavaSourceLoaderImpl srcLoader) {
|
||||
this(srcLoader, false);
|
||||
|
@ -40,12 +40,12 @@ public class Java2IRTranslator {
|
|||
}
|
||||
|
||||
public Java2IRTranslator(JavaSourceLoaderImpl srcLoader,
|
||||
CAstRewriterFactory castRewriterFactory) {
|
||||
CAstRewriterFactory<?, ?> castRewriterFactory) {
|
||||
this(srcLoader, castRewriterFactory, false);
|
||||
}
|
||||
|
||||
public Java2IRTranslator(JavaSourceLoaderImpl srcLoader,
|
||||
CAstRewriterFactory castRewriterFactory, boolean debug) {
|
||||
CAstRewriterFactory<?, ?> castRewriterFactory, boolean debug) {
|
||||
DEBUG = debug;
|
||||
fLoader = srcLoader;
|
||||
this.castRewriterFactory = castRewriterFactory;
|
||||
|
@ -60,7 +60,7 @@ public class Java2IRTranslator {
|
|||
|
||||
if (castRewriterFactory != null) {
|
||||
CAst cast = new CAstImpl();
|
||||
CAstRewriter rw = castRewriterFactory.createCAstRewriter(cast);
|
||||
CAstRewriter<?, ?> rw = castRewriterFactory.createCAstRewriter(cast);
|
||||
ce = rw.rewrite(ce);
|
||||
if (DEBUG) {
|
||||
PrintWriter printWriter = new PrintWriter(System.out);
|
||||
|
|
|
@ -15,7 +15,6 @@ package com.ibm.wala.cast.java.translator;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ibm.wala.cast.ir.translator.AstTranslator;
|
||||
|
@ -171,10 +170,9 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
|||
context.cfg().addPreNode(n, context.getUnwindState());
|
||||
context.cfg().newBlock(true);
|
||||
|
||||
Collection labels = context.getControlFlow().getTargetLabels(n);
|
||||
Collection<Object> labels = context.getControlFlow().getTargetLabels(n);
|
||||
|
||||
for (Iterator iter = labels.iterator(); iter.hasNext();) {
|
||||
Object label = iter.next();
|
||||
for (Object label : labels) {
|
||||
CAstNode target = context.getControlFlow().getTarget(n, label);
|
||||
if (target == CAstControlFlowMap.EXCEPTION_TO_EXIT)
|
||||
context.cfg().addPreEdgeToExit(n, true);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class NodejsCallGraphBuilderUtil extends JSCallGraphUtil {
|
|||
Language language = JavaScriptLoader.JS;
|
||||
Collection<Language> languages = Collections.singleton(language);
|
||||
|
||||
IRFactory<IMethod> irFactory = new AstIRFactory.AstDefaultIRFactory();
|
||||
IRFactory<IMethod> irFactory = new AstIRFactory.AstDefaultIRFactory<>();
|
||||
AnalysisCache cache = new AnalysisCacheImpl(irFactory);
|
||||
|
||||
JavaScriptLoaderFactory loaders = new JavaScriptLoaderFactory(translatorFactory, null);
|
||||
|
|
|
@ -95,7 +95,7 @@ public class JSCallGraphBuilderUtil extends com.ibm.wala.cast.js.ipa.callgraph.J
|
|||
*/
|
||||
public static JSCFABuilder makeScriptCGBuilder(String dir, String name, CGBuilderType builderType, ClassLoader loader) throws IOException, WalaException {
|
||||
URL script = getURLforFile(dir, name, loader);
|
||||
CAstRewriterFactory preprocessor = builderType.extractCorrelatedPairs ? new CorrelatedPairExtractorFactory(translatorFactory, script) : null;
|
||||
CAstRewriterFactory<?, ?> preprocessor = builderType.extractCorrelatedPairs ? new CorrelatedPairExtractorFactory(translatorFactory, script) : null;
|
||||
JavaScriptLoaderFactory loaders = JSCallGraphUtil.makeLoaders(preprocessor);
|
||||
|
||||
AnalysisScope scope = makeScriptScope(dir, name, loaders, loader);
|
||||
|
@ -163,7 +163,7 @@ public class JSCallGraphBuilderUtil extends com.ibm.wala.cast.js.ipa.callgraph.J
|
|||
|
||||
public static CallGraph makeScriptCG(SourceModule[] scripts, CGBuilderType builderType, IRFactory<IMethod> irFactory) throws IOException, IllegalArgumentException,
|
||||
CancelException, WalaException {
|
||||
CAstRewriterFactory preprocessor = builderType.extractCorrelatedPairs ? new CorrelatedPairExtractorFactory(translatorFactory, scripts) : null;
|
||||
CAstRewriterFactory<?, ?> preprocessor = builderType.extractCorrelatedPairs ? new CorrelatedPairExtractorFactory(translatorFactory, scripts) : null;
|
||||
PropagationCallGraphBuilder b = makeCGBuilder(makeLoaders(preprocessor), scripts, builderType, irFactory);
|
||||
CallGraph CG = b.makeCallGraph(b.getOptions());
|
||||
// dumpCG(b.getPointerAnalysis(), CG);
|
||||
|
@ -176,7 +176,7 @@ public class JSCallGraphBuilderUtil extends com.ibm.wala.cast.js.ipa.callgraph.J
|
|||
|
||||
public static JSCFABuilder makeHTMLCGBuilder(URL url, CGBuilderType builderType, Function<Void, JSSourceExtractor> fExtractor) throws IOException, WalaException {
|
||||
IRFactory<IMethod> irFactory = AstIRFactory.makeDefaultFactory();
|
||||
CAstRewriterFactory preprocessor = builderType.extractCorrelatedPairs ? new CorrelatedPairExtractorFactory(translatorFactory, url) : null;
|
||||
CAstRewriterFactory<?, ?> preprocessor = builderType.extractCorrelatedPairs ? new CorrelatedPairExtractorFactory(translatorFactory, url) : null;
|
||||
JavaScriptLoaderFactory loaders = new WebPageLoaderFactory(translatorFactory, preprocessor);
|
||||
SourceModule[] scriptsArray = makeHtmlScope(url, loaders, fExtractor);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.ibm.wala.classLoader.CallSiteReference;
|
|||
import com.ibm.wala.core.tests.slicer.SlicerTest;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
import com.ibm.wala.ipa.slicer.NormalStatement;
|
||||
import com.ibm.wala.ipa.slicer.SDG;
|
||||
import com.ibm.wala.ipa.slicer.Slicer;
|
||||
|
@ -75,7 +76,7 @@ public abstract class TestJavaScriptSlicer extends TestJSCallGraphShape {
|
|||
JSCFABuilder B = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", file);
|
||||
CallGraph CG = B.makeCallGraph(B.getOptions());
|
||||
|
||||
SDG sdg = new SDG<>(CG, B.getPointerAnalysis(), new JavaScriptModRef<>(), data, ctrl);
|
||||
SDG<InstanceKey> sdg = new SDG<>(CG, B.getPointerAnalysis(), new JavaScriptModRef<>(), data, ctrl);
|
||||
|
||||
final Collection<Statement> ss = findTargetStatement(CG);
|
||||
Collection<Statement> result = Slicer.computeBackwardSlice(sdg, ss);
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.ibm.wala.cast.js.ipa.callgraph.JSZeroOrOneXCFABuilder;
|
|||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
|
||||
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 OneCFABuilderFactory {
|
||||
|
||||
public CallGraphBuilder make(JSAnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, AnalysisScope scope,
|
||||
public CallGraphBuilder<InstanceKey> make(JSAnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, AnalysisScope scope,
|
||||
boolean keepPointsTo) {
|
||||
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
|
||||
options.setSelector(new StandardFunctionTargetSelector(cha, options.getMethodTargetSelector()));
|
||||
|
|
|
@ -34,7 +34,7 @@ public class WebPageLoaderFactory extends JavaScriptLoaderFactory {
|
|||
super(factory);
|
||||
}
|
||||
|
||||
public WebPageLoaderFactory(JavaScriptTranslatorFactory factory, CAstRewriterFactory preprocessor) {
|
||||
public WebPageLoaderFactory(JavaScriptTranslatorFactory factory, CAstRewriterFactory<?, ?> preprocessor) {
|
||||
super(factory, preprocessor);
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ public class ArgumentSpecialization {
|
|||
|
||||
}
|
||||
|
||||
public static class ArgumentCountIRFactory extends AstIRFactory.AstDefaultIRFactory {
|
||||
public static class ArgumentCountIRFactory extends AstIRFactory.AstDefaultIRFactory<IMethod> {
|
||||
private static final CAstPattern directAccessPattern = CAstPattern.parse("|(ARRAY_REF(VAR(\"arguments\"),<value>*)||OBJECT_REF(VAR(\"arguments\"),<value>*))|");
|
||||
|
||||
private static final CAstPattern destructuredAccessPattern = CAstPattern.parse("BLOCK_EXPR(ASSIGN(VAR(/[$][$]destructure[$]rcvr[0-9]+/),VAR(\"arguments\")),ASSIGN(VAR(<name>/[$][$]destructure[$]elt[0-9]+/),<value>*))");
|
||||
|
|
|
@ -87,7 +87,7 @@ public abstract class JSCFABuilder extends JSSSAPropagationCallGraphBuilder {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected PointerKey getInstanceFieldPointerKeyForConstant(InstanceKey I, ConstantKey F) {
|
||||
protected PointerKey getInstanceFieldPointerKeyForConstant(InstanceKey I, ConstantKey<?> F) {
|
||||
Object v = F.getValue();
|
||||
String strVal = JSCallGraphUtil.simulateToStringForPropertyNames(v);
|
||||
// if we know the string representation of the constant, use it...
|
||||
|
|
|
@ -109,7 +109,7 @@ public class JSCallGraphUtil extends com.ibm.wala.cast.ipa.callgraph.CAstCallGra
|
|||
* @param preprocessor CAst rewriter to use for preprocessing JavaScript source files; may be null
|
||||
* @return
|
||||
*/
|
||||
public static JavaScriptLoaderFactory makeLoaders(CAstRewriterFactory preprocessor) {
|
||||
public static JavaScriptLoaderFactory makeLoaders(CAstRewriterFactory<?, ?> preprocessor) {
|
||||
if (translatorFactory == null) {
|
||||
throw new IllegalStateException("com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory() must be invoked before makeLoaders()");
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void addAssignmentsForCatchPointerKey(PointerKey exceptionVar, Set catchClasses, PointerKey e) {
|
||||
protected void addAssignmentsForCatchPointerKey(PointerKey exceptionVar, Set<IClass> catchClasses, PointerKey e) {
|
||||
system.newConstraint(exceptionVar, assignOperator, e);
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
InstanceKey globalObj = ((AstSSAPropagationCallGraphBuilder) jsAnalysis.builder).getGlobalObject(JavaScriptTypes.jsName);
|
||||
PointerKey fkey = analysis.getHeapModel().getPointerKeyForInstanceField(globalObj, f);
|
||||
if (fkey != null) {
|
||||
OrdinalSet pointees = analysis.getPointsToSet(fkey);
|
||||
OrdinalSet<InstanceKey> pointees = analysis.getPointsToSet(fkey);
|
||||
IntSet set = pointees.getBackingSet();
|
||||
if (set != null) {
|
||||
S.addAll(set);
|
||||
|
@ -819,8 +819,8 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
} catch (CancelException e) {
|
||||
throw new CancelRuntimeException(e);
|
||||
}
|
||||
String v1 = (String) ((ConstantKey) iks1[i]).getValue();
|
||||
String v2 = (String) ((ConstantKey) iks2[j]).getValue();
|
||||
String v1 = (String) ((ConstantKey<?>) iks1[i]).getValue();
|
||||
String v2 = (String) ((ConstantKey<?>) iks2[j]).getValue();
|
||||
if (v1.indexOf(v2) == -1 && v2.indexOf(v1) == -1) {
|
||||
InstanceKey lvalKey = getInstanceKeyForConstant(v1 + v2);
|
||||
if (addKey(lvalKey)) {
|
||||
|
|
|
@ -59,7 +59,7 @@ public class LoadFileTargetSelector implements MethodTargetSelector {
|
|||
OrdinalSet<InstanceKey> ptrs = builder.getPointerAnalysis().getPointsToSet(fileNameV);
|
||||
for(InstanceKey k : ptrs) {
|
||||
if (k instanceof ConstantKey) {
|
||||
Object v = ((ConstantKey)k).getValue();
|
||||
Object v = ((ConstantKey<?>)k).getValue();
|
||||
if (v instanceof String) {
|
||||
names.add((String)v);
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
|||
if (o == null) {
|
||||
return JavaScriptTypes.Null;
|
||||
} else {
|
||||
Class c = o.getClass();
|
||||
Class<?> c = o.getClass();
|
||||
if (c == Boolean.class) {
|
||||
return JavaScriptTypes.Boolean;
|
||||
} else if (c == String.class) {
|
||||
|
@ -676,13 +676,13 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
|||
|
||||
private final JavaScriptTranslatorFactory translatorFactory;
|
||||
|
||||
private final CAstRewriterFactory preprocessor;
|
||||
private final CAstRewriterFactory<?, ?> preprocessor;
|
||||
|
||||
public JavaScriptLoader(IClassHierarchy cha, JavaScriptTranslatorFactory translatorFactory) {
|
||||
this(cha, translatorFactory, null);
|
||||
}
|
||||
|
||||
public JavaScriptLoader(IClassHierarchy cha, JavaScriptTranslatorFactory translatorFactory, CAstRewriterFactory preprocessor) {
|
||||
public JavaScriptLoader(IClassHierarchy cha, JavaScriptTranslatorFactory translatorFactory, CAstRewriterFactory<?, ?> preprocessor) {
|
||||
super(cha);
|
||||
this.translatorFactory = translatorFactory;
|
||||
this.preprocessor = preprocessor;
|
||||
|
@ -800,7 +800,7 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
|||
private WalkContext translationContext;
|
||||
private CAstEntity entity;
|
||||
|
||||
JavaScriptMethodObject(IClass cls, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
JavaScriptMethodObject(IClass cls, AbstractCFG<?, ?> cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
Map<IBasicBlock<SSAInstruction>, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
super(cls, functionQualifiers, cfg, symtab, AstMethodReference.fnReference(cls.getReference()), hasCatchBlock, caughtTypes,
|
||||
hasMonitorOp, lexicalInfo, debugInfo, null);
|
||||
|
@ -914,14 +914,14 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
|||
return makeCodeBodyType(name, JavaScriptTypes.Script, pos, entity, context);
|
||||
}
|
||||
|
||||
public IMethod defineCodeBodyCode(String clsName, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
public IMethod defineCodeBodyCode(String clsName, AbstractCFG<?, ?> cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
Map<IBasicBlock<SSAInstruction>, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
JavaScriptCodeBody C = (JavaScriptCodeBody) lookupClass(clsName, cha);
|
||||
assert C != null : clsName;
|
||||
return C.setCodeBody(makeCodeBodyCode(cfg, symtab, hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo, C));
|
||||
}
|
||||
|
||||
public JavaScriptMethodObject makeCodeBodyCode(AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
public JavaScriptMethodObject makeCodeBodyCode(AbstractCFG<?, ?> cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
Map<IBasicBlock<SSAInstruction>, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo,
|
||||
IClass C) {
|
||||
return new JavaScriptMethodObject(C, cfg, symtab, hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo,
|
||||
|
|
|
@ -23,13 +23,13 @@ import com.ibm.wala.types.ClassLoaderReference;
|
|||
*/
|
||||
public class JavaScriptLoaderFactory extends SingleClassLoaderFactory {
|
||||
protected final JavaScriptTranslatorFactory translatorFactory;
|
||||
protected final CAstRewriterFactory preprocessor;
|
||||
protected final CAstRewriterFactory<?, ?> preprocessor;
|
||||
|
||||
public JavaScriptLoaderFactory(JavaScriptTranslatorFactory factory) {
|
||||
this(factory, null);
|
||||
}
|
||||
|
||||
public JavaScriptLoaderFactory(JavaScriptTranslatorFactory factory, CAstRewriterFactory preprocessor) {
|
||||
public JavaScriptLoaderFactory(JavaScriptTranslatorFactory factory, CAstRewriterFactory<?, ?> preprocessor) {
|
||||
this.translatorFactory = factory;
|
||||
this.preprocessor = preprocessor;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
CAST_TEST_BIN = /home/vagrant/WALA/com.ibm.wala.cast.test/target/classes/
|
||||
CAST_TEST_BIN = /home/liblit/Documents/research/joust/joust/WALA/com.ibm.wala.cast.test/target/classes/
|
||||
|
|
|
@ -12,7 +12,6 @@ package com.ibm.wala.cast.test;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -33,24 +32,26 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
private static final int NAME_ASSERTION_MULTI = 502;
|
||||
|
||||
private static class TestingCAstImpl extends CAstImpl {
|
||||
private final Map testNameMap = new HashMap();
|
||||
private final Map<String, Object> testNameMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public CAstNode makeNode(int kind, CAstNode children[]) {
|
||||
if (kind == NAME_ASSERTION_SINGLE || kind == NAME_ASSERTION_MULTI) {
|
||||
assert children.length == 2;
|
||||
assert children[0].getValue() instanceof String;
|
||||
final Object child0Value = children[0].getValue();
|
||||
assert child0Value instanceof String;
|
||||
final String name = (String) child0Value;
|
||||
@SuppressWarnings("unused")
|
||||
CAstNode result = children[1];
|
||||
if (kind == NAME_ASSERTION_SINGLE) {
|
||||
testNameMap.put(children[0].getValue(), children[1]);
|
||||
testNameMap.put(name, children[1]);
|
||||
} else {
|
||||
if (!testNameMap.containsKey(children[0].getValue())) {
|
||||
testNameMap.put(children[0].getValue(), new ArrayList());
|
||||
if (!testNameMap.containsKey(name)) {
|
||||
testNameMap.put(name, new ArrayList<>());
|
||||
}
|
||||
|
||||
((List) testNameMap.get(children[0].getValue())).add(children[1]);
|
||||
((List<CAstNode>) testNameMap.get(children[0].getValue())).add(children[1]);
|
||||
}
|
||||
return children[1];
|
||||
} else {
|
||||
|
@ -60,7 +61,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
}
|
||||
|
||||
private static void test(CAstPattern p, CAstNode n, Map names) {
|
||||
private static void test(CAstPattern p, CAstNode n, Map<String, Object> names) {
|
||||
System.err.println(("testing pattern " + p));
|
||||
System.err.println(("testing with input " + CAstPrinter.print(n)));
|
||||
|
||||
|
@ -69,16 +70,15 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
} else {
|
||||
Segments s = CAstPattern.match(p, n);
|
||||
Assert.assertTrue(s != null);
|
||||
for (Iterator ns = names.keySet().iterator(); ns.hasNext();) {
|
||||
String nm = (String) ns.next();
|
||||
for (String nm : names.keySet()) {
|
||||
Object o = names.get(nm);
|
||||
if (o instanceof CAstNode) {
|
||||
System.err.println(("found " + CAstPrinter.print(s.getSingle(nm)) + " for " + nm));
|
||||
Assert.assertTrue("for name " + nm + ": expected " + names.get(nm) + " but got " + s.getSingle(nm), names.get(nm).equals(
|
||||
s.getSingle(nm)));
|
||||
} else {
|
||||
for (Iterator cs = s.getMultiple(nm).iterator(); cs.hasNext();) {
|
||||
System.err.println(("found " + CAstPrinter.print((CAstNode) cs.next()) + " for " + nm));
|
||||
for (CAstNode node : s.getMultiple(nm)) {
|
||||
System.err.println(("found " + CAstPrinter.print(node) + " for " + nm));
|
||||
}
|
||||
Assert.assertTrue("for name " + nm + ": expected " + names.get(nm) + " but got " + s.getMultiple(nm), names.get(nm)
|
||||
.equals(s.getMultiple(nm)));
|
||||
|
@ -91,7 +91,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
private final CAstNode simpleNameAst;
|
||||
|
||||
private final Map simpleNameMap;
|
||||
private final Map<String, Object> simpleNameMap;
|
||||
|
||||
{
|
||||
TestingCAstImpl Ast = new TestingCAstImpl();
|
||||
|
@ -111,7 +111,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
private final CAstNode simpleStarNameAst;
|
||||
|
||||
private final Map simpleStarNameMap;
|
||||
private final Map<String, Object> simpleStarNameMap;
|
||||
|
||||
{
|
||||
TestingCAstImpl Ast = new TestingCAstImpl();
|
||||
|
@ -131,7 +131,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
private final CAstNode simpleRepeatedAstOne;
|
||||
|
||||
private final Map simpleRepeatedMapOne;
|
||||
private final Map<String, Object> simpleRepeatedMapOne;
|
||||
|
||||
{
|
||||
TestingCAstImpl Ast = new TestingCAstImpl();
|
||||
|
@ -149,7 +149,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
private final CAstNode simpleRepeatedAstTwo;
|
||||
|
||||
private final Map simpleRepeatedMapTwo;
|
||||
private final Map<String, Object> simpleRepeatedMapTwo;
|
||||
|
||||
{
|
||||
TestingCAstImpl Ast = new TestingCAstImpl();
|
||||
|
@ -168,7 +168,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
private final CAstNode simpleRepeatedAstThree;
|
||||
|
||||
private final Map simpleRepeatedMapThree;
|
||||
private final Map<String, Object> simpleRepeatedMapThree;
|
||||
|
||||
{
|
||||
TestingCAstImpl Ast = new TestingCAstImpl();
|
||||
|
@ -190,7 +190,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
private final CAstNode simpleDoubleStarAst;
|
||||
|
||||
private final Map simpleDoubleStarMap;
|
||||
private final Map<String, Object> simpleDoubleStarMap;
|
||||
|
||||
{
|
||||
TestingCAstImpl Ast = new TestingCAstImpl();
|
||||
|
@ -212,7 +212,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
private final CAstNode simpleAlternativeAst;
|
||||
|
||||
private final Map simpleAlternativeMap;
|
||||
private final Map<String, Object> simpleAlternativeMap;
|
||||
|
||||
{
|
||||
TestingCAstImpl Ast = new TestingCAstImpl();
|
||||
|
@ -233,7 +233,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
private final CAstNode simpleOptionalAstWith;
|
||||
|
||||
private final Map simpleOptionalMapWith;
|
||||
private final Map<String, Object> simpleOptionalMapWith;
|
||||
|
||||
{
|
||||
TestingCAstImpl Ast = new TestingCAstImpl();
|
||||
|
@ -251,7 +251,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
private final CAstNode simpleOptionalAstNot;
|
||||
|
||||
private final Map simpleOptionalMapNot;
|
||||
private final Map<String, Object> simpleOptionalMapNot;
|
||||
|
||||
{
|
||||
TestingCAstImpl Ast = new TestingCAstImpl();
|
||||
|
@ -273,7 +273,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
private final CAstNode recursiveTreeOneAst;
|
||||
|
||||
private final Map recursiveTreeOneMap;
|
||||
private final Map<String, Object> recursiveTreeOneMap;
|
||||
|
||||
{
|
||||
TestingCAstImpl Ast = new TestingCAstImpl();
|
||||
|
@ -291,7 +291,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
private final CAstNode recursiveTreeTwoAst;
|
||||
|
||||
private final Map recursiveTreeTwoMap;
|
||||
private final Map<String, Object> recursiveTreeTwoMap;
|
||||
|
||||
{
|
||||
TestingCAstImpl Ast = new TestingCAstImpl();
|
||||
|
@ -311,7 +311,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
private final CAstNode recursiveTreeFiveAst;
|
||||
|
||||
private final Map recursiveTreeFiveMap;
|
||||
private final Map<String, Object> recursiveTreeFiveMap;
|
||||
|
||||
{
|
||||
TestingCAstImpl Ast = new TestingCAstImpl();
|
||||
|
@ -367,7 +367,7 @@ public class TestCAstPattern extends WalaTestCase {
|
|||
|
||||
private final CAstNode testedTreeOneAst;
|
||||
|
||||
private final Map testedTreeOneMap;
|
||||
private final Map<String, Object> testedTreeOneMap;
|
||||
|
||||
{
|
||||
TestingCAstImpl Ast = new TestingCAstImpl();
|
||||
|
|
|
@ -100,14 +100,14 @@ public abstract class TestCAstTranslator extends WalaTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
Pair[] instanceMethods = (Pair[]) entry[4];
|
||||
Pair<Object, Object>[] instanceMethods = (Pair[]) entry[4];
|
||||
if (instanceMethods != null) {
|
||||
for (int i = 0; i < instanceMethods.length; i++) {
|
||||
this.instanceMethods.put(Pair.make(clsName, instanceMethods[i].fst), instanceMethods[i].snd);
|
||||
}
|
||||
}
|
||||
|
||||
Pair[] staticMethods = (Pair[]) entry[5];
|
||||
Pair<Object, Object>[] staticMethods = (Pair[]) entry[5];
|
||||
if (staticMethods != null) {
|
||||
for (int i = 0; i < staticMethods.length; i++) {
|
||||
this.staticMethods.put(Pair.make(clsName, staticMethods[i].fst), staticMethods[i].snd);
|
||||
|
|
|
@ -101,9 +101,9 @@ public abstract class TestCallGraphShape extends WalaTestCase {
|
|||
|
||||
protected void verifyNameAssertions(CallGraph CG, Object[][] assertionData) {
|
||||
for (int i = 0; i < assertionData.length; i++) {
|
||||
Iterator NS = getNodes(CG, (String) assertionData[i][0]).iterator();
|
||||
Iterator<CGNode> NS = getNodes(CG, (String) assertionData[i][0]).iterator();
|
||||
while (NS.hasNext()) {
|
||||
CGNode N = (CGNode) NS.next();
|
||||
CGNode N = NS.next();
|
||||
IR ir = N.getIR();
|
||||
Name[] names = (Name[]) assertionData[i][1];
|
||||
for (int j = 0; j < names.length; j++) {
|
||||
|
@ -135,7 +135,7 @@ public abstract class TestCallGraphShape extends WalaTestCase {
|
|||
for (int i = 0; i < assertionData.length; i++) {
|
||||
|
||||
check_target: for (int j = 0; j < ((String[]) assertionData[i][1]).length; j++) {
|
||||
Iterator srcs = (assertionData[i][0] instanceof String) ? getNodes(CG, (String) assertionData[i][0]).iterator()
|
||||
Iterator<CGNode> srcs = (assertionData[i][0] instanceof String) ? getNodes(CG, (String) assertionData[i][0]).iterator()
|
||||
: new NonNullSingletonIterator<>(CG.getFakeRootNode());
|
||||
|
||||
Assert.assertTrue("cannot find " + assertionData[i][0], srcs.hasNext());
|
||||
|
@ -148,18 +148,18 @@ public abstract class TestCallGraphShape extends WalaTestCase {
|
|||
}
|
||||
|
||||
while (srcs.hasNext()) {
|
||||
CGNode src = (CGNode) srcs.next();
|
||||
for (Iterator sites = src.iterateCallSites(); sites.hasNext();) {
|
||||
CallSiteReference sr = (CallSiteReference) sites.next();
|
||||
CGNode src = srcs.next();
|
||||
for (Iterator<CallSiteReference> sites = src.iterateCallSites(); sites.hasNext();) {
|
||||
CallSiteReference sr = sites.next();
|
||||
|
||||
Iterator dsts = getNodes(CG, targetName).iterator();
|
||||
Iterator<CGNode> dsts = getNodes(CG, targetName).iterator();
|
||||
if (! checkAbsence) {
|
||||
Assert.assertTrue("cannot find " + targetName, dsts.hasNext());
|
||||
}
|
||||
|
||||
while (dsts.hasNext()) {
|
||||
CGNode dst = (CGNode) dsts.next();
|
||||
for (Iterator tos = CG.getPossibleTargets(src, sr).iterator(); tos.hasNext();) {
|
||||
CGNode dst = dsts.next();
|
||||
for (Iterator<CGNode> tos = CG.getPossibleTargets(src, sr).iterator(); tos.hasNext();) {
|
||||
if (tos.next().equals(dst)) {
|
||||
if (checkAbsence) {
|
||||
System.err.println(("found unexpected " + src + " --> " + dst + " at " + sr));
|
||||
|
@ -190,8 +190,8 @@ public abstract class TestCallGraphShape extends WalaTestCase {
|
|||
* @param destDescription
|
||||
*/
|
||||
protected void verifyNoEdges(CallGraph CG, String sourceDescription, String destDescription) {
|
||||
Collection sources = getNodes(CG, sourceDescription);
|
||||
Collection dests = getNodes(CG, destDescription);
|
||||
Collection<CGNode> sources = getNodes(CG, sourceDescription);
|
||||
Collection<CGNode> dests = getNodes(CG, destDescription);
|
||||
for (Object source : sources) {
|
||||
for (Object dest : dests) {
|
||||
for (Iterator<CGNode> i = CG.getSuccNodes((CGNode) source); i.hasNext();) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
JAVA_SDK = /usr/lib/jvm/jdk1.8.0_111/
|
||||
DOMO_AST_BIN = /home/vagrant/WALA/com.ibm.wala.cast/target/classes/
|
||||
JAVAH_CLASS_PATH = :/home/vagrant/WALA/com.ibm.wala.cast/target/classes/
|
||||
JAVA_SDK = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-1.b12.fc25.x86_64/
|
||||
DOMO_AST_BIN = /home/liblit/Documents/research/joust/joust/WALA/com.ibm.wala.cast/target/classes/
|
||||
JAVAH_CLASS_PATH = :/home/liblit/Documents/research/joust/joust/WALA/com.ibm.wala.cast/target/classes/
|
||||
TRACE =
|
||||
JNI_MD_DIR = linux
|
||||
|
|
|
@ -118,7 +118,7 @@ public class AstCallGraph extends ExplicitCallGraph {
|
|||
|
||||
callbacks.add(callback);
|
||||
|
||||
for (Iterator ps = getCallGraph().getPredNodes(this); ps.hasNext();) {
|
||||
for (Iterator<CGNode> ps = getCallGraph().getPredNodes(this); ps.hasNext();) {
|
||||
((AstCGNode) ps.next()).addCallback(callback);
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public class AstCallGraph extends ExplicitCallGraph {
|
|||
|
||||
callbacks.addAll(callback);
|
||||
|
||||
for (Iterator ps = getCallGraph().getPredNodes(this); ps.hasNext();) {
|
||||
for (Iterator<CGNode> ps = getCallGraph().getPredNodes(this); ps.hasNext();) {
|
||||
((AstCGNode) ps.next()).addAllCallbacks(callback);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import com.ibm.wala.cast.ir.ssa.AstAssertInstruction;
|
|||
import com.ibm.wala.cast.ir.ssa.AstEchoInstruction;
|
||||
import com.ibm.wala.cast.ir.ssa.AstGlobalRead;
|
||||
import com.ibm.wala.cast.ir.ssa.AstGlobalWrite;
|
||||
import com.ibm.wala.cast.ir.ssa.AstIRFactory.AstIR;
|
||||
import com.ibm.wala.cast.ir.ssa.AstIRFactory;
|
||||
import com.ibm.wala.cast.ir.ssa.AstInstructionVisitor;
|
||||
import com.ibm.wala.cast.ir.ssa.AstIsDefinedInstruction;
|
||||
import com.ibm.wala.cast.ir.ssa.AstLexicalAccess;
|
||||
|
@ -314,7 +314,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
public boolean hasNoInterestingUses(CGNode node, int vn, DefUse du) {
|
||||
if (node.getMethod() instanceof AstMethod) {
|
||||
// uses in nested functions are interesting
|
||||
IntSet uses = ((AstIR) node.getIR()).lexicalInfo().getAllExposedUses();
|
||||
IntSet uses = ((AstIRFactory<?>.AstIR) node.getIR()).lexicalInfo().getAllExposedUses();
|
||||
if (uses.contains(vn)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
system.newSideEffect(new UnaryOperator<PointsToSetVariable>() {
|
||||
@Override
|
||||
public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) {
|
||||
final IntSetVariable objects = rhs;
|
||||
final IntSetVariable<?> objects = rhs;
|
||||
if (objects.getValue() != null) {
|
||||
objects.getValue().foreach(new IntSetAction() {
|
||||
@Override
|
||||
|
@ -537,7 +537,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
system.newSideEffect(new UnaryOperator<PointsToSetVariable>() {
|
||||
@Override
|
||||
public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) {
|
||||
final IntSetVariable objects = rhs;
|
||||
final IntSetVariable<?> objects = rhs;
|
||||
if (objects.getValue() != null) {
|
||||
objects.getValue().foreach(new IntSetAction() {
|
||||
@Override
|
||||
|
@ -749,8 +749,8 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
private void addUpwardFunargConstraints(PointerKey lhs, String name, String definer, CGNode definingNode) {
|
||||
discoveredUpwardFunargs.add(lhs);
|
||||
|
||||
LexicalInformation LI = ((AstIR) definingNode.getIR()).lexicalInfo();
|
||||
Pair[] names = LI.getExposedNames();
|
||||
LexicalInformation LI = ((AstIRFactory<?>.AstIR) definingNode.getIR()).lexicalInfo();
|
||||
Pair<String, String>[] names = LI.getExposedNames();
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (name.equals(names[i].fst) && definer.equals(names[i].snd)) {
|
||||
int vn = LI.getExitExposedUses()[i];
|
||||
|
@ -954,8 +954,8 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
|
||||
@Override
|
||||
public byte evaluate(PointsToSetVariable lhs, final PointsToSetVariable[] rhs) {
|
||||
final IntSetVariable receivers = rhs[0];
|
||||
final IntSetVariable fields = rhs[1];
|
||||
final IntSetVariable<?> receivers = rhs[0];
|
||||
final IntSetVariable<?> fields = rhs[1];
|
||||
if (receivers.getValue() != null && fields.getValue() != null) {
|
||||
receivers.getValue().foreach(new IntSetAction() {
|
||||
@Override
|
||||
|
@ -974,7 +974,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
public void act(int fptr) {
|
||||
if (!doneField.contains(fptr) || !doneReceiver.contains(rptr)) {
|
||||
InstanceKey field = system.getInstanceKey(fptr);
|
||||
for (Iterator keys = isLoadOperation ? getPointerKeysForReflectedFieldRead(receiver, field)
|
||||
for (Iterator<PointerKey> keys = isLoadOperation ? getPointerKeysForReflectedFieldRead(receiver, field)
|
||||
: getPointerKeysForReflectedFieldWrite(receiver, field); keys.hasNext();) {
|
||||
AbstractFieldPointerKey key = (AbstractFieldPointerKey) keys.next();
|
||||
if (DEBUG_PROPERTIES)
|
||||
|
@ -1015,7 +1015,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
system.newSideEffect(new UnaryOperator<PointsToSetVariable>() {
|
||||
@Override
|
||||
public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) {
|
||||
final IntSetVariable objects = rhs;
|
||||
final IntSetVariable<?> objects = rhs;
|
||||
if (objects.getValue() != null) {
|
||||
objects.getValue().foreach(new IntSetAction() {
|
||||
@Override
|
||||
|
@ -1024,7 +1024,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
PointerKey objCatalog = getPointerKeyForObjectCatalog(object);
|
||||
for (int f = 0; f < fieldsKeys.length; f++) {
|
||||
if (isLoadOperation) {
|
||||
for (Iterator keys = getPointerKeysForReflectedFieldRead(object, fieldsKeys[f]); keys.hasNext();) {
|
||||
for (Iterator<PointerKey> keys = getPointerKeysForReflectedFieldRead(object, fieldsKeys[f]); keys.hasNext();) {
|
||||
AbstractFieldPointerKey key = (AbstractFieldPointerKey) keys.next();
|
||||
if (DEBUG_PROPERTIES)
|
||||
action.dump(key, true, false);
|
||||
|
@ -1034,7 +1034,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
if (objCatalog != null) {
|
||||
system.newConstraint(objCatalog, fieldsKeys[f]);
|
||||
}
|
||||
for (Iterator keys = getPointerKeysForReflectedFieldWrite(object, fieldsKeys[f]); keys.hasNext();) {
|
||||
for (Iterator<PointerKey> keys = getPointerKeysForReflectedFieldWrite(object, fieldsKeys[f]); keys.hasNext();) {
|
||||
AbstractFieldPointerKey key = (AbstractFieldPointerKey) keys.next();
|
||||
if (DEBUG_PROPERTIES)
|
||||
action.dump(key, true, false);
|
||||
|
@ -1079,14 +1079,14 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
system.newSideEffect(new UnaryOperator<PointsToSetVariable>() {
|
||||
@Override
|
||||
public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) {
|
||||
final IntSetVariable fields = rhs;
|
||||
final IntSetVariable<?> fields = rhs;
|
||||
if (fields.getValue() != null) {
|
||||
fields.getValue().foreach(new IntSetAction() {
|
||||
@Override
|
||||
public void act(int fptr) {
|
||||
InstanceKey field = system.getInstanceKey(fptr);
|
||||
for (int o = 0; o < objKeys.length; o++) {
|
||||
for (Iterator keys = isLoadOperation ? getPointerKeysForReflectedFieldRead(objKeys[o], field)
|
||||
for (Iterator<PointerKey> keys = isLoadOperation ? getPointerKeysForReflectedFieldRead(objKeys[o], field)
|
||||
: getPointerKeysForReflectedFieldWrite(objKeys[o], field); keys.hasNext();) {
|
||||
AbstractFieldPointerKey key = (AbstractFieldPointerKey) keys.next();
|
||||
if (DEBUG_PROPERTIES)
|
||||
|
@ -1123,7 +1123,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
PointerKey objCatalog = getPointerKeyForObjectCatalog(objKeys[o]);
|
||||
for (int f = 0; f < fieldsKeys.length; f++) {
|
||||
if (isLoadOperation) {
|
||||
for (Iterator keys = getPointerKeysForReflectedFieldRead(objKeys[o], fieldsKeys[f]); keys.hasNext();) {
|
||||
for (Iterator<PointerKey> keys = getPointerKeysForReflectedFieldRead(objKeys[o], fieldsKeys[f]); keys.hasNext();) {
|
||||
AbstractFieldPointerKey key = (AbstractFieldPointerKey) keys.next();
|
||||
if (DEBUG_PROPERTIES)
|
||||
action.dump(key, true, true);
|
||||
|
@ -1133,7 +1133,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
if (objCatalog != null) {
|
||||
system.newConstraint(objCatalog, fieldsKeys[f]);
|
||||
}
|
||||
for (Iterator keys = getPointerKeysForReflectedFieldWrite(objKeys[o], fieldsKeys[f]); keys.hasNext();) {
|
||||
for (Iterator<PointerKey> keys = getPointerKeysForReflectedFieldWrite(objKeys[o], fieldsKeys[f]); keys.hasNext();) {
|
||||
AbstractFieldPointerKey key = (AbstractFieldPointerKey) keys.next();
|
||||
if (DEBUG_PROPERTIES)
|
||||
action.dump(key, true, true);
|
||||
|
|
|
@ -124,8 +124,7 @@ public class CAstCallGraphUtil {
|
|||
public static void dumpCG(SSAContextInterpreter interp, PointerAnalysis<InstanceKey> PA, CallGraph CG) {
|
||||
if (AVOID_DUMP)
|
||||
return;
|
||||
for (Iterator x = CG.iterator(); x.hasNext();) {
|
||||
CGNode N = (CGNode) x.next();
|
||||
for (CGNode N : CG) {
|
||||
System.err.print("callees of node " + getShortName(N) + " : [");
|
||||
boolean fst = true;
|
||||
for (Iterator<? extends CGNode> ns = CG.getSuccNodes(N); ns.hasNext();) {
|
||||
|
@ -146,8 +145,7 @@ public class CAstCallGraphUtil {
|
|||
}
|
||||
|
||||
System.err.println("pointer analysis");
|
||||
for (Iterator x = PA.getPointerKeys().iterator(); x.hasNext();) {
|
||||
PointerKey n = (PointerKey) x.next();
|
||||
for (PointerKey n : PA.getPointerKeys()) {
|
||||
try {
|
||||
System.err.println((n + " --> " + PA.getPointsToSet(n)));
|
||||
} catch (Throwable e) {
|
||||
|
|
|
@ -165,7 +165,7 @@ public class CrossLanguageCallGraph extends AstCallGraph {
|
|||
}
|
||||
}
|
||||
|
||||
Iterator getLanguageRoots() {
|
||||
Iterator<CGNode> getLanguageRoots() {
|
||||
return languageRootNodes.iterator();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ import com.ibm.wala.util.strings.Atom;
|
|||
*/
|
||||
public class CrossLanguageClassTargetSelector implements ClassTargetSelector {
|
||||
|
||||
private final Map languageSelectors;
|
||||
private final Map<Atom, ClassTargetSelector> languageSelectors;
|
||||
|
||||
public CrossLanguageClassTargetSelector(Map languageSelectors) {
|
||||
public CrossLanguageClassTargetSelector(Map<Atom, ClassTargetSelector> languageSelectors) {
|
||||
this.languageSelectors = languageSelectors;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class CrossLanguageClassTargetSelector implements ClassTargetSelector {
|
|||
}
|
||||
|
||||
private ClassTargetSelector getSelector(NewSiteReference site) {
|
||||
return (ClassTargetSelector)languageSelectors.get(getLanguage(site));
|
||||
return languageSelectors.get(getLanguage(site));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,9 +35,9 @@ import com.ibm.wala.util.strings.Atom;
|
|||
*/
|
||||
public class CrossLanguageContextSelector implements ContextSelector {
|
||||
|
||||
private final Map languageSelectors;
|
||||
private final Map<Atom, ContextSelector> languageSelectors;
|
||||
|
||||
public CrossLanguageContextSelector(Map languageSelectors) {
|
||||
public CrossLanguageContextSelector(Map<Atom, ContextSelector> languageSelectors) {
|
||||
this.languageSelectors = languageSelectors;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class CrossLanguageContextSelector implements ContextSelector {
|
|||
}
|
||||
|
||||
private ContextSelector getSelector(CallSiteReference site) {
|
||||
return (ContextSelector)languageSelectors.get(getLanguage(site));
|
||||
return languageSelectors.get(getLanguage(site));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package com.ibm.wala.cast.ipa.callgraph;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.ibm.wala.cast.ipa.callgraph.AstSSAPropagationCallGraphBuilder.AstPointerAnalysisImpl.AstImplicitPointsToSetVisitor;
|
||||
import com.ibm.wala.cast.util.TargetLanguageSelector;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
|
@ -103,8 +101,8 @@ public abstract class CrossLanguageSSAPropagationCallGraphBuilder extends AstSSA
|
|||
|
||||
@Override
|
||||
protected void customInit() {
|
||||
for (Iterator roots = ((CrossLanguageCallGraph) callGraph).getLanguageRoots(); roots.hasNext();) {
|
||||
markDiscovered((CGNode) roots.next());
|
||||
for (CGNode root : callGraph) {
|
||||
markDiscovered(root);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public class DelegatingAstPointerKeys implements AstPointerKeyFactory {
|
|||
List<PointerKey> result = new LinkedList<>();
|
||||
|
||||
if (F instanceof ConstantKey) {
|
||||
PointerKey ifk = getInstanceFieldPointerKeyForConstant(I, (ConstantKey) F);
|
||||
PointerKey ifk = getInstanceFieldPointerKeyForConstant(I, (ConstantKey<?>) F);
|
||||
if (ifk != null) {
|
||||
result.add(ifk);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class DelegatingAstPointerKeys implements AstPointerKeyFactory {
|
|||
* @param F
|
||||
* @return
|
||||
*/
|
||||
protected PointerKey getInstanceFieldPointerKeyForConstant(InstanceKey I, ConstantKey F) {
|
||||
protected PointerKey getInstanceFieldPointerKeyForConstant(InstanceKey I, ConstantKey<?> F) {
|
||||
Object v = F.getValue();
|
||||
// FIXME: current only constant string are handled
|
||||
if (v instanceof String) {
|
||||
|
@ -118,7 +118,7 @@ public class DelegatingAstPointerKeys implements AstPointerKeyFactory {
|
|||
@Override
|
||||
public Iterator<PointerKey> getPointerKeysForReflectedFieldRead(InstanceKey I, InstanceKey F) {
|
||||
if (F instanceof ConstantKey) {
|
||||
PointerKey ifk = getInstanceFieldPointerKeyForConstant(I, (ConstantKey) F);
|
||||
PointerKey ifk = getInstanceFieldPointerKeyForConstant(I, (ConstantKey<?>) F);
|
||||
if (ifk != null) {
|
||||
return new NonNullSingletonIterator<>(ifk);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
*****************************************************************************/
|
||||
package com.ibm.wala.cast.ipa.callgraph;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
|
@ -82,8 +81,8 @@ public class MiscellaneousHacksContextSelector implements ContextSelector {
|
|||
IClass klass = cha.lookupClass(TypeReference.findOrCreate(new ClassLoaderReference(Atom.findOrCreateUnicodeAtom(descr[0]),
|
||||
ClassLoaderReference.Java, null), TypeName.string2TypeName(descr[1])));
|
||||
|
||||
for (Iterator M = klass.getDeclaredMethods().iterator(); M.hasNext();) {
|
||||
methodsToSpecialize.add(((IMethod) M.next()).getReference());
|
||||
for (IMethod M : klass.getDeclaredMethods()) {
|
||||
methodsToSpecialize.add(M.getReference());
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -93,8 +92,8 @@ public class MiscellaneousHacksContextSelector implements ContextSelector {
|
|||
case 1: {
|
||||
IClass klass = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application, TypeName.string2TypeName(descr[0])));
|
||||
|
||||
for (Iterator M = klass.getDeclaredMethods().iterator(); M.hasNext();) {
|
||||
methodsToSpecialize.add(((IMethod) M.next()).getReference());
|
||||
for (IMethod M : klass.getDeclaredMethods()) {
|
||||
methodsToSpecialize.add(M.getReference());
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -101,8 +101,8 @@ public class CrossLanguageClassHierarchy implements IClassHierarchy {
|
|||
@Override
|
||||
public IClassLoader[] getLoaders() {
|
||||
Set<IClassLoader> loaders = HashSetFactory.make();
|
||||
for (Iterator ldrs = analysisScope.getLoaders().iterator(); ldrs.hasNext();) {
|
||||
loaders.add(getLoader((ClassLoaderReference) ldrs.next()));
|
||||
for (ClassLoaderReference loaderReference : analysisScope.getLoaders()) {
|
||||
loaders.add(getLoader(loaderReference));
|
||||
}
|
||||
|
||||
return loaders.toArray(new IClassLoader[loaders.size()]);
|
||||
|
@ -121,8 +121,8 @@ public class CrossLanguageClassHierarchy implements IClassHierarchy {
|
|||
@Override
|
||||
public int getNumberOfClasses() {
|
||||
int total = 0;
|
||||
for (Iterator ldrs = analysisScope.getLoaders().iterator(); ldrs.hasNext();) {
|
||||
total += getLoader((ClassLoaderReference) ldrs.next()).getNumberOfClasses();
|
||||
for (ClassLoaderReference loaderReference : analysisScope.getLoaders()) {
|
||||
total += getLoader(loaderReference).getNumberOfClasses();
|
||||
}
|
||||
|
||||
return total;
|
||||
|
@ -264,8 +264,7 @@ public class CrossLanguageClassHierarchy implements IClassHierarchy {
|
|||
throws ClassHierarchyException {
|
||||
Set<Language> languages = scope.getBaseLanguages();
|
||||
Map<Atom, IClassHierarchy> hierarchies = HashMapFactory.make();
|
||||
for (Iterator ls = languages.iterator(); ls.hasNext();) {
|
||||
Language L = (Language) ls.next();
|
||||
for (Language L : languages) {
|
||||
Set<Language> ll = HashSetFactory.make(L.getDerivedLanguages());
|
||||
ll.add(L);
|
||||
hierarchies.put(L.getName(), ClassHierarchyFactory.make(scope, factory, ll));
|
||||
|
|
|
@ -33,7 +33,7 @@ import com.ibm.wala.ipa.modref.ModRef;
|
|||
public class AstModRef<T extends InstanceKey> extends ModRef<T> {
|
||||
|
||||
@Override
|
||||
public ExtendedHeapModel makeHeapModel(PointerAnalysis pa) {
|
||||
public ExtendedHeapModel makeHeapModel(PointerAnalysis<T> pa) {
|
||||
return (AstHeapModel)pa.getHeapModel();
|
||||
}
|
||||
|
||||
|
|
|
@ -155,11 +155,10 @@ public abstract class AbstractSSAConversion {
|
|||
@SuppressWarnings("unchecked")
|
||||
private void makeAssignmentMap() {
|
||||
this.assignmentMap = new Set[getMaxValueNumber() + 1];
|
||||
for (Iterator BBs = CFG.iterator(); BBs.hasNext();) {
|
||||
SSACFG.BasicBlock BB = (SSACFG.BasicBlock) BBs.next();
|
||||
for (ISSABasicBlock issaBasicBlock : CFG) {
|
||||
SSACFG.BasicBlock BB = (SSACFG.BasicBlock) issaBasicBlock;
|
||||
if (BB.getFirstInstructionIndex() >= 0) {
|
||||
for (Iterator IS = BB.iterator(); IS.hasNext();) {
|
||||
SSAInstruction inst = (SSAInstruction) IS.next();
|
||||
for (SSAInstruction inst : BB) {
|
||||
if (inst != null) {
|
||||
for (int j = 0; j < getNumberOfDefs(inst); j++) {
|
||||
addDefiningBlock(assignmentMap, BB, getDef(inst, j));
|
||||
|
@ -185,8 +184,8 @@ public abstract class AbstractSSAConversion {
|
|||
protected void placePhiNodes() {
|
||||
int IterCount = 0;
|
||||
|
||||
for (Iterator Xs = CFG.iterator(); Xs.hasNext();) {
|
||||
SSACFG.BasicBlock X = (SSACFG.BasicBlock) Xs.next();
|
||||
for (ISSABasicBlock issaBasicBlock : CFG) {
|
||||
SSACFG.BasicBlock X = (SSACFG.BasicBlock) issaBasicBlock;
|
||||
setHasAlready(X, 0);
|
||||
setWork(X, 0);
|
||||
}
|
||||
|
@ -204,8 +203,7 @@ public abstract class AbstractSSAConversion {
|
|||
|
||||
IterCount++;
|
||||
|
||||
for (Iterator XS = assignmentMap[V].iterator(); XS.hasNext();) {
|
||||
SSACFG.BasicBlock X = (SSACFG.BasicBlock) XS.next();
|
||||
for (BasicBlock X : assignmentMap[V]) {
|
||||
setWork(X, IterCount);
|
||||
W.add(X);
|
||||
}
|
||||
|
@ -213,7 +211,7 @@ public abstract class AbstractSSAConversion {
|
|||
while (!W.isEmpty()) {
|
||||
SSACFG.BasicBlock X = W.iterator().next();
|
||||
W.remove(X);
|
||||
for (Iterator YS = DF.getDominanceFrontier(X); YS.hasNext();) {
|
||||
for (Iterator<ISSABasicBlock> YS = DF.getDominanceFrontier(X); YS.hasNext();) {
|
||||
SSACFG.BasicBlock Y = (SSACFG.BasicBlock) YS.next();
|
||||
if (getHasAlready(Y) < IterCount) {
|
||||
if (isLive(Y, V)) {
|
||||
|
@ -355,7 +353,7 @@ public abstract class AbstractSSAConversion {
|
|||
repairExit();
|
||||
}
|
||||
|
||||
for (Iterator YS = CFG.getSuccNodes(X); YS.hasNext();) {
|
||||
for (Iterator<ISSABasicBlock> YS = CFG.getSuccNodes(X); YS.hasNext();) {
|
||||
SSACFG.BasicBlock Y = (SSACFG.BasicBlock) YS.next();
|
||||
int Y_id = Y.getGraphNodeId();
|
||||
int j = com.ibm.wala.cast.ir.cfg.Util.whichPred(CFG, Y, X);
|
||||
|
|
|
@ -36,18 +36,18 @@ import com.ibm.wala.types.TypeReference;
|
|||
|
||||
public class AstIRFactory<T extends IMethod> implements IRFactory<T> {
|
||||
|
||||
public ControlFlowGraph makeCFG(final IMethod method, final Context context) {
|
||||
public ControlFlowGraph<?, ?> makeCFG(final IMethod method, final Context context) {
|
||||
return ((AstMethod) method).getControlFlowGraph();
|
||||
}
|
||||
|
||||
public static class AstDefaultIRFactory extends DefaultIRFactory {
|
||||
private final AstIRFactory astFactory;
|
||||
public static class AstDefaultIRFactory<T extends IMethod> extends DefaultIRFactory {
|
||||
private final AstIRFactory<T> astFactory;
|
||||
|
||||
public AstDefaultIRFactory() {
|
||||
this(new AstIRFactory());
|
||||
this(new AstIRFactory<T>());
|
||||
}
|
||||
|
||||
public AstDefaultIRFactory(AstIRFactory astFactory) {
|
||||
public AstDefaultIRFactory(AstIRFactory<T> astFactory) {
|
||||
this.astFactory = astFactory;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class AstIRFactory<T extends IMethod> implements IRFactory<T> {
|
|||
return lexicalInfo;
|
||||
}
|
||||
|
||||
private void setCatchInstructions(SSACFG ssacfg, AbstractCFG oldcfg) {
|
||||
private void setCatchInstructions(SSACFG ssacfg, AbstractCFG<?, ?> oldcfg) {
|
||||
for (int i = 0; i < oldcfg.getNumberOfNodes(); i++)
|
||||
if (oldcfg.isCatchBlock(i)) {
|
||||
ExceptionHandlerBasicBlock B = (ExceptionHandlerBasicBlock) ssacfg.getNode(i);
|
||||
|
@ -144,7 +144,7 @@ public class AstIRFactory<T extends IMethod> implements IRFactory<T> {
|
|||
public IR makeIR(final IMethod method, final Context context, final SSAOptions options) {
|
||||
assert method instanceof AstMethod : method.toString();
|
||||
|
||||
AbstractCFG oldCfg = ((AstMethod) method).cfg();
|
||||
AbstractCFG<?, ?> oldCfg = ((AstMethod) method).cfg();
|
||||
SSAInstruction[] oldInstrs = (SSAInstruction[]) oldCfg.getInstructions();
|
||||
SSAInstruction[] instrs = new SSAInstruction[ oldInstrs.length ];
|
||||
System.arraycopy(oldInstrs, 0, instrs, 0, instrs.length);
|
||||
|
@ -156,7 +156,7 @@ public class AstIRFactory<T extends IMethod> implements IRFactory<T> {
|
|||
}
|
||||
|
||||
public static IRFactory<IMethod> makeDefaultFactory() {
|
||||
return new AstDefaultIRFactory();
|
||||
return new AstDefaultIRFactory<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,7 +17,7 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.ibm.wala.cast.ir.ssa.AstIRFactory.AstIR;
|
||||
import com.ibm.wala.cast.ir.ssa.AstIRFactory;
|
||||
import com.ibm.wala.cast.ir.ssa.analysis.LiveAnalysis;
|
||||
import com.ibm.wala.cast.loader.AstMethod;
|
||||
import com.ibm.wala.cast.loader.AstMethod.DebuggingInformation;
|
||||
|
@ -51,7 +51,7 @@ public class SSAConversion extends AbstractSSAConversion {
|
|||
|
||||
public static boolean DUMP = false;
|
||||
|
||||
private final AstIR ir;
|
||||
private final AstIRFactory<?>.AstIR ir;
|
||||
|
||||
private int nextSSAValue;
|
||||
|
||||
|
@ -247,12 +247,12 @@ public class SSAConversion extends AbstractSSAConversion {
|
|||
}
|
||||
}
|
||||
|
||||
public static void undoCopyPropagation(AstIR ir, int instruction, int use) {
|
||||
public static void undoCopyPropagation(AstIRFactory<?>.AstIR ir, int instruction, int use) {
|
||||
SSAInformation info = (SSAInformation) ir.getLocalMap();
|
||||
info.undoCopyPropagation(instruction, use);
|
||||
}
|
||||
|
||||
public static void copyUse(AstIR ir, int fromInst, int fromUse, int toInst, int toUse) {
|
||||
public static void copyUse(AstIRFactory<?>.AstIR ir, int fromInst, int fromUse, int toInst, int toUse) {
|
||||
SSAInformation info = (SSAInformation) ir.getLocalMap();
|
||||
info.copyUse(fromInst, fromUse, toInst, toUse);
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ public class SSAConversion extends AbstractSSAConversion {
|
|||
* @param options
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private SSAConversion(AstMethod M, AstIR ir, SSAOptions options) {
|
||||
private SSAConversion(AstMethod M, AstIRFactory<?>.AstIR ir, SSAOptions options) {
|
||||
super(ir, options);
|
||||
HashMap<Object, CopyPropagationRecord> m = HashMapFactory.make();
|
||||
this.copyPropagationMap = (ir.getLocalMap() instanceof SSAInformation) ? ((SSAInformation) ir.getLocalMap()).getCopyHistory()
|
||||
|
@ -535,7 +535,7 @@ public class SSAConversion extends AbstractSSAConversion {
|
|||
SSACFG.BasicBlock bb = CFG.getNode(i);
|
||||
if (bb.hasPhi()) {
|
||||
int n = 0;
|
||||
for (Iterator X = bb.iteratePhis(); X.hasNext(); n++)
|
||||
for (Iterator<SSAPhiInstruction> X = bb.iteratePhis(); X.hasNext(); n++)
|
||||
X.next();
|
||||
phiCounts[i] = n;
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ public class SSAConversion extends AbstractSSAConversion {
|
|||
computedLocalMap = new SSAInformation();
|
||||
}
|
||||
|
||||
private static IntSet valuesToConvert(AstIR ir) {
|
||||
private static IntSet valuesToConvert(AstIRFactory<?>.AstIR ir) {
|
||||
SSAInstruction[] insts = ir.getInstructions();
|
||||
MutableIntSet foundOne = new BitVectorIntSet();
|
||||
MutableIntSet foundTwo = new BitVectorIntSet();
|
||||
|
@ -661,11 +661,11 @@ public class SSAConversion extends AbstractSSAConversion {
|
|||
return foundTwo;
|
||||
}
|
||||
|
||||
public static SSA2LocalMap convert(AstMethod M, AstIR ir, SSAOptions options) {
|
||||
public static SSA2LocalMap convert(AstMethod M, AstIRFactory<?>.AstIR ir, SSAOptions options) {
|
||||
return convert(M, ir, options, valuesToConvert(ir));
|
||||
}
|
||||
|
||||
public static SSA2LocalMap convert(AstMethod M, final AstIR ir, SSAOptions options, final IntSet values) {
|
||||
public static SSA2LocalMap convert(AstMethod M, final AstIRFactory<?>.AstIR ir, SSAOptions options, final IntSet values) {
|
||||
try {
|
||||
if (DEBUG) {
|
||||
System.err.println(("starting conversion for " + values));
|
||||
|
|
|
@ -469,18 +469,18 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
* for handling languages that let you include other source files named
|
||||
* statically (e.g., ABAP)
|
||||
*/
|
||||
protected final Map namedEntityResolver;
|
||||
protected final Map<Object, CAstEntity> namedEntityResolver;
|
||||
|
||||
protected final SSAInstructionFactory insts;
|
||||
|
||||
protected AstTranslator(IClassLoader loader, Map namedEntityResolver, ArrayOpHandler arrayOpHandler) {
|
||||
protected AstTranslator(IClassLoader loader, Map<Object, CAstEntity> namedEntityResolver, ArrayOpHandler arrayOpHandler) {
|
||||
this.loader = loader;
|
||||
this.namedEntityResolver = namedEntityResolver;
|
||||
this.arrayOpHandler = arrayOpHandler!=null? arrayOpHandler: this;
|
||||
this.insts = loader.getInstructionFactory();
|
||||
}
|
||||
|
||||
protected AstTranslator(IClassLoader loader, Map namedEntityResolver) {
|
||||
protected AstTranslator(IClassLoader loader, Map<Object, CAstEntity> namedEntityResolver) {
|
||||
this(loader, namedEntityResolver, null);
|
||||
}
|
||||
|
||||
|
@ -1145,8 +1145,8 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
EdgeOperation normal,
|
||||
EdgeOperation except) {
|
||||
for (PreBasicBlock src : blocks) {
|
||||
for (Iterator j = icfg.getSuccNodes(src); j.hasNext();) {
|
||||
PreBasicBlock dst = (PreBasicBlock) j.next();
|
||||
for (Iterator<PreBasicBlock> j = icfg.getSuccNodes(src); j.hasNext();) {
|
||||
PreBasicBlock dst = j.next();
|
||||
if (isCatchBlock(dst.getNumber()) || (dst.isExitBlock() && icfg.exceptionalToExit.contains(src))) {
|
||||
except.act(src, dst);
|
||||
}
|
||||
|
@ -1370,7 +1370,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
PreBasicBlock bb = getNode(i);
|
||||
s.append(bb).append("\n");
|
||||
|
||||
for (Iterator ss = getSuccNodes(bb); ss.hasNext();)
|
||||
for (Iterator<PreBasicBlock> ss = getSuccNodes(bb); ss.hasNext();)
|
||||
s.append(" -->" + ss.next() + "\n");
|
||||
|
||||
for (int j = bb.getFirstInstructionIndex(); j <= bb.getLastInstructionIndex(); j++)
|
||||
|
@ -2326,7 +2326,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
|
||||
UnwindState getUnwindState();
|
||||
|
||||
void setCatchType(IBasicBlock bb, TypeReference catchType);
|
||||
void setCatchType(IBasicBlock<SSAInstruction> bb, TypeReference catchType);
|
||||
|
||||
void setCatchType(CAstNode catchNode, TypeReference catchType);
|
||||
|
||||
|
@ -2413,7 +2413,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCatchType(IBasicBlock bb, TypeReference catchType) {
|
||||
public void setCatchType(IBasicBlock<SSAInstruction> bb, TypeReference catchType) {
|
||||
parent.setCatchType(bb, catchType);
|
||||
}
|
||||
|
||||
|
@ -2615,7 +2615,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCatchType(IBasicBlock bb, TypeReference catchType) {
|
||||
public void setCatchType(IBasicBlock<SSAInstruction> bb, TypeReference catchType) {
|
||||
if (! catchTypes.containsKey(bb)) {
|
||||
catchTypes.put(bb, new TypeReference[] { catchType });
|
||||
} else {
|
||||
|
@ -3627,14 +3627,13 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
private static boolean handleBinaryOpThrow(CAstNode n, CAstNode op, WalkContext context) {
|
||||
// currently, only integer / and % throw exceptions
|
||||
boolean mayBeInteger = false;
|
||||
Collection labels = context.getControlFlow().getTargetLabels(n);
|
||||
Collection<Object> labels = context.getControlFlow().getTargetLabels(n);
|
||||
if (!labels.isEmpty()) {
|
||||
context.cfg().addPreNode(n, context.getUnwindState());
|
||||
|
||||
mayBeInteger = true;
|
||||
assert op == CAstOperator.OP_DIV || op == CAstOperator.OP_MOD : CAstPrinter.print(n);
|
||||
for (Iterator iter = labels.iterator(); iter.hasNext();) {
|
||||
Object label = iter.next();
|
||||
for (Object label : labels) {
|
||||
CAstNode target = context.getControlFlow().getTarget(n, label);
|
||||
if (target == CAstControlFlowMap.EXCEPTION_TO_EXIT)
|
||||
context.cfg().addPreEdgeToExit(n, true);
|
||||
|
@ -4177,10 +4176,8 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
|
||||
private static boolean isSimpleSwitch(CAstNode n, WalkContext context, CAstVisitor<WalkContext> visitor) {
|
||||
CAstControlFlowMap ctrl = context.getControlFlow();
|
||||
Collection caseLabels = ctrl.getTargetLabels(n);
|
||||
for (Iterator kases = caseLabels.iterator(); kases.hasNext();) {
|
||||
Object x = kases.next();
|
||||
|
||||
Collection<Object> caseLabels = ctrl.getTargetLabels(n);
|
||||
for (Object x : caseLabels) {
|
||||
if (x == CAstControlFlowMap.SWITCH_DEFAULT)
|
||||
continue;
|
||||
|
||||
|
@ -4216,7 +4213,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
|
||||
boolean hasExplicitDefault = ctrl.getTarget(n, CAstControlFlowMap.SWITCH_DEFAULT) != null;
|
||||
|
||||
Collection caseLabels = ctrl.getTargetLabels(n);
|
||||
Collection<Object> caseLabels = ctrl.getTargetLabels(n);
|
||||
int cases = caseLabels.size();
|
||||
if (hasExplicitDefault)
|
||||
cases--;
|
||||
|
@ -4242,8 +4239,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
}
|
||||
|
||||
int cn = 0;
|
||||
for (Iterator kases = caseLabels.iterator(); kases.hasNext();) {
|
||||
Object x = kases.next();
|
||||
for (Object x : caseLabels) {
|
||||
CAstNode target = ctrl.getTarget(n, x);
|
||||
if (x == CAstControlFlowMap.SWITCH_DEFAULT) {
|
||||
context.cfg().addEdge(defaultHackBlock, context.cfg().getBlock(target));
|
||||
|
@ -4268,8 +4264,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
|
||||
Collection<Object> caseLabels = ctrl.getTargetLabels(n);
|
||||
Map<Object, PreBasicBlock> labelToBlock = new LinkedHashMap<>();
|
||||
for (Iterator kases = caseLabels.iterator(); kases.hasNext();) {
|
||||
Object x = kases.next();
|
||||
for (Object x : caseLabels) {
|
||||
if (x != CAstControlFlowMap.SWITCH_DEFAULT) {
|
||||
visitor.visit((CAstNode) x, context, visitor);
|
||||
context.cfg().addInstruction(
|
||||
|
@ -4287,8 +4282,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
visitor.visit(switchBody, context, visitor);
|
||||
context.cfg().newBlock(true);
|
||||
|
||||
for (Iterator kases = caseLabels.iterator(); kases.hasNext();) {
|
||||
Object x = kases.next();
|
||||
for (Object x : caseLabels) {
|
||||
if (x != CAstControlFlowMap.SWITCH_DEFAULT) {
|
||||
CAstNode target = ctrl.getTarget(n, x);
|
||||
context.cfg().addEdge(labelToBlock.get(x), context.cfg().getBlock(target));
|
||||
|
@ -4336,9 +4330,8 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
context.cfg().addPreNode(n, context.getUnwindState());
|
||||
context.cfg().newBlock(false);
|
||||
|
||||
Collection labels = context.getControlFlow().getTargetLabels(n);
|
||||
for (Iterator iter = labels.iterator(); iter.hasNext();) {
|
||||
Object label = iter.next();
|
||||
Collection<Object> labels = context.getControlFlow().getTargetLabels(n);
|
||||
for (Object label : labels) {
|
||||
CAstNode target = context.getControlFlow().getTarget(n, label);
|
||||
if (target == CAstControlFlowMap.EXCEPTION_TO_EXIT)
|
||||
context.cfg().addPreEdgeToExit(n, true);
|
||||
|
@ -4587,7 +4580,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
public CAstEntity getIncludedEntity(CAstNode n) {
|
||||
if (n.getChild(0).getKind() == CAstNode.NAMED_ENTITY_REF) {
|
||||
assert namedEntityResolver != null;
|
||||
return (CAstEntity) namedEntityResolver.get(n.getChild(0).getChild(0).getValue());
|
||||
return namedEntityResolver.get(n.getChild(0).getChild(0).getValue());
|
||||
} else {
|
||||
return (CAstEntity) n.getChild(0).getValue();
|
||||
}
|
||||
|
@ -4729,7 +4722,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCatchType(IBasicBlock bb, TypeReference catchType) {
|
||||
public void setCatchType(IBasicBlock<SSAInstruction> bb, TypeReference catchType) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.ibm.wala.cast.tree.rewrite.CAstRewriterFactory;
|
|||
import com.ibm.wala.classLoader.ModuleEntry;
|
||||
|
||||
public class RewritingTranslatorToCAst implements TranslatorToCAst {
|
||||
private final List<CAstRewriterFactory> rewriters = new LinkedList<>();
|
||||
private final List<CAstRewriterFactory<?, ?>> rewriters = new LinkedList<>();
|
||||
protected final ModuleEntry M;
|
||||
private final TranslatorToCAst base;
|
||||
|
||||
|
@ -33,7 +33,7 @@ private final TranslatorToCAst base;
|
|||
public CAstEntity translateToCAst() throws IOException, Error {
|
||||
CAstImpl Ast = new CAstImpl();
|
||||
CAstEntity entity = base.translateToCAst();
|
||||
for(CAstRewriterFactory rwf : rewriters)
|
||||
for(CAstRewriterFactory<?, ?> rwf : rewriters)
|
||||
entity = rwf.createCAstRewriter(Ast).rewrite(entity);
|
||||
return entity;
|
||||
}
|
||||
|
|
|
@ -23,14 +23,14 @@ import com.ibm.wala.types.annotations.Annotation;
|
|||
import com.ibm.wala.util.strings.Atom;
|
||||
|
||||
public class AstField implements IField {
|
||||
private final Collection qualifiers;
|
||||
private final Collection<CAstQualifier> qualifiers;
|
||||
private final FieldReference ref;
|
||||
private final IClass declaringClass;
|
||||
private final IClassHierarchy cha;
|
||||
private final Collection<Annotation> annotations;
|
||||
|
||||
public AstField(FieldReference ref,
|
||||
Collection qualifiers,
|
||||
Collection<CAstQualifier> qualifiers,
|
||||
IClass declaringClass,
|
||||
IClassHierarchy cha,
|
||||
Collection<Annotation> annotations)
|
||||
|
|
|
@ -103,8 +103,8 @@ public abstract class AstMethod implements IMethod {
|
|||
}
|
||||
|
||||
protected final IClass cls;
|
||||
private final Collection qualifiers;
|
||||
private final AbstractCFG cfg;
|
||||
private final Collection<CAstQualifier> qualifiers;
|
||||
private final AbstractCFG<?, ?> cfg;
|
||||
private final SymbolTable symtab;
|
||||
private final MethodReference ref;
|
||||
private final boolean hasCatchBlock;
|
||||
|
@ -114,7 +114,7 @@ public abstract class AstMethod implements IMethod {
|
|||
private final DebuggingInformation debugInfo;
|
||||
private final Collection<Annotation> annotations;
|
||||
|
||||
protected AstMethod(IClass cls, Collection qualifiers, AbstractCFG cfg, SymbolTable symtab, MethodReference ref,
|
||||
protected AstMethod(IClass cls, Collection<CAstQualifier> qualifiers, AbstractCFG<?, ?> cfg, SymbolTable symtab, MethodReference ref,
|
||||
boolean hasCatchBlock, Map<IBasicBlock<SSAInstruction>, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo,
|
||||
DebuggingInformation debugInfo, Collection<Annotation> annotations) {
|
||||
this.cls = cls;
|
||||
|
@ -130,7 +130,7 @@ public abstract class AstMethod implements IMethod {
|
|||
this.annotations = annotations;
|
||||
}
|
||||
|
||||
protected AstMethod(IClass cls, Collection qualifiers, MethodReference ref, Collection<Annotation> annotations) {
|
||||
protected AstMethod(IClass cls, Collection<CAstQualifier> qualifiers, MethodReference ref, Collection<Annotation> annotations) {
|
||||
this.cls = cls;
|
||||
this.qualifiers = qualifiers;
|
||||
this.ref = ref;
|
||||
|
@ -147,7 +147,7 @@ public abstract class AstMethod implements IMethod {
|
|||
assert isAbstract();
|
||||
}
|
||||
|
||||
public AbstractCFG cfg() {
|
||||
public AbstractCFG<?, ?> cfg() {
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ public abstract class AstMethod implements IMethod {
|
|||
return qualifiers.contains(CAstQualifier.VOLATILE);
|
||||
}
|
||||
|
||||
public ControlFlowGraph getControlFlowGraph() {
|
||||
public ControlFlowGraph<?, ?> getControlFlowGraph() {
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
|
|
@ -144,13 +144,8 @@ public abstract class CAstAbstractLoader implements IClassLoader {
|
|||
@Override
|
||||
public int getNumberOfMethods() {
|
||||
int i = 0;
|
||||
for (Iterator cls = types.values().iterator(); cls.hasNext();) {
|
||||
for (Iterator ms = ((IClass) cls.next()).getDeclaredMethods().iterator();
|
||||
ms.hasNext(); )
|
||||
{
|
||||
i++;
|
||||
ms.next();
|
||||
}
|
||||
for (IClass cls : types.values()) {
|
||||
i += cls.getDeclaredMethods().size();
|
||||
}
|
||||
|
||||
return i;
|
||||
|
@ -208,8 +203,8 @@ public abstract class CAstAbstractLoader implements IClassLoader {
|
|||
}
|
||||
}
|
||||
|
||||
for (Iterator KK = keys.iterator(); KK.hasNext();) {
|
||||
types.remove(KK.next());
|
||||
for (TypeName key : keys) {
|
||||
types.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -111,8 +111,7 @@ public abstract class CAstAbstractModuleLoader extends CAstAbstractLoader {
|
|||
}
|
||||
|
||||
if (DEBUG) {
|
||||
for (Iterator ts = types.keySet().iterator(); ts.hasNext();) {
|
||||
TypeName tn = (TypeName) ts.next();
|
||||
for (TypeName tn : types.keySet()) {
|
||||
try {
|
||||
System.err.println(("found type " + tn + " : " + types.get(tn) + " < " + types.get(tn).getSuperclass()));
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -92,7 +92,7 @@ public interface CAstControlFlowMap {
|
|||
* Return a collection of control-flow ast nodes that have this one as a
|
||||
* possible target.
|
||||
*/
|
||||
Collection getSourceNodes(CAstNode to);
|
||||
Collection<Object> getSourceNodes(CAstNode to);
|
||||
|
||||
/**
|
||||
* Returns an iterator of all CAstNodes for which this map contains control
|
||||
|
|
|
@ -15,13 +15,13 @@ package com.ibm.wala.cast.tree;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
public interface CAstTypeDictionary/*<ASTType>*/ extends Iterable {
|
||||
public interface CAstTypeDictionary/*<ASTType>*/ extends Iterable<CAstType> {
|
||||
|
||||
CAstType getCAstTypeFor(Object/*ASTType*/ type);
|
||||
|
||||
CAstReference resolveReference(CAstReference ref);
|
||||
|
||||
@Override
|
||||
Iterator iterator();
|
||||
Iterator<CAstType> iterator();
|
||||
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ public class CAstControlFlowRecorder implements CAstControlFlowMap {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Collection getSourceNodes(CAstNode to) {
|
||||
public Set<Object> getSourceNodes(CAstNode to) {
|
||||
if (sourceMap.containsKey(CAstToNode.get(to))) {
|
||||
return sourceMap.get(CAstToNode.get(to));
|
||||
} else {
|
||||
|
@ -202,8 +202,7 @@ public class CAstControlFlowRecorder implements CAstControlFlowMap {
|
|||
@Override
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer("control flow map\n");
|
||||
for (Iterator keys = table.keySet().iterator(); keys.hasNext();) {
|
||||
Key key = (Key) keys.next();
|
||||
for (Key key : table.keySet()) {
|
||||
sb.append(key.from);
|
||||
if (src != null && nodeToCAst.get(key.from) != null && src.getPosition(nodeToCAst.get(key.from)) != null) {
|
||||
sb.append(" (").append(src.getPosition(nodeToCAst.get(key.from))).append(") ");
|
||||
|
|
|
@ -22,20 +22,19 @@ import com.ibm.wala.cast.tree.CAstTypeDictionary;
|
|||
import com.ibm.wala.util.collections.HashMapFactory;
|
||||
|
||||
public class CAstTypeDictionaryImpl implements CAstTypeDictionary {
|
||||
protected final Map fMap = HashMapFactory.make();
|
||||
protected final Map<Object, CAstType> fMap = HashMapFactory.make();
|
||||
|
||||
@Override
|
||||
public CAstType getCAstTypeFor(Object/*ASTType*/ astType) {
|
||||
return (CAstType) fMap.get(astType);
|
||||
return fMap.get(astType);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void map(Object/*ASTType*/ astType, CAstType castType) {
|
||||
fMap.put(astType, castType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator iterator() {
|
||||
public Iterator<CAstType> iterator() {
|
||||
return fMap.values().iterator();
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ public class AstLoopUnwinder
|
|||
}
|
||||
|
||||
@Override
|
||||
protected CAstNode flowOutTo(Map nodeMap,
|
||||
protected CAstNode flowOutTo(Map<Pair<CAstNode, UnwindKey>, CAstNode> nodeMap,
|
||||
CAstNode oldSource,
|
||||
Object label,
|
||||
CAstNode oldTarget,
|
||||
|
|
|
@ -32,9 +32,9 @@ public abstract class CAstBasicRewriter
|
|||
* context indicating that no cloning is being performed
|
||||
*/
|
||||
public static class NonCopyingContext implements CAstRewriter.RewriteContext<NoKey> {
|
||||
private final Map nodeMap = new HashMap();
|
||||
private final Map<Object, Object> nodeMap = new HashMap<>();
|
||||
|
||||
public Map nodeMap() {
|
||||
public Map<Object, Object> nodeMap() {
|
||||
return nodeMap;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public abstract class CAstRewriter<C extends CAstRewriter.RewriteContext<K>, K e
|
|||
* interface to be implemented by keys used for cloning sub-trees during the
|
||||
* rewrite
|
||||
*/
|
||||
public interface CopyKey<Self extends CopyKey> {
|
||||
public interface CopyKey<Self extends CopyKey<Self>> {
|
||||
|
||||
@Override
|
||||
int hashCode();
|
||||
|
@ -76,7 +76,7 @@ public abstract class CAstRewriter<C extends CAstRewriter.RewriteContext<K>, K e
|
|||
/**
|
||||
* interface to be implemented by contexts used while traversing the AST
|
||||
*/
|
||||
public interface RewriteContext<K extends CopyKey> {
|
||||
public interface RewriteContext<K extends CopyKey<K>> {
|
||||
|
||||
/**
|
||||
* get the cloning key for this context
|
||||
|
@ -190,8 +190,8 @@ public abstract class CAstRewriter<C extends CAstRewriter.RewriteContext<K>, K e
|
|||
|
||||
// try to find a k in key's parent chain such that (oldTarget, k) is
|
||||
// in nodeMap's key set
|
||||
Pair targetKey;
|
||||
CopyKey k = key;
|
||||
Pair<CAstNode,CopyKey<K>> targetKey;
|
||||
CopyKey<K> k = key;
|
||||
do {
|
||||
targetKey = Pair.make(oldTarget, k);
|
||||
if (k != null) {
|
||||
|
@ -321,8 +321,8 @@ public abstract class CAstRewriter<C extends CAstRewriter.RewriteContext<K>, K e
|
|||
if (children.containsKey(oldNode)) {
|
||||
Set<CAstEntity> newEntities = new LinkedHashSet<>();
|
||||
newChildren.put(newNode, newEntities);
|
||||
for (Iterator oldEntities = ((Collection) children.get(oldNode)).iterator(); oldEntities.hasNext();) {
|
||||
newEntities.add(rewrite((CAstEntity) oldEntities.next()));
|
||||
for (Iterator<CAstEntity> oldEntities = children.get(oldNode).iterator(); oldEntities.hasNext();) {
|
||||
newEntities.add(rewrite(oldEntities.next()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -333,8 +333,8 @@ public abstract class CAstRewriter<C extends CAstRewriter.RewriteContext<K>, K e
|
|||
if (key == null) {
|
||||
Set<CAstEntity> newEntities = new LinkedHashSet<>();
|
||||
newChildren.put(key, newEntities);
|
||||
for (Iterator oldEntities = ((Collection) entry.getValue()).iterator(); oldEntities.hasNext();) {
|
||||
newEntities.add(rewrite((CAstEntity) oldEntities.next()));
|
||||
for (CAstEntity oldEntity : entry.getValue()) {
|
||||
newEntities.add(rewrite(oldEntity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -454,8 +454,8 @@ public abstract class CAstRewriter<C extends CAstRewriter.RewriteContext<K>, K e
|
|||
CAstNode key = entry.getKey();
|
||||
Set<CAstEntity> newValues = new LinkedHashSet<>();
|
||||
newChildren.put(key, newValues);
|
||||
for (Iterator es = entry.getValue().iterator(); es.hasNext();) {
|
||||
newValues.add(rewrite((CAstEntity) es.next()));
|
||||
for (CAstEntity entity : entry.getValue()) {
|
||||
newValues.add(rewrite(entity));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,15 +125,15 @@ public abstract class CAstVisitor<C extends CAstVisitor.Context> {
|
|||
* @param n the parent entity of the entities to process
|
||||
* @param context a visitor-specific context
|
||||
*/
|
||||
public final void visitScopedEntities(CAstEntity n, Map allScopedEntities, C context, CAstVisitor<C> visitor) {
|
||||
for(Iterator i = allScopedEntities.values().iterator(); i.hasNext(); ) {
|
||||
visitScopedEntities(n, ((Collection)i.next()).iterator(), context, visitor);
|
||||
public final void visitScopedEntities(CAstEntity n, Map<CAstNode,Collection<CAstEntity>> allScopedEntities, C context, CAstVisitor<C> visitor) {
|
||||
for (Collection<CAstEntity> collection : allScopedEntities.values()) {
|
||||
visitScopedEntities(n, collection.iterator(), context, visitor);
|
||||
}
|
||||
}
|
||||
|
||||
public final void visitScopedEntities(CAstEntity n, Iterator i, C context, CAstVisitor<C> visitor) {
|
||||
public final void visitScopedEntities(CAstEntity n, Iterator<CAstEntity> i, C context, CAstVisitor<C> visitor) {
|
||||
while (i.hasNext()) {
|
||||
CAstEntity child = (CAstEntity) i.next();
|
||||
CAstEntity child = i.next();
|
||||
setParent(child, n);
|
||||
visitor.visitEntities(child, context, visitor);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import java.lang.reflect.Field;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
@ -81,14 +80,15 @@ public class CAstPattern {
|
|||
}
|
||||
|
||||
private void addAll(Segments other) {
|
||||
for (Iterator xs = other.entrySet().iterator(); xs.hasNext();) {
|
||||
Map.Entry e = (Map.Entry) xs.next();
|
||||
String name = (String) e.getKey();
|
||||
for (Map.Entry<String, Object> e : other.entrySet()) {
|
||||
String name = e.getKey();
|
||||
if (e.getValue() instanceof CAstNode) {
|
||||
add(name, (CAstNode) e.getValue());
|
||||
} else {
|
||||
for (Iterator vs = ((List) e.getValue()).iterator(); vs.hasNext();) {
|
||||
add(name, (CAstNode) vs.next());
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<CAstNode> nodes = (List<CAstNode>) e.getValue();
|
||||
for (CAstNode v : nodes) {
|
||||
add(name, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ public class CAstPattern {
|
|||
private final Collection<Segments> result = HashSetFactory.make();
|
||||
|
||||
@Override
|
||||
public void leaveNode(CAstNode n, Context c, CAstVisitor visitor) {
|
||||
public void leaveNode(CAstNode n, Context c, CAstVisitor<Context> visitor) {
|
||||
Segments s = match(CAstPattern.this, n);
|
||||
if (s != null) {
|
||||
result.add(s);
|
||||
|
|
|
@ -13,7 +13,6 @@ package com.ibm.wala.cast.util;
|
|||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.ibm.wala.cast.tree.CAstEntity;
|
||||
import com.ibm.wala.cast.tree.CAstNode;
|
||||
|
@ -304,11 +303,9 @@ public class CAstPrinter {
|
|||
doPrintTo(e.getAST(), e.getSourceMap(), w);
|
||||
w.write('\n');
|
||||
}
|
||||
for(Iterator i= e.getAllScopedEntities().values().iterator();
|
||||
i.hasNext(); )
|
||||
{
|
||||
for(Iterator j = ((Collection) i.next()).iterator(); j.hasNext(); ) {
|
||||
doPrintTo((CAstEntity) j.next(), w);
|
||||
for (Collection<CAstEntity> collection : e.getAllScopedEntities().values()) {
|
||||
for (CAstEntity entity : collection) {
|
||||
doPrintTo(entity, w);
|
||||
}
|
||||
}
|
||||
w.flush();
|
||||
|
|
|
@ -14,7 +14,7 @@ public @interface AnnotationWithParams {
|
|||
|
||||
String strParam() default "strdef";
|
||||
int intParam() default 0;
|
||||
Class klassParam() default Object.class;
|
||||
Class<?> klassParam() default Object.class;
|
||||
AnnotationEnum enumParam() default AnnotationEnum.VAL2;
|
||||
String[] strArrParam() default {"foo","baz"};
|
||||
int[] intArrParam() default {3,4};
|
||||
|
|
|
@ -13,7 +13,7 @@ package classConstant;
|
|||
class ClassConstant {
|
||||
|
||||
public static void main(String args[]) {
|
||||
Class x = ClassConstant.class;
|
||||
Class<ClassConstant> x = ClassConstant.class;
|
||||
x.hashCode();
|
||||
}
|
||||
|
||||
|
|
|
@ -44,10 +44,9 @@ public class TestArrayList {
|
|||
/**
|
||||
* @param args
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void main(String[] args) {
|
||||
ArrayList l1 = new ArrayList();
|
||||
ArrayList l2 = new ArrayList();
|
||||
ArrayList<Object> l1 = new ArrayList<Object>();
|
||||
ArrayList<Object> l2 = new ArrayList<Object>();
|
||||
l1.add(new Object());
|
||||
l2.add(new Object());
|
||||
Object o1 = l1.get(0);
|
||||
|
|
|
@ -13,7 +13,7 @@ package reflection;
|
|||
public class Reflect1 {
|
||||
|
||||
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
|
||||
Class c = Class.forName("java.lang.Integer");
|
||||
Class<?> c = Class.forName("java.lang.Integer");
|
||||
Integer i = (Integer)c.newInstance();
|
||||
System.err.println(i);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.lang.reflect.Method;
|
|||
public class Reflect10 {
|
||||
public static void main(String[] args) throws ClassNotFoundException, IllegalArgumentException, InstantiationException,
|
||||
IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException {
|
||||
Class c = Class.forName("java.lang.Integer");
|
||||
Class<?> c = Class.forName("java.lang.Integer");
|
||||
Method[] m = c.getMethods();
|
||||
m[0].invoke(new Integer(2), new Object[] {});
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.lang.reflect.Method;
|
|||
public class Reflect11 {
|
||||
public static void main(String[] args) throws ClassNotFoundException, IllegalArgumentException, InstantiationException,
|
||||
IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException {
|
||||
Class c = Class.forName("java.lang.Integer");
|
||||
Class<?> c = Class.forName("java.lang.Integer");
|
||||
Method[] m = c.getMethods();
|
||||
m[0].invoke(new Integer(2), (Object[]) args);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.lang.reflect.Method;
|
|||
public class Reflect12 {
|
||||
public static void main(String[] args) throws ClassNotFoundException, IllegalArgumentException, InstantiationException,
|
||||
IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException {
|
||||
Class c = Class.forName("reflection.Helper");
|
||||
Class<?> c = Class.forName("reflection.Helper");
|
||||
Method[] m = c.getMethods();
|
||||
m[0].invoke(new Helper(), new Object[3]);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.lang.reflect.Method;
|
|||
public class Reflect13 {
|
||||
public static void main(String[] args) throws ClassNotFoundException, IllegalArgumentException, InstantiationException,
|
||||
IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException {
|
||||
Class c = Class.forName("reflection.Helper");
|
||||
Class<?> c = Class.forName("reflection.Helper");
|
||||
Method[] m = c.getMethods();
|
||||
int length = new Integer(args[0]).intValue();
|
||||
m[0].invoke(new Helper(), new Object[length]);
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.lang.reflect.Modifier;
|
|||
public class Reflect14 {
|
||||
public static void main(String[] args) throws ClassNotFoundException, IllegalArgumentException, InstantiationException,
|
||||
IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException {
|
||||
Class c = Class.forName("reflection.Helper");
|
||||
Class<?> c = Class.forName("reflection.Helper");
|
||||
Method[] ms = c.getMethods();
|
||||
for (Method m : ms) {
|
||||
int mods = m.getModifiers();
|
||||
|
|
|
@ -19,10 +19,10 @@ import java.lang.reflect.InvocationTargetException;
|
|||
public class Reflect15 {
|
||||
public static void main(String[] args) throws ClassNotFoundException, IllegalArgumentException, InstantiationException,
|
||||
IllegalAccessException, InvocationTargetException {
|
||||
Class c = Class.forName("reflection.Helper");
|
||||
Constructor[] ctors = c.getConstructors();
|
||||
Class<?> c = Class.forName("reflection.Helper");
|
||||
Constructor<?>[] ctors = c.getConstructors();
|
||||
Helper h = null;
|
||||
for (Constructor ctor : ctors) {
|
||||
for (Constructor<?> ctor : ctors) {
|
||||
if (ctor.getParameterTypes().length == 2) {
|
||||
h = (Helper) ctor.newInstance(new Object[] {new Object(), new Object()});
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class Reflect19 {
|
|||
public static void main(String[] args) throws ClassNotFoundException, IllegalArgumentException, InstantiationException,
|
||||
IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException {
|
||||
Class<?> c = Class.forName("reflection.Helper");
|
||||
Constructor m = c.getConstructor(new Class[] { Integer.class });
|
||||
Constructor<?> m = c.getConstructor(new Class<?>[] { Integer.class });
|
||||
Integer i = Integer.valueOf(0);
|
||||
m.newInstance(new Object[] { i });
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ public class Reflect20 {
|
|||
NoSuchMethodException, IllegalAccessException, InstantiationException,
|
||||
IllegalArgumentException, InvocationTargetException {
|
||||
Class<?> helperClass = Class.forName("reflection.Helper");
|
||||
Class objectClass = Class.forName("java.lang.Object");
|
||||
Class[] paramArrayTypes = new Class[]{objectClass, objectClass};
|
||||
Class<?> objectClass = Class.forName("java.lang.Object");
|
||||
Class<?>[] paramArrayTypes = new Class[]{objectClass, objectClass};
|
||||
Method m = helperClass.getMethod("o", paramArrayTypes);
|
||||
Object helperObject = helperClass.newInstance();
|
||||
Object[] paramArrayObjects = new Object[]{new Object(), new Object()};
|
||||
|
|
|
@ -22,9 +22,9 @@ public class Reflect21 {
|
|||
NoSuchMethodException, IllegalAccessException, InstantiationException,
|
||||
IllegalArgumentException, InvocationTargetException {
|
||||
Class<?> helperClass = Class.forName("reflection.Helper");
|
||||
Class objectClass = Class.forName("java.lang.Object");
|
||||
Class[] paramArrayTypes = new Class[]{objectClass, objectClass};
|
||||
Constructor constr = helperClass.getDeclaredConstructor(paramArrayTypes);
|
||||
Class<?> objectClass = Class.forName("java.lang.Object");
|
||||
Class<?>[] paramArrayTypes = new Class[]{objectClass, objectClass};
|
||||
Constructor<?> constr = helperClass.getDeclaredConstructor(paramArrayTypes);
|
||||
Object[] paramArrayObjects = new Object[]{new Object(), new Object()};
|
||||
constr.newInstance(paramArrayObjects);
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ public class Reflect22 {
|
|||
public static void main(String[] args) throws ClassNotFoundException, SecurityException,
|
||||
NoSuchMethodException, IllegalAccessException, InstantiationException,
|
||||
IllegalArgumentException, InvocationTargetException {
|
||||
Class helperClass = Class.forName("reflection.Helper");
|
||||
Constructor[] constrs = helperClass.getDeclaredConstructors();
|
||||
for (Constructor constr : constrs) {
|
||||
Class<?> helperClass = Class.forName("reflection.Helper");
|
||||
Constructor<?>[] constrs = helperClass.getDeclaredConstructors();
|
||||
for (Constructor<?> constr : constrs) {
|
||||
if (constr.getParameterTypes().length == 1) {
|
||||
Class paramType = constr.getParameterTypes()[0];
|
||||
Class<?> paramType = constr.getParameterTypes()[0];
|
||||
if (paramType.getName().equals("java.lang.Integer")) {
|
||||
Integer i = new Integer(1);
|
||||
Object[] initArgs = new Object[]{i};
|
||||
|
|
|
@ -22,12 +22,12 @@ public class Reflect23 {
|
|||
public static void main(String[] args) throws ClassNotFoundException, SecurityException,
|
||||
NoSuchMethodException, IllegalAccessException, InstantiationException,
|
||||
IllegalArgumentException, InvocationTargetException {
|
||||
Class helperClass = Class.forName("reflection.Helper");
|
||||
Class<?> helperClass = Class.forName("reflection.Helper");
|
||||
Object helperObject = helperClass.newInstance();
|
||||
Method[] methods = helperClass.getDeclaredMethods();
|
||||
for (Method m : methods) {
|
||||
if (m.getParameterTypes().length == 1) {
|
||||
Class paramType = m.getParameterTypes()[0];
|
||||
Class<?> paramType = m.getParameterTypes()[0];
|
||||
if (! Modifier.isStatic(m.getModifiers()) && paramType.getName().equals("java.lang.Integer")) {
|
||||
Integer i = new Integer(1);
|
||||
Object[] initArgs = new Object[]{i};
|
||||
|
|
|
@ -15,13 +15,14 @@ import java.util.Hashtable;
|
|||
public class Reflect3 {
|
||||
|
||||
public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
|
||||
Class c = Class.forName("java.util.Properties");
|
||||
Hashtable h = (Hashtable) c.newInstance();
|
||||
Class<?> c = Class.forName("java.util.Properties");
|
||||
@SuppressWarnings("unchecked")
|
||||
Hashtable<Object, Object> h = (Hashtable<Object, Object>) c.newInstance();
|
||||
System.out.println(h.toString());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class Hash extends Hashtable {
|
||||
private static class Hash extends Hashtable<Object, Object> {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.io.FilePermission;
|
|||
public class Reflect4 {
|
||||
|
||||
public static void main(String[] args) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
|
||||
Class c = Class.forName("java.io.FilePermission");
|
||||
Class<?> c = Class.forName("java.io.FilePermission");
|
||||
FilePermission h = (FilePermission) c.newInstance();
|
||||
System.out.println(h.toString());
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ package reflection;
|
|||
public class Reflect5 {
|
||||
|
||||
public static void main(String[] args) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
|
||||
Class c = Class.forName("reflection.Reflect5$A");
|
||||
Class<?> c = Class.forName("reflection.Reflect5$A");
|
||||
A h = (A) c.newInstance();
|
||||
System.out.println(h.toString());
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ package reflection;
|
|||
public class Reflect6 {
|
||||
|
||||
public static void main(String[] args) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
|
||||
Class c = Class.forName("reflection.Reflect6$A");
|
||||
Class<?> c = Class.forName("reflection.Reflect6$A");
|
||||
A h = (A) c.newInstance();
|
||||
System.out.println(h.toString());
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ public class Reflect7 {
|
|||
@SuppressWarnings("unchecked")
|
||||
public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException,
|
||||
IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
|
||||
Class c = Class.forName("java.io.FilePermission");
|
||||
Class[] paramTypes = new Class[] { "".getClass(), "".getClass() };
|
||||
Class<FilePermission> c = (Class<FilePermission>) Class.forName("java.io.FilePermission");
|
||||
Class<?>[] paramTypes = new Class[] { "".getClass(), "".getClass() };
|
||||
Constructor<FilePermission> constr = c.getConstructor(paramTypes);
|
||||
Object[] params = new String[] { "log.txt", "read" };
|
||||
FilePermission fp = constr.newInstance(params);
|
||||
|
|
|
@ -19,8 +19,8 @@ import java.lang.reflect.InvocationTargetException;
|
|||
public class Reflect8 {
|
||||
public static void main(String[] args) throws ClassNotFoundException, IllegalArgumentException, InstantiationException,
|
||||
IllegalAccessException, InvocationTargetException {
|
||||
Class c = Class.forName("java.lang.Integer");
|
||||
Constructor[] ctors = c.getConstructors();
|
||||
Class<?> c = Class.forName("java.lang.Integer");
|
||||
Constructor<?>[] ctors = c.getConstructors();
|
||||
Integer i = (Integer) ctors[0].newInstance(new Integer(1));
|
||||
i.toString();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,6 @@ import java.util.Hashtable;
|
|||
public class Slice7 {
|
||||
public static void main(String args[]) {
|
||||
@SuppressWarnings("unused")
|
||||
Hashtable abc = new Hashtable(3, 0.75f);
|
||||
Hashtable<Object, Object> abc = new Hashtable<Object, Object>(3, 0.75f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class PrimitivesTest extends WalaTestCase {
|
|||
/**
|
||||
* Test the MutableSparseIntSet implementation
|
||||
*/
|
||||
private static void doMutableIntSet(MutableIntSetFactory factory) {
|
||||
private static void doMutableIntSet(MutableIntSetFactory<?> factory) {
|
||||
MutableIntSet v = factory.parse("{9,17}");
|
||||
MutableIntSet w = factory.make(new int[] {});
|
||||
MutableIntSet x = factory.make(new int[] { 7, 4, 2, 4, 2, 2 });
|
||||
|
@ -891,7 +891,7 @@ public class PrimitivesTest extends WalaTestCase {
|
|||
testSingleBitVector(new OffsetBitVector(100, 10));
|
||||
}
|
||||
|
||||
private static void testSingleBitVector(BitVectorBase bv) {
|
||||
private static void testSingleBitVector(BitVectorBase<?> bv) {
|
||||
// does the following not automatically scale the bitvector to
|
||||
// a reasonable size?
|
||||
bv.set(55);
|
||||
|
@ -959,8 +959,7 @@ public class PrimitivesTest extends WalaTestCase {
|
|||
testBitVectors(new OffsetBitVector(35, 20), new OffsetBitVector(25, 10));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T extends BitVectorBase> void testBitVectors(T v1, T v2) {
|
||||
private static <T extends BitVectorBase<T>> void testBitVectors(T v1, T v2) {
|
||||
v1.set(100);
|
||||
v1.set(101);
|
||||
v1.set(102);
|
||||
|
|
|
@ -276,7 +276,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = Util.makeMainEntrypoints(scope, cha, "Ldemandpa/TestArraysCopyOf");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
AnalysisCache cache = new AnalysisCacheImpl();
|
||||
CallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
|
||||
CGNode mainMethod = AbstractPtrTest.findMainMethod(cg);
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.ibm.wala.ipa.callgraph.CallGraph;
|
|||
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
|
||||
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Util;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.SSAPropagationCallGraphBuilder;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.util.CancelException;
|
||||
|
@ -62,7 +63,7 @@ public class CallGraphTestUtil {
|
|||
S.start();
|
||||
}
|
||||
|
||||
CallGraphBuilder builder = Util.makeRTABuilder(options, cache, cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeRTABuilder(options, cache, cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
if (CHECK_FOOTPRINT) {
|
||||
|
@ -101,7 +102,7 @@ public class CallGraphTestUtil {
|
|||
S.start();
|
||||
}
|
||||
|
||||
CallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, cache, cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeVanillaZeroOneCFABuilder(options, cache, cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
if (CHECK_FOOTPRINT) {
|
||||
|
@ -119,7 +120,7 @@ public class CallGraphTestUtil {
|
|||
S.start();
|
||||
}
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cache, cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, cache, cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
if (testPAtoString) {
|
||||
builder.getPointerAnalysis().toString();
|
||||
|
@ -140,7 +141,7 @@ public class CallGraphTestUtil {
|
|||
S.start();
|
||||
}
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroContainerCFABuilder(options, cache, cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroContainerCFABuilder(options, cache, cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
if (CHECK_FOOTPRINT) {
|
||||
|
@ -158,7 +159,7 @@ public class CallGraphTestUtil {
|
|||
S.start();
|
||||
}
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
if (CHECK_FOOTPRINT) {
|
||||
|
|
|
@ -41,8 +41,8 @@ public class DebuggingBitsetCallGraphTest extends WalaTestCase {
|
|||
graphTest = new CallGraphTest();
|
||||
}
|
||||
|
||||
private void runBitsetTest(MutableIntSetFactory p, MutableIntSetFactory s) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
MutableIntSetFactory save = IntSetUtil.getDefaultIntSetFactory();
|
||||
private void runBitsetTest(MutableIntSetFactory<?> p, MutableIntSetFactory<?> s) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
MutableIntSetFactory<?> save = IntSetUtil.getDefaultIntSetFactory();
|
||||
try {
|
||||
IntSetUtil.setDefaultIntSetFactory(new DebuggingMutableIntSetFactory(p, s));
|
||||
graphTest.testJLex();
|
||||
|
|
|
@ -34,6 +34,7 @@ import com.ibm.wala.ipa.callgraph.CallGraph;
|
|||
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
|
||||
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Util;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchy;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
|
||||
|
@ -74,7 +75,7 @@ public class NullPointerExceptionInterTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, "Lcfg/exc/inter/CallFieldAccess");
|
||||
AnalysisOptions options = new AnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeNCFABuilder(1, options, cache, cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeNCFABuilder(1, options, cache, cha, scope);
|
||||
cg = builder.makeCallGraph(options, null);
|
||||
} catch (ClassHierarchyException e) {
|
||||
throw new Exception(e);
|
||||
|
|
|
@ -63,7 +63,7 @@ public class SourceMapTest extends WalaTestCase {
|
|||
String sourceFile = klass.getSourceFileName();
|
||||
Assert.assertTrue(sourceFile != null);
|
||||
System.err.println("Source file: " + sourceFile);
|
||||
Module container = ((BytecodeClass)klass).getContainer();
|
||||
Module container = ((BytecodeClass<?>)klass).getContainer();
|
||||
Assert.assertTrue(container != null);
|
||||
System.err.println("container: " + container);
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ public abstract class AbstractPtrTest {
|
|||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
final AnalysisCache analysisCache = new AnalysisCacheImpl();
|
||||
CallGraphBuilder cgBuilder = Util.makeZeroCFABuilder(options, analysisCache, cha, scope);
|
||||
CallGraphBuilder<InstanceKey> cgBuilder = Util.makeZeroCFABuilder(options, analysisCache, cha, scope);
|
||||
final CallGraph cg = cgBuilder.makeCallGraph(options, null);
|
||||
// System.err.println(cg.toString());
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public class ExceptionAnalysis2EdgeFilterTest {
|
|||
ReferenceCleanser.registerClassHierarchy(cha);
|
||||
AnalysisCache cache = new AnalysisCacheImpl();
|
||||
ReferenceCleanser.registerCache(cache);
|
||||
CallGraphBuilder builder = Util.makeZeroCFABuilder(options, cache, cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroCFABuilder(options, cache, cha, scope);
|
||||
cg = builder.makeCallGraph(options, null);
|
||||
pointerAnalysis = builder.getPointerAnalysis();
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ExceptionAnalysisTest {
|
|||
ReferenceCleanser.registerClassHierarchy(cha);
|
||||
AnalysisCache cache = new AnalysisCacheImpl();
|
||||
ReferenceCleanser.registerCache(cache);
|
||||
CallGraphBuilder builder = Util.makeZeroCFABuilder(options, cache, cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroCFABuilder(options, cache, cha, scope);
|
||||
cg = builder.makeCallGraph(options, null);
|
||||
pointerAnalysis = builder.getPointerAnalysis();
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public class MultiDimArrayTest extends WalaTestCase {
|
|||
.makeMainEntrypoints(scope, cha, TestConstants.MULTI_DIM_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCacheImpl(),cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCacheImpl(),cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class TypeBasedArrayAliasTest extends WalaTestCase {
|
|||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
// RTA yields a TypeBasedPointerAnalysis
|
||||
CallGraphBuilder builder = Util.makeRTABuilder(options, new AnalysisCacheImpl(),cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeRTABuilder(options, new AnalysisCacheImpl(),cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ZeroLengthArrayTest {
|
|||
TestConstants.ZERO_LENGTH_ARRAY_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
|
||||
// System.err.println(pa);
|
||||
|
|
|
@ -128,7 +128,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE1_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -159,7 +159,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE2_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMethod(cg, "baz");
|
||||
|
@ -184,7 +184,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE3_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMethod(cg, "main");
|
||||
|
@ -208,7 +208,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE4_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -232,7 +232,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE5_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode n = findMethod(cg, "baz");
|
||||
|
@ -263,7 +263,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE7_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneContainerCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -342,7 +342,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTCD1);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -366,7 +366,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTCD2);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -390,7 +390,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTCD3);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -414,7 +414,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTCD4);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -445,7 +445,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTCD5);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -471,7 +471,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTCD5);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -497,7 +497,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTCD6);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -522,7 +522,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTID);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -546,7 +546,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTARRAYS);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -571,7 +571,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTFIELDS);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -596,7 +596,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTTHIN1);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -631,7 +631,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTGLOBAL);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -657,7 +657,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTMULTITARGET);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -681,7 +681,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTRECURSION);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -707,7 +707,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TEST_PRIM_GETTER_SETTER);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode test = findMethod(cg, "test");
|
||||
|
@ -776,7 +776,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTTHROWCATCH);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -802,7 +802,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTMESSAGEFORMAT);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -828,7 +828,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTINETADDR);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
SDG<?> sdg = new SDG<>(cg, builder.getPointerAnalysis(), DataDependenceOptions.NO_BASE_NO_HEAP, ControlDependenceOptions.FULL);
|
||||
GraphIntegrity.check(sdg);
|
||||
|
@ -843,7 +843,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_JUSTTHROW);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
|
|
@ -157,7 +157,7 @@ public class CompareToZeroOneCFADriver {
|
|||
|
||||
// now, run our analysis
|
||||
// build an RTA call graph
|
||||
CallGraphBuilder rtaBuilder = Util.makeRTABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> rtaBuilder = Util.makeRTABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
final CallGraph cg = rtaBuilder.makeCallGraph(options, null);
|
||||
// System.err.println(cg.toString());
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ public class TestAgainstSimpleDriver {
|
|||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
// build an RTA call graph
|
||||
CallGraphBuilder rtaBuilder = Util.makeRTABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> rtaBuilder = Util.makeRTABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
final CallGraph cg = rtaBuilder.makeCallGraph(options, null);
|
||||
// System.err.println(cg.toString());
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.ibm.wala.ipa.callgraph.Entrypoint;
|
|||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Util;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
import com.ibm.wala.ipa.cfg.BasicBlockInContext;
|
||||
import com.ibm.wala.ipa.cfg.ExplodedInterproceduralCFG;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
|
@ -150,7 +151,7 @@ public class DataflowTest extends WalaTestCase {
|
|||
"Ldataflow/StaticDataflow");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
ExplodedInterproceduralCFG icfg = ExplodedInterproceduralCFG.make(cg);
|
||||
ContextInsensitiveReachingDefs reachingDefs = new ContextInsensitiveReachingDefs(icfg, cha);
|
||||
|
@ -182,7 +183,7 @@ public class DataflowTest extends WalaTestCase {
|
|||
"Ldataflow/StaticDataflow");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
ContextSensitiveReachingDefs reachingDefs = new ContextSensitiveReachingDefs(cg);
|
||||
TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, Pair<CGNode, Integer>> result = reachingDefs.analyze();
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
|
|||
import com.ibm.wala.ipa.callgraph.CallGraphBuilderCancelException;
|
||||
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Util;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
import com.ibm.wala.ipa.cfg.BasicBlockInContext;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
|
||||
|
@ -68,7 +69,7 @@ public class InitializerTest {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, "LstaticInit/TestStaticInit");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = null;
|
||||
try {
|
||||
cg = builder.makeCallGraph(options, null);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class JavaViewerDriver {
|
|||
// //
|
||||
// build the call graph
|
||||
// //
|
||||
com.ibm.wala.ipa.callgraph.CallGraphBuilder builder = Util.makeZeroCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
com.ibm.wala.ipa.callgraph.CallGraphBuilder<InstanceKey> builder = Util.makeZeroCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.ibm.wala.ipa.callgraph.CallGraph;
|
|||
import com.ibm.wala.ipa.callgraph.CallGraphStats;
|
||||
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Util;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.LocalPointerKey;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchy;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
|
||||
|
@ -156,7 +157,7 @@ public class PDFCallGraph {
|
|||
// //
|
||||
// build the call graph
|
||||
// //
|
||||
com.ibm.wala.ipa.callgraph.CallGraphBuilder builder = Util.makeZeroCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
com.ibm.wala.ipa.callgraph.CallGraphBuilder<InstanceKey> builder = Util.makeZeroCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
System.err.println(CallGraphStats.getStats(cg));
|
||||
|
|
|
@ -155,7 +155,7 @@ public class PDFSlice {
|
|||
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
|
||||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, mainClass);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
// CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new
|
||||
// AnalysisCache(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.ibm.wala.ipa.callgraph.CallGraphStats;
|
|||
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.impl.DefaultEntrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Util;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
|
@ -82,7 +83,7 @@ public class ScopeFileCallGraph {
|
|||
// options.setReflectionOptions(ReflectionOptions.NONE);
|
||||
AnalysisCache cache = new AnalysisCacheImpl();
|
||||
// other builders can be constructed with different Util methods
|
||||
CallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
|
||||
CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
|
||||
// CallGraphBuilder builder = Util.makeNCFABuilder(2, options, cache, cha, scope);
|
||||
// CallGraphBuilder builder = Util.makeVanillaNCFABuilder(2, options, cache, cha, scope);
|
||||
System.out.println("building call graph...");
|
||||
|
|
|
@ -153,7 +153,7 @@ public class DemandCastChecker {
|
|||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
System.err.print("constructing call graph...");
|
||||
final Pair<CallGraph, PointerAnalysis> cgAndPA = buildCallGraph(scope, cha, options);
|
||||
final Pair<CallGraph, PointerAnalysis<InstanceKey>> cgAndPA = buildCallGraph(scope, cha, options);
|
||||
CallGraph cg = cgAndPA.fst;
|
||||
System.err.println("done");
|
||||
System.err.println(CallGraphStats.getStats(cg));
|
||||
|
@ -182,12 +182,12 @@ public class DemandCastChecker {
|
|||
* @throws CancelException
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
private static Pair<CallGraph, PointerAnalysis> buildCallGraph(AnalysisScope scope, ClassHierarchy cha, AnalysisOptions options)
|
||||
private static Pair<CallGraph, PointerAnalysis<InstanceKey>> buildCallGraph(AnalysisScope scope, ClassHierarchy cha, AnalysisOptions options)
|
||||
throws IllegalArgumentException, CancelException {
|
||||
CallGraph retCG = null;
|
||||
PointerAnalysis retPA = null;
|
||||
PointerAnalysis<InstanceKey> retPA = null;
|
||||
final AnalysisCache cache = new AnalysisCacheImpl();
|
||||
CallGraphBuilder builder;
|
||||
CallGraphBuilder<InstanceKey> builder;
|
||||
if (CHEAP_CG) {
|
||||
builder = Util.makeZeroCFABuilder(options, cache, cha, scope);
|
||||
// we want vanilla 0-1 CFA, which has one abstract loc per allocation
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue