Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
7cc2b5c8f5
|
@ -34,12 +34,12 @@ org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
|
|||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
|
||||
|
@ -58,7 +58,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
|
|||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=error
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=error
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
|
||||
|
@ -82,6 +82,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
|
|||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
|
|
|
@ -91,6 +91,11 @@ public class FakeExceptionTypeBinding implements ITypeBinding {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return exceptionBinaryName.hashCode();
|
||||
}
|
||||
|
||||
// --- rest not needed
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,12 +27,12 @@ org.eclipse.jdt.core.compiler.problem.deprecation=error
|
|||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
|
@ -46,19 +46,19 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
|||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
|
||||
|
@ -72,18 +72,18 @@ org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
|||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
|
@ -96,6 +96,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
|
|||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
|
|
|
@ -20,8 +20,10 @@ public class AnonymousClass {
|
|||
Foo f= new Foo() {
|
||||
int value = 3;
|
||||
|
||||
@Override
|
||||
public int getValue() { return value; }
|
||||
|
||||
@Override
|
||||
public int getValueBase() { return value - base.intValue(); }
|
||||
};
|
||||
|
||||
|
@ -38,6 +40,7 @@ public class AnonymousClass {
|
|||
int y;
|
||||
|
||||
|
||||
@Override
|
||||
public abstract int getValue();
|
||||
|
||||
FooImpl(int _y) {
|
||||
|
@ -45,6 +48,7 @@ public class AnonymousClass {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getValueBase() {
|
||||
return y + getValue() - base.intValue();
|
||||
}
|
||||
|
@ -52,6 +56,7 @@ public class AnonymousClass {
|
|||
|
||||
Foo f= new FooImpl(-4) {
|
||||
|
||||
@Override
|
||||
public int getValue() { return 7; }
|
||||
};
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ public class FunkySupers {
|
|||
|
||||
class SubFunkySupers extends FunkySupers {
|
||||
|
||||
@Override
|
||||
int funky(FunkySupers fs) {
|
||||
SubFunkySupers.super.funky(fs);
|
||||
SubFunkySupers.this.funky(fs);
|
||||
|
|
|
@ -32,10 +32,12 @@ class Base {
|
|||
}
|
||||
class Derived extends Base {
|
||||
|
||||
@Override
|
||||
public void foo() {
|
||||
super.foo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String bar(int x) {
|
||||
return Integer.toHexString(x);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ public class InnerClassLexicalReads {
|
|||
* 1 return v2:com.ibm.wala.ssa.SymbolTable$1@16b18b6[11:4] -> [11:13]
|
||||
*/
|
||||
|
||||
@Override
|
||||
public int getConstant() {
|
||||
return y;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ class FooIT1 implements IFoo {
|
|||
fValue= ch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getValue() {
|
||||
return fValue;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ abstract class PrimitiveWrapper {
|
|||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
|
||||
@Override
|
||||
abstract public boolean equals(Object o);
|
||||
}
|
||||
|
||||
|
@ -49,6 +50,7 @@ final class IntWrapper extends PrimitiveWrapper {
|
|||
* @see com.ibm.miniatur.tests.sequential.PrimitiveWrapper#intValue()
|
||||
*/
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("javadoc")
|
||||
public int intValue() {
|
||||
return val;
|
||||
|
@ -59,6 +61,7 @@ final class IntWrapper extends PrimitiveWrapper {
|
|||
* @see com.ibm.miniatur.tests.sequential.PrimitiveWrapper#setIntValue(int)
|
||||
*/
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("javadoc")
|
||||
public void setIntValue(int i) {
|
||||
this.val = i;
|
||||
|
@ -69,6 +72,7 @@ final class IntWrapper extends PrimitiveWrapper {
|
|||
* @see com.ibm.miniatur.tests.sequential.PrimitiveWrapper#equals(java.lang.Object)
|
||||
*/
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("javadoc")
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof IntWrapper && ((IntWrapper)o).val==val;
|
||||
|
|
|
@ -14,6 +14,7 @@ interface ISimpleCalls {
|
|||
}
|
||||
public class SimpleCalls implements ISimpleCalls {
|
||||
|
||||
@Override
|
||||
public void helloWorld() {
|
||||
System.out.println("hello world!");
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ class R implements Runnable {
|
|||
R(int i) { this.i = i; }
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ public class SimpleNames {
|
|||
final int i = 5;
|
||||
new Object() {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
f = 5; // SimpleNames.this = 5
|
||||
s = 6; // SimpleNames.s = 6
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -76,6 +76,7 @@ public class ConstructorsAndInitializers extends Super {
|
|||
iX = 55 + 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return s + " -- from an anon class in " + iX + "," + sX + ": " + ConstructorsAndInitializers.this.s;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ public class InnerClasses extends Temp {
|
|||
Object supportLocalBusiness() {
|
||||
final int x = 54;
|
||||
class FooBar {
|
||||
@Override
|
||||
public int hashCode() { return x; }
|
||||
}
|
||||
return new FooBar();
|
||||
|
@ -53,6 +54,7 @@ public class InnerClasses extends Temp {
|
|||
static Object anonymousCoward() {
|
||||
final int x = 5;
|
||||
return new Object() {
|
||||
@Override
|
||||
public int hashCode() { return x; }
|
||||
};
|
||||
}
|
||||
|
@ -64,6 +66,7 @@ public class InnerClasses extends Temp {
|
|||
System.out.println(anonymousCoward().hashCode());
|
||||
final String xx = "crazy";
|
||||
Outie outie = new Outie("weird") {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "bogus" + x + xx + xxxx;
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ public class MethodMadness {
|
|||
return 13 + x;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int protectedInteger() {
|
||||
return 233 + x;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ public class AnonGeneNullarySimple {
|
|||
|
||||
static class StrTripler implements Ops<String> {
|
||||
|
||||
@Override
|
||||
public String nullary() {
|
||||
String x = "talk about it ";
|
||||
return x+x+x;
|
||||
|
|
|
@ -49,10 +49,12 @@ public class AnonymousGenerics {
|
|||
// get erasures for all of those types and make a new method
|
||||
// that calls this one (with casts). no worries about return values.
|
||||
|
||||
@Override
|
||||
public String unary(String x) {
|
||||
return x + x + x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String nullary() {
|
||||
String x = "talk about it ";
|
||||
return x+x+x;
|
||||
|
@ -66,10 +68,12 @@ public class AnonymousGenerics {
|
|||
private void doit() {
|
||||
Ops<String> strQuadrupler = new Ops<String>() {
|
||||
|
||||
@Override
|
||||
public String unary(String x) {
|
||||
return x+x+x+x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String nullary() {
|
||||
String x = "time to make a move to the global economy ";
|
||||
return x+x+x+x;
|
||||
|
|
|
@ -43,10 +43,12 @@ public class Cocovariant {
|
|||
}
|
||||
static class B extends A {
|
||||
|
||||
@Override
|
||||
B foo(String x) { return null; }
|
||||
}
|
||||
static class C extends B {
|
||||
|
||||
@Override
|
||||
C foo(String x) { return null; }
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
|
|
|
@ -52,6 +52,7 @@ class ConcreteGeneric<Q> implements IGeneric<Q> {
|
|||
Q x;
|
||||
|
||||
|
||||
@Override
|
||||
public Q bar(Q a, Q b) {
|
||||
x = a;
|
||||
if (b.hashCode() == a.hashCode() || b.toString().equals(a.toString()))
|
||||
|
@ -60,6 +61,7 @@ class ConcreteGeneric<Q> implements IGeneric<Q> {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Q foo() {
|
||||
return x;
|
||||
}
|
||||
|
@ -71,6 +73,7 @@ class ConcreteGeneric2<Q> extends ConcreteGeneric<Q> {
|
|||
y = a;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Q foo() {
|
||||
return y;
|
||||
}
|
||||
|
|
|
@ -46,17 +46,20 @@ public class GenericMemberClasses<T>
|
|||
T x = null;
|
||||
private int localChangeID;
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return ( localChangeID == 5 );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public T next() {
|
||||
localChangeID = 5;
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ public class MoreOverriddenGenerics {
|
|||
|
||||
class Sub extends Super<Number> {
|
||||
|
||||
@Override
|
||||
public Number get() {
|
||||
return super.get();
|
||||
}
|
||||
|
@ -55,6 +56,7 @@ public class MoreOverriddenGenerics {
|
|||
|
||||
class SubSub extends Sub {
|
||||
|
||||
@Override
|
||||
public Long get() {
|
||||
return new Long(6);
|
||||
}
|
||||
|
|
|
@ -40,12 +40,16 @@ package javaonepointfive;
|
|||
public class NotSoSimpleEnums {
|
||||
public enum Direction {
|
||||
NORTH("nord") {
|
||||
@Override
|
||||
public Direction getOpposite() { return SOUTH; }},
|
||||
EAST("est") {
|
||||
@Override
|
||||
public Direction getOpposite() { return WEST; }},
|
||||
SOUTH("sud") {
|
||||
@Override
|
||||
public Direction getOpposite() { return NORTH; }},
|
||||
WEST("ouest") {
|
||||
@Override
|
||||
public Direction getOpposite() { return EAST; }};
|
||||
|
||||
public abstract Direction getOpposite();
|
||||
|
|
|
@ -44,6 +44,7 @@ public class OverridesOnePointFour {
|
|||
|
||||
static class Sub implements Super {
|
||||
|
||||
@Override
|
||||
public Long get() {
|
||||
return new Long(6);
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ public class VarargsCovariant {
|
|||
|
||||
static class B extends A {
|
||||
|
||||
@Override
|
||||
B hello(int... x) {
|
||||
System.out.println("b hello");
|
||||
return this;
|
||||
|
|
|
@ -70,6 +70,7 @@ class VarityTestSuper {
|
|||
|
||||
class VarityTestSub extends VarityTestSuper {
|
||||
|
||||
@Override
|
||||
void bar(String... args) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariable
|
|||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
|
||||
|
@ -96,6 +96,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
|
|||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -45,7 +45,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
|||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
|
||||
|
@ -72,7 +72,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
|
|||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=error
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=error
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
|
@ -96,6 +96,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
|
|||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -26,7 +26,7 @@ org.eclipse.jdt.core.compiler.problem.deprecation=error
|
|||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
|
||||
|
@ -95,6 +95,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
|
|||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
|
|
|
@ -55,7 +55,7 @@ public class NuValidatorHtmlParser implements IHtmlParser {
|
|||
parser.setXmlPolicy(XmlViolationPolicy.ALLOW);
|
||||
parser.setContentHandler(new ContentHandler() {
|
||||
private Locator locator;
|
||||
private Stack<ITag> tags = new Stack<>();;
|
||||
private Stack<ITag> tags = new Stack<>();
|
||||
|
||||
private int countLines(char[] ch, int start, int length) {
|
||||
LineNumberReader r = new LineNumberReader(new StringReader (new String(ch, start, length)));
|
||||
|
|
|
@ -95,6 +95,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
|
|||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=error
|
||||
|
|
|
@ -45,7 +45,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
|||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
|
||||
|
@ -72,7 +72,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
|
|||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
|
||||
|
@ -83,7 +83,7 @@ org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
|
|||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
|
@ -96,6 +96,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
|
|||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -132,7 +132,7 @@ public class NodejsRequireTargetSelector implements MethodTargetSelector {
|
|||
return calledMethod;
|
||||
}
|
||||
|
||||
private JavaScriptInvoke getInvokeInstruction(CGNode caller, CallSiteReference site) {
|
||||
private static JavaScriptInvoke getInvokeInstruction(CGNode caller, CallSiteReference site) {
|
||||
IR callerIR = caller.getIR();
|
||||
SSAAbstractInvokeInstruction callInstrs[] = callerIR.getCalls(site);
|
||||
assert callInstrs.length == 1;
|
||||
|
|
|
@ -110,12 +110,12 @@ public class NodejsRequiredSourceModule extends SourceFileModule {
|
|||
return className;
|
||||
}
|
||||
|
||||
private void loadWrapperSources() throws IOException {
|
||||
private static void loadWrapperSources() throws IOException {
|
||||
MODULE_WRAPPER_SOURCE = loadWrapperSource(MODULE_WRAPPER_FILENAME);
|
||||
JSON_WRAPPER_SOURCE = loadWrapperSource(JSON_WRAPPER_FILENAME);
|
||||
}
|
||||
|
||||
private String loadWrapperSource(String filename) throws IOException {
|
||||
private static String loadWrapperSource(String filename) throws IOException {
|
||||
InputStream url = NodejsRequiredSourceModule.class.getClassLoader().getResourceAsStream(filename);
|
||||
return new String(Streams.inputStream2ByteArray(url));
|
||||
}
|
||||
|
|
|
@ -96,6 +96,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
|
|||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
|
|
|
@ -72,7 +72,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
|
|||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=error
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=error
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
|
||||
|
@ -96,6 +96,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
|
|||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
|
|
|
@ -2394,7 +2394,7 @@ private CAstNode[] walkChildren(final Node n, WalkContext context) {
|
|||
public void warning(String arg0, String arg1, int arg2, String arg3, int arg4) {
|
||||
// ignore warnings
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
CAstErrorReporter reporter = new CAstErrorReporter();
|
||||
CompilerEnvirons compilerEnv = new CompilerEnvirons();
|
||||
|
|
|
@ -71,12 +71,12 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
|
|||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=error
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=error
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
|
||||
|
@ -95,6 +95,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
|
|||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
|
|
|
@ -54,7 +54,7 @@ import com.ibm.wala.util.functions.Function;
|
|||
*
|
||||
*/
|
||||
public class FieldBasedCGUtil {
|
||||
public static enum BuilderType { PESSIMISTIC, OPTIMISTIC, OPTIMISTIC_WORKLIST };
|
||||
public static enum BuilderType { PESSIMISTIC, OPTIMISTIC, OPTIMISTIC_WORKLIST }
|
||||
|
||||
private final JavaScriptTranslatorFactory translatorFactory;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -31,7 +31,7 @@ org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
|||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
|
@ -45,7 +45,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
|||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
|
||||
|
@ -72,7 +72,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
|
|||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=error
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=error
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
|
@ -96,6 +96,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
|||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
|
|
|
@ -81,7 +81,6 @@ public class JSTypeInference extends AstTypeInference {
|
|||
result = new DeclaredTypeOperator(new ConeType(cha.getRootClass()));
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
class JSTypeVarFactory extends TypeVarFactory {
|
||||
|
||||
|
@ -104,7 +103,6 @@ public class JSTypeInference extends AstTypeInference {
|
|||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
init(ir, new JSTypeVarFactory(), new JSTypeOperatorFactory());
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
|
|||
|
||||
public class PrototypeFieldVertex extends Vertex implements PointerKey {
|
||||
|
||||
public enum PrototypeField { __proto__, prototype };
|
||||
public enum PrototypeField { __proto__, prototype }
|
||||
|
||||
private final PrototypeField field;
|
||||
private final ObjectVertex type;
|
||||
|
|
|
@ -116,7 +116,7 @@ public abstract class JavaScriptAnalysisEngine<I extends InstanceKey> extends Ab
|
|||
}
|
||||
|
||||
public static class FieldBasedJavaScriptAnalysisEngine extends JavaScriptAnalysisEngine<ObjectVertex> {
|
||||
public enum BuilderType { PESSIMISTIC, OPTIMISTIC, REFLECTIVE };
|
||||
public enum BuilderType { PESSIMISTIC, OPTIMISTIC, REFLECTIVE }
|
||||
|
||||
private BuilderType builderType = BuilderType.OPTIMISTIC;
|
||||
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -125,7 +125,7 @@ public class RangeFileMapping implements FileMapping {
|
|||
public String toString() {
|
||||
return "[include:"+includePosition+"]"+super.toString();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return new Pos();
|
||||
} else {
|
||||
|
|
|
@ -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()");
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ public class JSCallGraphUtil extends com.ibm.wala.cast.ipa.callgraph.CAstCallGra
|
|||
public URL getURL() {
|
||||
return url;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Module getPrologueFile(final String name) {
|
||||
return new Bootstrap(name, JSCallGraphUtil.class.getClassLoader().getResourceAsStream(name), JSCallGraphUtil.class.getClassLoader().getResource(name));
|
||||
|
|
|
@ -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);
|
||||
|
@ -390,13 +390,13 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
public void visitPrototypeLookup(PrototypeLookup instruction) {
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ImplicitPointsToSetVisitor makeImplicitPointsToVisitor(LocalPointerKey lpk) {
|
||||
return new JSImplicitPointsToSetVisitor(this, lpk);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropagationSystem makeSystem(AnalysisOptions options) {
|
||||
|
@ -639,7 +639,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
public String toString() {
|
||||
return "sub-dispatch for " + instruction + ": " + receiverType + ", " + fieldKey;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
system.newSideEffect(new FieldValueDispatch(), fieldKey);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ public class PropertyNameContextSelector implements ContextSelector {
|
|||
this.base = base;
|
||||
}
|
||||
|
||||
private enum Frequency { NEVER, SOMETIMES, ALWAYS };
|
||||
private enum Frequency { NEVER, SOMETIMES, ALWAYS }
|
||||
private final HashMap<MethodReference, Frequency> usesFirstArgAsPropertyName_cache = HashMapFactory.make();
|
||||
|
||||
/** Determine whether the method never/sometimes/always uses its first argument as a property name. */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class PropertyReadExpander extends CAstRewriter<PropertyReadExpander.Rewr
|
|||
this.elementTemp = elementTemp;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
private final static RewriteContext READ = new RewriteContext() {
|
||||
@Override
|
||||
|
|
|
@ -45,7 +45,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
|||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
|
||||
|
@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariable
|
|||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
|
||||
|
@ -95,6 +95,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
|||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
CAST_TEST_BIN = /private/tmp/WALA/com.ibm.wala.cast.test/target/classes/
|
||||
# -*- makefile -*-
|
||||
|
||||
SCRIPT_NAME := $(realpath $(lastword $(MAKEFILE_LIST)))
|
||||
C_DIR := $(dir $(SCRIPTINAME))
|
||||
CAST_TEST_DIR := $(realpath $(C_DIR)../..)/
|
||||
CAST_TEST_BIN := $(CAST_TEST_DIR)target/classes/
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_NAME=`realpath $0`
|
||||
C_DIR=`dirname $SCRIPT_NAME`
|
||||
CAST_TEST_DIR=`realpath $C_DIR/../..`
|
||||
|
||||
pushd $CAST_TEST_DIR/harness-src/c
|
||||
|
||||
cat > $CAST_TEST_DIR/harness-src/c/Makefile.configuration <<EOF
|
||||
CAST_TEST_BIN = $CAST_TEST_DIR/target/classes/
|
||||
EOF
|
||||
|
||||
make
|
||||
|
||||
make main
|
||||
|
||||
popd
|
|
@ -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();) {
|
||||
|
|
|
@ -19,9 +19,25 @@
|
|||
<execution>
|
||||
<phase>compile</phase>
|
||||
<configuration>
|
||||
<executable>bash</executable>
|
||||
<executable>make</executable>
|
||||
<arguments>
|
||||
<argument>${basedir}/harness-src/c/cbuild.sh</argument>
|
||||
<argument>default</argument>
|
||||
<argument>main</argument>
|
||||
</arguments>
|
||||
<workingDirectory>${basedir}/harness-src/c</workingDirectory>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-native</id>
|
||||
<phase>test</phase>
|
||||
<configuration>
|
||||
<workingDirectory>${basedir}</workingDirectory>
|
||||
<executable>${project.build.outputDirectory}/smoke_main</executable>
|
||||
<arguments>
|
||||
<argument>target/classes:../com.ibm.wala.cast/target/classes:../com.ibm.wala.core/target/classes:../com.ibm.wala.util/target/classes</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
<goals>
|
||||
|
|
|
@ -32,7 +32,7 @@ org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
|||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
|
@ -46,7 +46,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
|||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
|
||||
|
@ -73,12 +73,12 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
|
|||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=error
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=error
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
|
||||
|
@ -97,6 +97,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
|||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<arguments>
|
||||
<argument>${basedir}/source/c/cbuild.sh</argument>
|
||||
</arguments>
|
||||
<workingDirectory>${basedir}/source/c</workingDirectory>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
Makefile.configuration
|
||||
CAstWrapper.lib
|
||||
CAstWrapper.exp
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
JAVA_SDK = /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/
|
||||
DOMO_AST_BIN = /private/tmp/WALA/com.ibm.wala.cast/target/classes/
|
||||
JAVAH_CLASS_PATH = :/private/tmp/WALA/com.ibm.wala.cast/target/classes/
|
||||
TRACE =
|
||||
JNI_MD_DIR = darwin
|
||||
# -*- makefile -*-
|
||||
|
||||
# configuration of installed Java SDK
|
||||
JRE_DIR := $(shell java -XshowSettings:properties -version 2>&1 | sed -n 's/^ *java\.home = \(.*\)/\1/p')/
|
||||
JAVA_SDK := $(realpath $(JRE_DIR)..)/
|
||||
JNI_MD_DIR := $(notdir $(patsubst %/,%,$(dir $(wildcard $(JAVA_SDK)include/*/jni_md.h))))
|
||||
|
||||
# configuration of WALA build tree
|
||||
CAST_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))../..)/
|
||||
DOMO_AST_BIN := $(CAST_DIR)target/classes/
|
||||
JAVAH_CLASS_PATH := :$(CAST_DIR)target/classes/
|
||||
TRACE :=
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
#
|
||||
# global configuration. adjust for your system.
|
||||
#
|
||||
|
||||
# The root of the java SDK to use (must end in /)
|
||||
JAVA_SDK = /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/
|
||||
|
||||
# Path .class files of the com.ibm.domo.ast Java code (must end in /)
|
||||
DOMO_AST_BIN = /Users/dolby/git/WALA/com.ibm.wala.cast/bin/
|
||||
|
||||
# Extra stuff needed in the classpath of javah (must start with path separator)
|
||||
JAVAH_CLASS_PATH =
|
||||
|
||||
# enable debugging flags
|
||||
TRACE =
|
||||
|
||||
# low-level JNI path
|
||||
JNI_MD_DIR = darwin
|
|
@ -1,15 +0,0 @@
|
|||
#
|
||||
# global configuration. adjust for your system.
|
||||
#
|
||||
|
||||
# The root of the java SDK to use (must end in /)
|
||||
JAVA_SDK = /System/Library/Frameworks/JavaVM.framework/Home/
|
||||
|
||||
# Path .class files of the com.ibm.domo.ast Java code (must end in /)
|
||||
DOMO_AST_BIN = <Workspace>/com.ibm.wala.cast/bin/
|
||||
|
||||
# Extra stuff needed in the classpath of javah (must start with path separator)
|
||||
JAVAH_CLASS_PATH = :<Workspace>/com.ibm.wala.cast/bin/
|
||||
|
||||
# enable debugging flags
|
||||
TRACE =
|
|
@ -1,36 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT=`realpath $0`
|
||||
C_DIR=`dirname $SCRIPT`
|
||||
CAST_DIR=`realpath $C_DIR/../..`
|
||||
|
||||
pushd $CAST_DIR/source/c
|
||||
|
||||
cat > /tmp/JrePath.java <<EOF
|
||||
class JrePath {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(System.getProperty("java.home"));
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
pushd /tmp
|
||||
javac JrePath.java
|
||||
JRE_DIR=`java JrePath`
|
||||
JDK_DIR=`realpath $JRE_DIR/..`
|
||||
popd
|
||||
|
||||
JNI_MD_H=`ls $JDK_DIR/include/*/jni_md.h`
|
||||
JNI_MD_PATH=`dirname $JNI_MD_H`
|
||||
JNI_MD_DIR=`basename $JNI_MD_PATH`
|
||||
|
||||
cat > $CAST_DIR/source/c/Makefile.configuration <<EOF
|
||||
JAVA_SDK = $JDK_DIR/
|
||||
DOMO_AST_BIN = $CAST_DIR/target/classes/
|
||||
JAVAH_CLASS_PATH = :$CAST_DIR/target/classes/
|
||||
TRACE =
|
||||
JNI_MD_DIR = $JNI_MD_DIR
|
||||
EOF
|
||||
#!/bin/bash -eu
|
||||
|
||||
if (uname | grep -i "cygwin"); then
|
||||
# This should be the default for most of cases;
|
||||
|
@ -43,4 +11,6 @@ else
|
|||
make
|
||||
fi
|
||||
|
||||
popd
|
||||
# Local variables:
|
||||
# eval: (smie-config-local '((8 :after "else" 2) (8 :elem basic 2)))
|
||||
# End:
|
||||
|
|
|
@ -123,6 +123,8 @@ public:
|
|||
|
||||
CAstWrapper(JNIEnv *env, Exceptions &ex, jobject Ast);
|
||||
|
||||
virtual ~CAstWrapper() { }
|
||||
|
||||
void assertIsCAstNode(jobject, int);
|
||||
|
||||
jobject makeNode(int);
|
||||
|
|
|
@ -37,7 +37,14 @@ extern "C" {
|
|||
|
||||
#define CATCH() \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define START_CATCH_BLOCK() \
|
||||
} else {
|
||||
|
||||
#define END_CATCH_BLOCK() \
|
||||
} \
|
||||
}
|
||||
|
||||
#define THROW(CPP_EXP_NAME, MESSAGE) \
|
||||
(CPP_EXP_NAME).throwException(__FILE__, __LINE__, MESSAGE)
|
||||
|
|
|
@ -73,7 +73,7 @@ public abstract class AstTypeInference extends TypeInference {
|
|||
public void visitEcho(AstEchoInstruction inst) {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public AstTypeInference(IR ir, IClassHierarchy cha, TypeAbstraction booleanType, boolean doPrimitives) {
|
||||
super(ir, doPrimitives);
|
||||
|
|
|
@ -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;
|
||||
|
@ -240,7 +240,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -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);
|
||||
|
@ -1209,7 +1209,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
system.newConstraint(fieldKey, assignOperator, rhs);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void newFieldWrite(CGNode opNode, int objVn, int fieldsVn, final PointerKey rhs) {
|
||||
newFieldOperation(opNode, objVn, fieldsVn, false, new NormalWriter(rhs));
|
||||
|
|
|
@ -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++)
|
||||
|
@ -1385,7 +1385,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
|
||||
public static enum ScopeType {
|
||||
LOCAL, GLOBAL, SCRIPT, FUNCTION, TYPE
|
||||
};
|
||||
}
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
|
@ -1556,7 +1556,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
public Scope getDefiningScope() {
|
||||
return definingScope;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public abstract class AbstractScope implements Scope {
|
||||
private final Scope parent;
|
||||
|
@ -1711,7 +1711,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
|
||||
@Override
|
||||
public abstract CAstEntity getEntity();
|
||||
};
|
||||
}
|
||||
|
||||
protected AbstractScope makeScriptScope(final CAstEntity s, Scope parent) {
|
||||
return new AbstractScope(parent) {
|
||||
|
@ -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 {
|
||||
|
@ -2982,7 +2982,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* record that in entity e, the access is performed.
|
||||
|
@ -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
|
||||
|
@ -4791,7 +4784,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
return globalScope;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* translate module, represented by {@link CAstEntity} N
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -215,6 +215,6 @@ public interface TranslatorToCAst {
|
|||
breakNode);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue