Merge branch 'warning-fixes-plug-in-development-misc' of https://github.com/liblit/WALA

This commit is contained in:
Julian Dolby 2017-06-22 09:27:47 +02:00
commit 163e10f5e4
189 changed files with 578 additions and 316 deletions

View File

@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WALA CAst Java ECJ frontend
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java.ecj
Bundle-Version: 1.4.3.qualifier
Bundle-Vendor: IBM
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: com.ibm.wala.cast.java,
com.ibm.wala.core,
@ -12,5 +12,6 @@ Require-Bundle: com.ibm.wala.cast.java,
com.ibm.wala.cast,
com.ibm.wala.shrike
Export-Package: com.ibm.wala.cast.java.client,
com.ibm.wala.cast.java.ecj.util,
com.ibm.wala.cast.java.translator.jdt,
com.ibm.wala.cast.java.translator.jdt.ecj

View File

@ -0,0 +1,3 @@
#Properties file for com.ibm.wala.cast.java.ecj
Bundle-Name = WALA CAst Java ECJ frontend
Bundle-Vendor = IBM

View File

@ -1,4 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
.,\
OSGI-INF/

View File

@ -396,7 +396,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
}
private boolean isInterface(AbstractTypeDeclaration decl) {
private static boolean isInterface(AbstractTypeDeclaration decl) {
return decl instanceof AnnotationTypeDeclaration ||
(decl instanceof TypeDeclaration && ((TypeDeclaration)decl).isInterface());
}
@ -640,7 +640,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
return visit(fakeCtor, classBinding, oldContext, inits);
}
private IMethodBinding findDefaultCtor(ITypeBinding superClass) {
private static IMethodBinding findDefaultCtor(ITypeBinding superClass) {
for (IMethodBinding met : superClass.getDeclaredMethods()) {
if (met.isConstructor() && met.getParameterTypes().length == 0)
return met;
@ -1832,7 +1832,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* @param isPrivate
* @return
*/
private ITypeBinding findClosestEnclosingClassSubclassOf(ITypeBinding typeOfThis, ITypeBinding owningType, boolean isPrivate) {
private static ITypeBinding findClosestEnclosingClassSubclassOf(ITypeBinding typeOfThis, ITypeBinding owningType, boolean isPrivate) {
// GENERICS
// if (owningType.isParameterizedType())
// owningType = owningType.getTypeDeclaration();
@ -2444,7 +2444,9 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
WalkContext loopContext = new LoopContext(context, loopLabel, breakTarget, continueTarget);
CAstNode loopBody = visitNode(n.getBody(), loopContext);
return doLoopTranslator.translateDoLoop(loopTest, loopBody, continueNode, breakNode, context);
CAstNode madeNode = doLoopTranslator.translateDoLoop(loopTest, loopBody, continueNode, breakNode, context);
context.pos().setPosition(madeNode, makePosition(n));
return madeNode;
}
/**

View File

@ -128,7 +128,7 @@ public class ECJSourceModuleTranslator implements SourceModuleTranslator {
libs = paths.snd;
}
private Pair<String[],String[]> computeClassPath(AnalysisScope scope) {
private static Pair<String[],String[]> computeClassPath(AnalysisScope scope) {
List<String> sources = new LinkedList<>();
List<String> libs = new LinkedList<>();
for (ClassLoaderReference cl : scope.getLoaders()) {

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Data Plug-in
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java.test.data
Bundle-Version: 1.4.3.qualifier
Bundle-Vendor: IBM
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.7

View File

@ -0,0 +1,3 @@
#Properties file for com.ibm.wala.cast.java.test.data
Bundle-Vendor = IBM
Bundle-Name = Data Plug-in

View File

@ -1,4 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
.,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/

View File

@ -0,0 +1,17 @@
package bugfixes;
public class DoWhileInCase {
static int x = 3;
public static void main(String[] args) {
switch(x) {
case 1:
do {
System.out.println("Problem");
x ++;
} while (x < 3);
break;
default:
System.out.println("Default");
}
}
}

View File

@ -51,6 +51,7 @@ public class MethodMadness {
public static void staticTest() {
System.out.println("staticTest");
}
@SuppressWarnings("static-access")
protected int protectedInteger() {
this.s = 5;
new MethodMadness("thrownaway").staticTest(); // MethodMadness object evaluated but thrown away
@ -99,6 +100,7 @@ public class MethodMadness {
return 233 + x;
}
@SuppressWarnings("static-access")
public void hello() {
System.out.println(privateInteger()); // inner function, inner this, 200013
System.out.println(MethodMadness.this.privateInteger()); // outer function, outer this, 100007

View File

@ -53,6 +53,7 @@ org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled

View File

@ -1,10 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Java AST WALA Test Plug-in
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java.test
Bundle-Version: 1.4.3.qualifier
Bundle-Activator: com.ibm.wala.cast.java.test.TestPlugin
Bundle-Vendor: IBM
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: com.ibm.wala.core.tests,
com.ibm.wala.cast.java,
com.ibm.wala.cast,

View File

@ -0,0 +1,3 @@
#Properties file for com.ibm.wala.cast.java.test
Bundle-Vendor = IBM
Bundle-Name = Java AST WALA Test Plug-in

View File

@ -1,5 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
.,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
javacProjectSettings = true

View File

@ -596,7 +596,7 @@ public abstract class JavaIRTests extends IRTests {
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
}
private MethodReference getSliceRootReference(String className, String methodName, String methodDescriptor) {
private static MethodReference getSliceRootReference(String className, String methodName, String methodDescriptor) {
TypeName clsName = TypeName.string2TypeName("L" + className.replace('.', '/'));
TypeReference clsRef = TypeReference.findOrCreate(JavaSourceAnalysisScope.SOURCE, clsName);
@ -630,5 +630,9 @@ public abstract class JavaIRTests extends IRTests {
Assert.assertEquals(2, SlicerTest.countAllocations(slice));
Assert.assertEquals(2, SlicerTest.countPutfields(slice));
}
@Test public void testDoWhileInCase() throws IllegalArgumentException, CancelException, IOException {
runTest(singleTestSrc("bugfixes"), rtJar, simplePkgTestEntryPoint("bugfixes"), emptyList, true);
}
}

View File

@ -54,6 +54,7 @@ org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warnin
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled

View File

@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Java Source WALA Front End
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java
Bundle-Version: 1.4.3.qualifier
Bundle-Vendor: rfuhrer@watson.ibm.com
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: com.ibm.wala.cast,
com.ibm.wala.core,
com.ibm.wala.shrike

View File

@ -0,0 +1,3 @@
#Properties file for com.ibm.wala.cast.java
Bundle-Vendor = rfuhrer@watson.ibm.com
Bundle-Name = Java Source WALA Front End

View File

@ -1,5 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
.,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
javacProjectSettings = true

View File

@ -164,7 +164,7 @@ public class SynchronizedBlockDuplicator extends
return oldTarget;
}
private boolean contains(RewriteContext<UnwindKey> c, CAstNode n) {
private static boolean contains(RewriteContext<UnwindKey> c, CAstNode n) {
if (c instanceof SyncContext) {
return ((SyncContext) c).containsNode(n);
} else {
@ -176,7 +176,7 @@ public class SynchronizedBlockDuplicator extends
* does root represent a synchronized block? if so, return the variable whose
* lock is acquired. otherwise, return <code>null</code>
*/
private String isSynchronizedOnVar(CAstNode root) {
private static String isSynchronizedOnVar(CAstNode root) {
if (root.getKind() == CAstNode.UNWIND) {
CAstNode unwindBody = root.getChild(0);
if (unwindBody.getKind() == CAstNode.BLOCK_STMT) {

View File

@ -535,7 +535,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
((JavaClass) owner).addField(n);
}
private TypeName toWALATypeName(CAstType type) {
private static TypeName toWALATypeName(CAstType type) {
return TypeName.string2TypeName(type.getName());
}

View File

@ -167,7 +167,7 @@ public class JavaCAst2IRTranslator extends AstTranslator {
processExceptions(newNode, context);
}
private void processExceptions(CAstNode n, WalkContext context) {
private static void processExceptions(CAstNode n, WalkContext context) {
context.cfg().addPreNode(n, context.getUnwindState());
context.cfg().newBlock(true);
@ -412,7 +412,7 @@ public class JavaCAst2IRTranslator extends AstTranslator {
}
}
private CAstType getType(final String name) {
private static CAstType getType(final String name) {
return new CAstType.Class() {
@Override

View File

@ -1,9 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Nu_validator
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.html.nu_validator
Bundle-Version: 1.4.3.qualifier
Export-Package: com.ibm.wala.cast.js.html.nu_validator
Export-Package: com.ibm.wala.cast.js.html.nu_validator,
com.ibm.wala.cast.js.test
Require-Bundle: com.ibm.wala.cast.js;bundle-version="1.0.0",
com.ibm.wala.cast.js.rhino.test;bundle-version="1.0.0",
com.ibm.wala.cast.js.test;bundle-version="1.0.0",

View File

@ -0,0 +1,2 @@
#Properties file for com.ibm.wala.cast.js.html.nu_validator
Bundle-Name = Nu_validator

View File

@ -2,7 +2,10 @@ source.. = src/,\
tests/
bin.includes = META-INF/,\
.,\
lib/htmlparser-1.4.jar
lib/htmlparser-1.4.jar,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
jars.extra.classpath = lib/htmlparser-1.4.jar
javacProjectSettings = true
output.. = bin/

View File

@ -1,13 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.cast.js.nodejs"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.cast.js"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.core"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.util"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="testdata"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="testdata"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Test
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.nodejs.test
Bundle-Version: 1.4.3.qualifier
Export-Package: NodejsRequireJsonTest,
@ -18,3 +18,4 @@ Require-Bundle: com.ibm.wala.cast.js.nodejs;bundle-version="1.3.10",
com.ibm.wala.cast.js.rhino;bundle-version="1.3.10",
com.ibm.wala.core;bundle-version="1.3.10",
org.junit
Bundle-RequiredExecutionEnvironment: JavaSE-1.7

View File

@ -0,0 +1,2 @@
#Properties file for com.ibm.wala.cast.js.nodejs.test
Bundle-Name = Test

View File

@ -1,5 +1,8 @@
source.. = src/,\
testdata/
bin.includes = META-INF/,\
.
.,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
javacProjectSettings = true
output.. = bin/

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -1,10 +1,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Nodejs
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.nodejs
Bundle-Version: 1.4.3.qualifier
Export-Package: com.ibm.wala.cast.js.nodejs
Export-Package: com.ibm.wala.cast.js.nodejs,
org.json
Require-Bundle: com.ibm.wala.cast.js;bundle-version="1.3.10",
com.ibm.wala.cast.js.rhino;bundle-version="1.3.10"
Bundle-ClassPath: lib/json-20160212.jar,
.
Bundle-RequiredExecutionEnvironment: JavaSE-1.7

View File

@ -0,0 +1,2 @@
#Properties file for com.ibm.wala.cast.js.nodejs
Bundle-Name = Nodejs

View File

@ -2,5 +2,8 @@ source.. = src/,\
dat/
bin.includes = META-INF/,\
.,\
lib/json-20160212.jar
lib/json-20160212.jar,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
javacProjectSettings = true
output.. = target/classes/

View File

@ -24,8 +24,8 @@ import org.json.JSONObject;
import com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil;
import com.ibm.wala.cast.js.loader.JavaScriptLoader;
import com.ibm.wala.cast.js.ssa.JavaScriptInvoke;
import com.ibm.wala.cast.js.types.JavaScriptMethods;
import com.ibm.wala.cast.js.types.JavaScriptTypes;
import com.ibm.wala.cast.types.AstMethodReference;
import com.ibm.wala.classLoader.CallSiteReference;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
@ -118,7 +118,7 @@ public class NodejsRequireTargetSelector implements MethodTargetSelector {
System.err.println(builder.getClassHierarchy());
IMethod method = script.getMethod(JavaScriptMethods.fnSelector);
IMethod method = script.getMethod(AstMethodReference.fnSelector);
previouslyRequired.put(sourceModule.getClassName(), method);
return method;

View File

@ -53,6 +53,7 @@ org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled

View File

@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Test Plug-in
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.rhino.test
Bundle-Version: 1.4.3.qualifier
Bundle-Vendor: IBM
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: com.ibm.wala.cast.js.rhino;bundle-version="1.0.0",
com.ibm.wala.cast.js;bundle-version="1.0.0",
com.ibm.wala.cast;bundle-version="1.0.0",
@ -16,6 +16,8 @@ Require-Bundle: com.ibm.wala.cast.js.rhino;bundle-version="1.0.0",
org.junit;bundle-version="4.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: com.ibm.wala.cast.js.rhino.callgraph.fieldbased.test,
Export-Package: com.ibm.wala.cast.js.examples.hybrid,
com.ibm.wala.cast.js.rhino.callgraph.fieldbased.test,
com.ibm.wala.cast.js.rhino.test,
com.ibm.wala.cast.js.test
com.ibm.wala.cast.js.test,
com.ibm.wala.cast.js.vis

View File

@ -0,0 +1,3 @@
#Properties file for com.ibm.wala.cast.js.rhino.test
Bundle-Vendor = IBM
Bundle-Name = Test Plug-in

View File

@ -2,5 +2,7 @@ source.. = harness-src/
output.. = bin/,\
/com.ibm.wala.cast.js.test.data/examples-src/
bin.includes = META-INF/,\
.
.,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
javacProjectSettings = true

View File

@ -12,7 +12,6 @@ import com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil;
import com.ibm.wala.cast.js.ipa.callgraph.JavaScriptConstructTargetSelector;
import com.ibm.wala.cast.js.ipa.callgraph.JavaScriptEntryPoints;
import com.ibm.wala.cast.js.loader.JavaScriptLoader;
import com.ibm.wala.cast.js.test.JSCallGraphBuilderUtil;
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.Language;
@ -57,7 +56,7 @@ public class Driver {
scope.addToScope(
scope.getJavaScriptLoader(),
JSCallGraphBuilderUtil.getPrologueFile("prologue.js"));
JSCallGraphUtil.getPrologueFile("prologue.js"));
for(int i = 1; i < args.length; i++) {
URL script = Driver.class.getClassLoader().getResource(args[i]);
scope.addToScope(

View File

@ -153,7 +153,7 @@ public class TestRhinoSourceMap {
checkFunctionBodies("jquery_spec_test.js", jquery_spec_testSource);
}
private void checkFunctionBodies(String fileName, String[][] assertions) throws IOException, ClassHierarchyException {
private static void checkFunctionBodies(String fileName, String[][] assertions) throws IOException, ClassHierarchyException {
Map<String, String> sources = HashMapFactory.make();
for(String[] assertion : assertions) {
sources.put(assertion[0], assertion[1]);

View File

@ -25,6 +25,7 @@ import com.ibm.wala.cast.js.html.WebPageLoaderFactory;
import com.ibm.wala.cast.js.html.WebUtil;
import com.ibm.wala.cast.js.html.jericho.JerichoHtmlParser;
import com.ibm.wala.cast.js.ipa.callgraph.JSCFABuilder;
import com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil;
import com.ibm.wala.cast.js.loader.JavaScriptLoader;
import com.ibm.wala.cast.js.test.JSCallGraphBuilderUtil;
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
@ -49,7 +50,7 @@ public class JsViewerDriver extends JSCallGraphBuilderUtil {
URL url = new URL(args[0]);
// computing CG + PA
JSCallGraphBuilderUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
JavaScriptLoader.addBootstrapFile(WebUtil.preamble);
SourceModule[] sources = getSources(domless, url);

View File

@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Rhino Plug-in
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.rhino
Bundle-Version: 1.4.3.qualifier
Bundle-Vendor: IBM
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: com.ibm.wala.cast;bundle-version="1.0.0",
com.ibm.wala.cast.js;bundle-version="1.0.0",
com.ibm.wala.core;bundle-version="1.1.3"

View File

@ -0,0 +1,3 @@
#Properties file for com.ibm.wala.cast.js.rhino
Bundle-Vendor = IBM
Bundle-Name = Rhino Plug-in

View File

@ -2,6 +2,8 @@ source.. = source/
output.. = bin/
bin.includes = META-INF/,\
.,\
lib/rhino-1.7.6.jar
lib/rhino-1.7.6.jar,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
jars.extra.classpath = lib/rhino-1.7.6.jar
javacProjectSettings = true

View File

@ -213,7 +213,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
}
private String operationReceiverName(int operationIndex) {
private static String operationReceiverName(int operationIndex) {
return "$$destructure$rcvr" + operationIndex;
}
@ -221,7 +221,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
return Ast.makeNode(CAstNode.VAR, Ast.makeConstant(operationReceiverName(operationIndex)));
}
private String operationElementName(int operationIndex) {
private static String operationElementName(int operationIndex) {
return "$$destructure$elt" + operationIndex;
}
@ -229,7 +229,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
return Ast.makeNode(CAstNode.VAR, Ast.makeConstant(operationElementName(operationIndex)));
}
private CAstNode translateOpcode(int nodeType) {
private static CAstNode translateOpcode(int nodeType) {
switch (nodeType) {
case Token.POS:
case Token.ADD:
@ -311,26 +311,26 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
return makeCtorCall(value, arguments, context);
}
private boolean isPrologueScript(WalkContext context) {
private static boolean isPrologueScript(WalkContext context) {
return JavaScriptLoader.bootstrapFileNames.contains(context.script());
}
private Node getCallTarget(FunctionCall n) {
private static Node getCallTarget(FunctionCall n) {
return n.getTarget();
}
/**
* is n a call to "primitive" within our synthetic modeling code?
*/
private boolean isPrimitiveCall(WalkContext context, FunctionCall n) {
private static boolean isPrimitiveCall(WalkContext context, FunctionCall n) {
return isPrologueScript(context) && n.getType() == Token.CALL && getCallTarget(n).getType() == Token.NAME
&& getCallTarget(n).getString().equals("primitive");
}
private Node getNewTarget(NewExpression n) {
private static Node getNewTarget(NewExpression n) {
return n.getTarget();
}
private boolean isPrimitiveCreation(WalkContext context, NewExpression n) {
private static boolean isPrimitiveCreation(WalkContext context, NewExpression n) {
Node target = getNewTarget(n);
return isPrologueScript(context) && n.getType() == Token.NEW && target.getType() == Token.NAME
&& target.getString().equals("Primitives");
@ -585,14 +585,14 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
return cn;
}
private List<Label> getLabels(AstNode node) {
private static List<Label> getLabels(AstNode node) {
if (node instanceof LabeledStatement || ((node = node.getParent()) instanceof LabeledStatement)) {
return ((LabeledStatement)node).getLabels();
} else {
return null;
}
}
private AstNode makeEmptyLabelStmt(String label) {
private static AstNode makeEmptyLabelStmt(String label) {
Label l = new Label();
l.setName(label);
LabeledStatement st = new LabeledStatement();
@ -603,7 +603,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
return st;
}
private WalkContext makeLoopContext(AstNode node, WalkContext arg,
private static WalkContext makeLoopContext(AstNode node, WalkContext arg,
AstNode breakStmt, AstNode contStmt) {
WalkContext loopContext = arg;
List<Label> labels = getLabels(node);
@ -617,7 +617,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
return loopContext;
}
private WalkContext makeBreakContext(AstNode node, WalkContext arg,
private static WalkContext makeBreakContext(AstNode node, WalkContext arg,
AstNode breakStmt) {
WalkContext loopContext = arg;
List<Label> labels = getLabels(node);

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding//harness-src/com/ibm/wala/cast/js/test/TestCorrelatedPairExtraction.java=UTF-8

View File

@ -53,6 +53,7 @@ org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warnin
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled

View File

@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WALA JavaScript Test Plug-in
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js.test
Bundle-Version: 1.4.3.qualifier
Bundle-Vendor: IBM
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: com.ibm.wala.cast.js,
com.ibm.wala.cast,
com.ibm.wala.core,

View File

@ -0,0 +1,3 @@
#Properties file for com.ibm.wala.cast.js.test
Bundle-Vendor = IBM
Bundle-Name = WALA JavaScript Test Plug-in

View File

@ -1,5 +1,7 @@
source.. = harness-src
output.. = bin/
bin.includes = META-INF/,\
.
.,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
javacProjectSettings = true

View File

@ -78,7 +78,7 @@ public class FieldBasedCGUtil {
JavaScriptLoaderFactory loaders = new JavaScriptLoaderFactory(translatorFactory);
Module[] scripts = new Module[]{
new SourceURLModule(url),
JSCallGraphBuilderUtil.getPrologueFile("prologue.js")
JSCallGraphUtil.getPrologueFile("prologue.js")
};
return buildCG(loaders, scripts, builderType, monitor, supportFullPointerAnalysis);
}

View File

@ -172,7 +172,7 @@ public abstract class TestForInLoopHack extends TestJSCallGraphShape {
}
*/
private void addHackedForInLoopSensitivity(JSCFABuilder builder) {
private static void addHackedForInLoopSensitivity(JSCFABuilder builder) {
final ContextSelector orig = builder.getContextSelector();
builder.setContextSelector(new PropertyNameContextSelector(builder.getAnalysisCache(), orig));
}

View File

@ -93,7 +93,7 @@ public abstract class TestPointerAnalyses {
JSCallGraphUtil.setTranslatorFactory(factory);
}
private Pair<CGNode, NewSiteReference> map(CallGraph CG, Pair<CGNode, NewSiteReference> ptr) {
private static Pair<CGNode, NewSiteReference> map(CallGraph CG, Pair<CGNode, NewSiteReference> ptr) {
CGNode n = ptr.fst;
if (! (n.getMethod() instanceof JavaScriptConstructor)) {
@ -116,7 +116,7 @@ public abstract class TestPointerAnalyses {
return Pair.make(caller, new NewSiteReference(site.getProgramCounter(), ptr.snd.getDeclaredType()));
}
private Set<Pair<CGNode, NewSiteReference>> map(CallGraph CG, Set<Pair<CGNode, NewSiteReference>> ptrs) {
private static Set<Pair<CGNode, NewSiteReference>> map(CallGraph CG, Set<Pair<CGNode, NewSiteReference>> ptrs) {
Set<Pair<CGNode, NewSiteReference>> result = HashSetFactory.make();
for(Pair<CGNode, NewSiteReference> ptr : ptrs) {
result.add(map(CG, ptr));
@ -124,7 +124,7 @@ public abstract class TestPointerAnalyses {
return result;
}
private Set<Pair<CGNode, NewSiteReference>> ptrs(Set<CGNode> functions, int local, CallGraph CG, PointerAnalysis<? extends InstanceKey> pa) {
private static Set<Pair<CGNode, NewSiteReference>> ptrs(Set<CGNode> functions, int local, CallGraph CG, PointerAnalysis<? extends InstanceKey> pa) {
Set<Pair<CGNode, NewSiteReference>> result = HashSetFactory.make();
for(CGNode n : functions) {
@ -144,7 +144,7 @@ public abstract class TestPointerAnalyses {
return result;
}
private boolean isGlobal(Set<CGNode> functions, int local, PointerAnalysis<? extends InstanceKey> pa) {
private static boolean isGlobal(Set<CGNode> functions, int local, PointerAnalysis<? extends InstanceKey> pa) {
for(CGNode n : functions) {
PointerKey l = pa.getHeapModel().getPointerKeyForLocal(n, local);
if (l != null) {

View File

@ -54,6 +54,7 @@ org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warnin
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled

View File

@ -1,11 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: JavaScript Plug-in
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.js;singleton:=true
Bundle-Version: 1.4.3.qualifier
Bundle-ClassPath: .,
lib/jericho-html-3.2.jar
Bundle-Vendor: IBM
Bundle-Vendor: %Bundle-Vendor
Export-Package: .,
com.ibm.wala.cast.js.analysis.typeInference,
com.ibm.wala.cast.js.callgraph.fieldbased,

View File

@ -0,0 +1,3 @@
#Properties file for com.ibm.wala.cast.js
Bundle-Vendor = IBM
Bundle-Name = JavaScript Plug-in

View File

@ -1,7 +1,10 @@
bin.includes = .,\
META-INF/,\
lib/,\
lib/jericho-html-3.2.jar
lib/jericho-html-3.2.jar,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
source.. = source/,\
dat/
javacProjectSettings = true
output.. = bin/

View File

@ -87,7 +87,7 @@ public abstract class FieldBasedCallGraphBuilder {
this.supportFullPointerAnalysis = supportFullPointerAnalysis;
}
private MethodTargetSelector setupMethodTargetSelector(IClassHierarchy cha, JavaScriptConstructorFunctions constructors2, AnalysisOptions options) {
private static MethodTargetSelector setupMethodTargetSelector(IClassHierarchy cha, JavaScriptConstructorFunctions constructors2, AnalysisOptions options) {
MethodTargetSelector result = new JavaScriptConstructTargetSelector(constructors2, options.getMethodTargetSelector());
if (options instanceof JSAnalysisOptions && ((JSAnalysisOptions)options).handleCallApply()) {
result = new JavaScriptFunctionApplyTargetSelector(new JavaScriptFunctionDotCallTargetSelector(result));
@ -243,7 +243,7 @@ public abstract class FieldBasedCallGraphBuilder {
Everywhere targetContext = Everywhere.EVERYWHERE;
@SuppressWarnings("deprecation")
private boolean addCGEdgeWithContext(final JSCallGraph cg, CallSiteReference site, IMethod target, CGNode caller,
private static boolean addCGEdgeWithContext(final JSCallGraph cg, CallSiteReference site, IMethod target, CGNode caller,
Context targetContext) throws CancelException {
boolean ret = false;
if(target != null) {
@ -266,14 +266,14 @@ public abstract class FieldBasedCallGraphBuilder {
* FuncVertex nodes for the reflectively-invoked methods
* @throws CancelException
*/
private OrdinalSet<FuncVertex> getReflectiveTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException {
private static OrdinalSet<FuncVertex> getReflectiveTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException {
SSAAbstractInvokeInstruction invoke = callVertex.getInstruction();
VarVertex functionParam = flowGraph.getVertexFactory().makeVarVertex(callVertex.getCaller(), invoke.getUse(1));
return flowGraph.getReachingSet(functionParam, monitor);
}
@SuppressWarnings("unused")
private OrdinalSet<FuncVertex> getConstructorTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException {
private static OrdinalSet<FuncVertex> getConstructorTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException {
SSAAbstractInvokeInstruction invoke = callVertex.getInstruction();
assert invoke.getDeclaredTarget().getName().equals(JavaScriptMethods.ctorAtom);
VarVertex objectParam = flowGraph.getVertexFactory().makeVarVertex(callVertex.getCaller(), invoke.getUse(0));

View File

@ -93,7 +93,7 @@ public class OptimisticCallgraphBuilder extends FieldBasedCallGraphBuilder {
}
// add flow corresponding to a new call edge
private void addEdge(FlowGraph flowgraph, CallVertex c, FuncVertex callee, IProgressMonitor monitor) throws CancelException {
private static void addEdge(FlowGraph flowgraph, CallVertex c, FuncVertex callee, IProgressMonitor monitor) throws CancelException {
VertexFactory factory = flowgraph.getVertexFactory();
JavaScriptInvoke invk = c.getInstruction();
FuncVertex caller = c.getCaller();
@ -116,7 +116,7 @@ public class OptimisticCallgraphBuilder extends FieldBasedCallGraphBuilder {
// add data flow corresponding to a reflective invocation via Function.prototype.call
// NB: for f.call(...), f will _not_ appear as a call target, but the appropriate argument and return data flow will be set up
private void addReflectiveCallEdge(FlowGraph flowgraph, CallVertex c, IProgressMonitor monitor) throws CancelException {
private static void addReflectiveCallEdge(FlowGraph flowgraph, CallVertex c, IProgressMonitor monitor) throws CancelException {
VertexFactory factory = flowgraph.getVertexFactory();
FuncVertex caller = c.getCaller();
JavaScriptInvoke invk = c.getInstruction();

View File

@ -104,7 +104,7 @@ public class FlowGraph implements Iterable<Vertex> {
optimistic_closure = computeClosure(graph, monitor, FuncVertex.class);
}
private <T> GraphReachability<Vertex, T> computeClosure(NumberedGraph<Vertex> graph, IProgressMonitor monitor, final Class<?> type) throws CancelException {
private static <T> GraphReachability<Vertex, T> computeClosure(NumberedGraph<Vertex> graph, IProgressMonitor monitor, final Class<?> type) throws CancelException {
// prune flowgraph by taking out 'unknown' vertex
Graph<Vertex> pruned_flowgraph = GraphSlicer.prune(graph, new Predicate<Vertex>() {
@Override

View File

@ -100,7 +100,7 @@ public class DefaultSourceExtractor extends DomLessSourceExtractor{
domRegion.println("");
}
private String makeRef(String object, String property) {
private static String makeRef(String object, String property) {
assert object != null && property != null;
return object + "[\"" + property + "\"]";
}

View File

@ -140,7 +140,7 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
handleDOM(tag);
}
private boolean isUsableIdentifier(String x) {
private static boolean isUsableIdentifier(String x) {
return x != null &&
LEGAL_JS_IDENTIFIER_REGEXP.matcher(x).matches() &&
!LEGAL_JS_KEYWORD_REGEXP.matcher(x).matches();
@ -217,7 +217,7 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
return Pair.make(value, quote);
}
private String extructJS(String attValue) {
private static String extructJS(String attValue) {
if (attValue == null){
return "";
}
@ -350,7 +350,7 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
return new HtmlCallback(entrypointUrl, urlResolver);
}
private File createOutputFile(URL url, boolean delete, boolean useTempName) throws IOException {
private static File createOutputFile(URL url, boolean delete, boolean useTempName) throws IOException {
File outputFile;
String fileName = new File(url.getFile()).getName();
if (fileName.length() < 5) {

View File

@ -61,7 +61,7 @@ public class JavaScriptFunctionApplyContextInterpreter extends AstContextInsensi
}
}
private IR makeIRForArgList(CGNode node) {
private static IR makeIRForArgList(CGNode node) {
// we have: v1 is dummy apply method
// v2 is function to be invoked
// v3 is argument to be passed as 'this'
@ -121,7 +121,7 @@ public class JavaScriptFunctionApplyContextInterpreter extends AstContextInsensi
}
@SuppressWarnings("unused")
private int passArbitraryPropertyValAsParams(JSInstructionFactory insts, int nargs, JavaScriptSummary S, int[] paramsToPassToInvoked) {
private static int passArbitraryPropertyValAsParams(JSInstructionFactory insts, int nargs, JavaScriptSummary S, int[] paramsToPassToInvoked) {
// read an arbitrary property name via EachElementGet
int curValNum = nargs + 2;
int eachElementGetResult = curValNum++;
@ -139,7 +139,7 @@ public class JavaScriptFunctionApplyContextInterpreter extends AstContextInsensi
return curValNum;
}
private int passActualPropertyValsAsParams(JSInstructionFactory insts, int nargs, JavaScriptSummary S, int[] paramsToPassToInvoked) {
private static int passActualPropertyValsAsParams(JSInstructionFactory insts, int nargs, JavaScriptSummary S, int[] paramsToPassToInvoked) {
// read an arbitrary property name via EachElementGet
int nullVn = nargs + 2;
S.addConstant(nullVn, new ConstantValue(null));
@ -165,7 +165,7 @@ public class JavaScriptFunctionApplyContextInterpreter extends AstContextInsensi
return curValNum;
}
private IR makeIRForNoArgList(CGNode node) {
private static IR makeIRForNoArgList(CGNode node) {
// kind of a hack; re-use the summarized function infrastructure
MethodReference ref = node.getMethod().getReference();
IClass declaringClass = node.getMethod().getDeclaringClass();

View File

@ -42,7 +42,7 @@ public class JavaScriptFunctionApplyTargetSelector implements MethodTargetSelect
this.base = base;
}
private IMethod createApplyDummyMethod(IClass declaringClass) {
private static IMethod createApplyDummyMethod(IClass declaringClass) {
final MethodReference ref = genSyntheticMethodRef(declaringClass);
// number of args doesn't matter
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
@ -51,7 +51,7 @@ public class JavaScriptFunctionApplyTargetSelector implements MethodTargetSelect
public static final String SYNTHETIC_APPLY_METHOD_PREFIX = "$$ apply_dummy";
private MethodReference genSyntheticMethodRef(IClass receiver) {
private static MethodReference genSyntheticMethodRef(IClass receiver) {
Atom atom = Atom.findOrCreateUnicodeAtom(SYNTHETIC_APPLY_METHOD_PREFIX);
Descriptor desc = Descriptor.findOrCreateUTF8(JavaScriptLoader.JS, "()LRoot;");
MethodReference ref = MethodReference.findOrCreate(receiver.getReference(), atom, desc);

View File

@ -12,6 +12,7 @@ package com.ibm.wala.cast.js.ipa.callgraph;
import java.util.Map;
import com.ibm.wala.cast.ipa.callgraph.CAstCallGraphUtil;
import com.ibm.wala.cast.js.ipa.summaries.JavaScriptSummarizedFunction;
import com.ibm.wala.cast.js.ipa.summaries.JavaScriptSummary;
import com.ibm.wala.cast.js.loader.JSCallSiteReference;
@ -174,22 +175,22 @@ public class JavaScriptFunctionDotCallTargetSelector implements MethodTargetSele
public static final String SYNTHETIC_CALL_METHOD_PREFIX = "$$ call_";
private MethodReference genSyntheticMethodRef(IClass receiver, int nargs, String key) {
private static MethodReference genSyntheticMethodRef(IClass receiver, int nargs, String key) {
Atom atom = Atom.findOrCreateUnicodeAtom(SYNTHETIC_CALL_METHOD_PREFIX + key);
Descriptor desc = Descriptor.findOrCreateUTF8(JavaScriptLoader.JS, "()LRoot;");
MethodReference ref = MethodReference.findOrCreate(receiver.getReference(), atom, desc);
return ref;
}
private String getKey(int nargs, CGNode caller, CallSiteReference site) {
private static String getKey(int nargs, CGNode caller, CallSiteReference site) {
if (SEPARATE_SYNTHETIC_METHOD_PER_SITE) {
return JSCallGraphUtil.getShortName(caller) + "_" + caller.getGraphNodeId() + "_" + site.getProgramCounter();
return CAstCallGraphUtil.getShortName(caller) + "_" + caller.getGraphNodeId() + "_" + site.getProgramCounter();
} else {
return ""+nargs;
}
}
private int getNumberOfArgsPassed(CGNode caller, CallSiteReference site) {
private static int getNumberOfArgsPassed(CGNode caller, CallSiteReference site) {
IR callerIR = caller.getIR();
SSAAbstractInvokeInstruction callStmts[] = callerIR.getCalls(site);
assert callStmts.length == 1;

View File

@ -18,7 +18,6 @@ import java.util.HashSet;
import java.util.Set;
import com.ibm.wala.cast.js.loader.JavaScriptLoader;
import com.ibm.wala.cast.js.types.JavaScriptMethods;
import com.ibm.wala.cast.js.types.JavaScriptTypes;
import com.ibm.wala.cast.types.AstMethodReference;
import com.ibm.wala.classLoader.CallSiteReference;
@ -79,7 +78,7 @@ public class LoadFileTargetSelector implements MethodTargetSelector {
JSCallGraphUtil.loadAdditionalFile(builder.getClassHierarchy() , cl, url);
loadedFiles.add(url);
IClass script = builder.getClassHierarchy().lookupClass(TypeReference.findOrCreate(cl.getReference(), "L" + url.getFile()));
return script.getMethod(JavaScriptMethods.fnSelector);
return script.getMethod(AstMethodReference.fnSelector);
}
} catch (MalformedURLException e1) {
// do nothing, fall through and return 'target'

View File

@ -61,7 +61,7 @@ public class RecursionCheckContextSelector implements ContextSelector {
return baseContext;
}
private boolean recursiveContext(Context baseContext, IMethod callee) {
private static boolean recursiveContext(Context baseContext, IMethod callee) {
if (!recursionPossible(callee)) {
return false;
}
@ -100,7 +100,7 @@ public class RecursionCheckContextSelector implements ContextSelector {
return false;
}
private boolean updateForNode(Context baseContext, Collection<IMethod> curEncountered, LinkedList<Pair<Context, Collection<IMethod>>> worklist, CGNode callerNode) {
private static boolean updateForNode(Context baseContext, Collection<IMethod> curEncountered, LinkedList<Pair<Context, Collection<IMethod>>> worklist, CGNode callerNode) {
final IMethod method = callerNode.getMethod();
if (!recursionPossible(method)) {
assert !curEncountered.contains(method);
@ -132,7 +132,7 @@ public class RecursionCheckContextSelector implements ContextSelector {
* @param m
* @return
*/
private boolean recursionPossible(IMethod m) {
private static boolean recursionPossible(IMethod m) {
// object or array constructors cannot be involved
if (m.getReference().getName().equals(JavaScriptMethods.ctorAtom)) {
TypeReference declaringClass = m.getReference().getDeclaringClass();

View File

@ -244,7 +244,7 @@ public class CorrelationFinder {
printCorrelatedAccesses(findCorrelatedAccesses(url));
}
private void printCorrelatedAccesses(Map<IMethod, CorrelationSummary> summaries) {
private static void printCorrelatedAccesses(Map<IMethod, CorrelationSummary> summaries) {
List<Pair<Position, String>> correlations = new ArrayList<>();
for(CorrelationSummary summary : summaries.values())
correlations.addAll(summary.pp());

View File

@ -666,7 +666,7 @@ public class ClosureExtractor extends CAstRewriterExt {
return stmts;
}
private CAstNode addSpuriousExnFlow(CAstNode node, CAstControlFlowMap cfg) {
private static CAstNode addSpuriousExnFlow(CAstNode node, CAstControlFlowMap cfg) {
CAstControlFlowRecorder flow = (CAstControlFlowRecorder)cfg;
if(node.getKind() == ASSIGN) {
if(node.getChild(0).getKind() == VAR) {

View File

@ -179,7 +179,7 @@ public class CorrelatedPairExtractionPolicy extends ExtractionPolicy {
return true;
}
private void filterNames(Set<ChildPos> nodes, String indexName) {
private static void filterNames(Set<ChildPos> nodes, String indexName) {
for(Iterator<ChildPos> iter=nodes.iterator();iter.hasNext();) {
CAstNode node = iter.next().getChild();
if(node.getKind() == CAstNode.OBJECT_REF) {
@ -191,7 +191,7 @@ public class CorrelatedPairExtractionPolicy extends ExtractionPolicy {
}
}
private Pair<CAstNode, ? extends ExtractionRegion> findClosestContainingBlock(CAstEntity entity, ChildPos startNode, ChildPos endNode, String parmName, List<String> locals) {
private static Pair<CAstNode, ? extends ExtractionRegion> findClosestContainingBlock(CAstEntity entity, ChildPos startNode, ChildPos endNode, String parmName, List<String> locals) {
ChildPos pos = startNode;
CAstNode block = null;
int start = -1, end = 0;

View File

@ -88,7 +88,7 @@ public class JavaScriptConstructorFunctions {
return m;
}
private IMethod makeNullaryValueConstructor(IClass cls, Object value) {
private static IMethod makeNullaryValueConstructor(IClass cls, Object value) {
JSInstructionFactory insts = (JSInstructionFactory)cls.getClassLoader().getInstructionFactory();
MethodReference ref = JavaScriptMethods.makeCtorReference(cls.getReference());
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
@ -118,7 +118,7 @@ public class JavaScriptConstructorFunctions {
return new JavaScriptConstructor(ref, S, cls, cls);
}
private IMethod makeUnaryValueConstructor(IClass cls) {
private static IMethod makeUnaryValueConstructor(IClass cls) {
JSInstructionFactory insts = (JSInstructionFactory)cls.getClassLoader().getInstructionFactory();
MethodReference ref = JavaScriptMethods.makeCtorReference(cls.getReference());
JavaScriptSummary S = new JavaScriptSummary(ref, 2);

View File

@ -54,7 +54,7 @@ public class JSAstTranslator extends AstTranslator {
super(loader);
}
private boolean isPrologueScript(WalkContext context) {
private static boolean isPrologueScript(WalkContext context) {
return JavaScriptLoader.bootstrapFileNames.contains( context.getModule().getName() );
}

View File

@ -52,6 +52,7 @@ org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled

View File

@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: CAst Test Plug-in
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.test
Bundle-Version: 1.4.3.qualifier
Bundle-Vendor: IBM
Bundle-Vendor: %Bundle-Vendor
Require-Bundle:
org.junit;bundle-version="4.0.0",
com.ibm.wala.core.tests,

View File

@ -0,0 +1,3 @@
#Properties file for com.ibm.wala.cast.test
Bundle-Vendor = IBM
Bundle-Name = CAst Test Plug-in

View File

@ -1,5 +1,7 @@
source.. = harness-src
output.. = bin/
bin.includes = META-INF/,\
.
.,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
javacProjectSettings = true

View File

@ -60,7 +60,7 @@ public class TestCAstPattern extends WalaTestCase {
}
private void test(CAstPattern p, CAstNode n, Map names) {
private static void test(CAstPattern p, CAstNode n, Map names) {
System.err.println(("testing pattern " + p));
System.err.println(("testing with input " + CAstPrinter.print(n)));

View File

@ -54,6 +54,7 @@ org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warnin
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled

View File

@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WALA CAst core Plug-in
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast
Bundle-Version: 1.4.3.qualifier
Bundle-Vendor: IBM
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: com.ibm.wala.core,
com.ibm.wala.shrike
Bundle-ActivationPolicy: lazy

View File

@ -0,0 +1,3 @@
#Properties file for com.ibm.wala.cast
Bundle-Vendor = IBM
Bundle-Name = WALA CAst core Plug-in

View File

@ -1,6 +1,8 @@
source.. = source/java/
output.. = bin/
bin.includes = META-INF/,\
lib/commons-io-2.4.jar,\
.
lib/commons-io-2.4.jar,\
.,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/
javacProjectSettings = true

View File

@ -357,7 +357,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
return ((AstPointerKeyFactory) getBuilder().getPointerKeyFactory()).getPointerKeysForReflectedFieldWrite(I, F);
}
private void visitLexical(AstLexicalAccess instruction, final LexicalOperator op) {
private static void visitLexical(AstLexicalAccess instruction, final LexicalOperator op) {
op.doLexicalPointerKeys(false);
// I have no idea what the code below does, but commenting it out doesn't
// break any regression tests. --MS

View File

@ -306,15 +306,15 @@ public abstract class AbstractSSAConversion {
}
}
private <T> void push(ArrayList<T> stack, T elt) {
private static <T> void push(ArrayList<T> stack, T elt) {
stack.add(elt);
}
private <T> T peek(ArrayList<T> stack) {
private static <T> T peek(ArrayList<T> stack) {
return stack.get(stack.size()-1);
}
private <T> T pop(ArrayList<T> stack) {
private static <T> T pop(ArrayList<T> stack) {
T e = stack.get(stack.size()-1);
stack.remove(stack.size()-1);
return e;

View File

@ -332,11 +332,11 @@ public class SSAConversion extends AbstractSSAConversion {
return null;
}
private <T> void push(ArrayList<T> stack, T elt) {
private static <T> void push(ArrayList<T> stack, T elt) {
stack.add(elt);
}
private <T> T peek(ArrayList<T> stack) {
private static <T> T peek(ArrayList<T> stack) {
return stack.get(stack.size()-1);
}

View File

@ -342,7 +342,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
* call sites, as would be required for
* {@link #doLexicallyScopedRead(CAstNode, WalkContext, String)}
*/
private int doLexReadHelper(WalkContext context, final String name, TypeReference type) {
private static int doLexReadHelper(WalkContext context, final String name, TypeReference type) {
Symbol S = context.currentScope().lookup(name);
Scope definingScope = S.getDefiningScope();
CAstEntity E = definingScope.getEntity();
@ -369,7 +369,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
* @param entityName
* @param isWrite
*/
private void markExposedInEnclosingEntities(WalkContext context, final String name, Scope definingScope, TypeReference type, CAstEntity E,
private static void markExposedInEnclosingEntities(WalkContext context, final String name, Scope definingScope, TypeReference type, CAstEntity E,
final String entityName, boolean isWrite) {
Scope curScope = context.currentScope();
while (!curScope.equals(definingScope)) {
@ -1158,7 +1158,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
}
}
private boolean checkBlockBoundaries(IncipientCFG icfg) {
private static boolean checkBlockBoundaries(IncipientCFG icfg) {
MutableIntSet boundaries = IntSetUtil.make();
for(PreBasicBlock b : icfg) {
if (b.getFirstInstructionIndex() >= 0) {
@ -2798,7 +2798,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
readOnlyNames = original.readOnlyNames;
}
private int[] buildLexicalUseArray(Pair<Pair<String, String>, Integer>[] exposedNames, String entityName) {
private static int[] buildLexicalUseArray(Pair<Pair<String, String>, Integer>[] exposedNames, String entityName) {
if (exposedNames != null) {
int[] lexicalUses = new int[exposedNames.length];
for (int j = 0; j < exposedNames.length; j++) {
@ -2815,7 +2815,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
}
}
private Pair<String, String>[] buildLexicalNamesArray(Pair<Pair<String, String>, Integer>[] exposedNames) {
private static Pair<String, String>[] buildLexicalNamesArray(Pair<Pair<String, String>, Integer>[] exposedNames) {
if (exposedNames != null) {
@SuppressWarnings("unchecked")
Pair<String, String>[] lexicalNames = new Pair[exposedNames.length];
@ -2993,7 +2993,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
* used to update an instruction that performs all the accesses at the
* beginning of the method and defines the locals.
*/
private void addAccess(WalkContext context, CAstEntity e, Access access) {
private static void addAccess(WalkContext context, CAstEntity e, Access access) {
context.getAccesses(e).add(access);
}
@ -3016,7 +3016,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
* @param valueNumber
* the name's value number in the scope of entity
*/
private void addExposedName(CAstEntity entity, CAstEntity declaration, String name, int valueNumber, boolean isWrite, WalkContext context) {
private static void addExposedName(CAstEntity entity, CAstEntity declaration, String name, int valueNumber, boolean isWrite, WalkContext context) {
Pair<Pair<String, String>, Integer> newVal = Pair.make(Pair.make(name, context.getEntityName(declaration)), valueNumber);
context.exposeNameSet(entity, isWrite).add(newVal);
}
@ -3153,7 +3153,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
return map;
}
protected final CAstType getTypeForNode(WalkContext context, CAstNode node) {
protected final static CAstType getTypeForNode(WalkContext context, CAstNode node) {
if (context.top().getNodeTypeMap() != null) {
return context.top().getNodeTypeMap().getNodeType(node);
} else {
@ -3624,7 +3624,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
return false;
}
private boolean handleBinaryOpThrow(CAstNode n, CAstNode op, WalkContext context) {
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);
@ -3997,7 +3997,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
}
}
private int[] gatherArrayDims(WalkContext c, CAstNode n) {
private static int[] gatherArrayDims(WalkContext c, CAstNode n) {
int numDims = n.getChildCount() - 2;
int[] dims = new int[numDims];
for (int i = 0; i < numDims; i++)
@ -4175,7 +4175,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
}
}
private boolean isSimpleSwitch(CAstNode n, WalkContext context, CAstVisitor<WalkContext> visitor) {
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();) {

View File

@ -189,10 +189,10 @@ public class CAstPrinter {
}
public static void xmlTo(CAstNode top, CAstSourcePositionMap pos, Writer w) {
instance.doXmlTo(top, pos, w);
doXmlTo(top, pos, w);
}
private void doXmlTo(CAstNode top, CAstSourcePositionMap pos, Writer w) {
private static void doXmlTo(CAstNode top, CAstSourcePositionMap pos, Writer w) {
printTo(top, pos, w, 0, true);
}

View File

@ -1,8 +1,8 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Testdata Plug-in
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.core.testdata
Bundle-Version: 1.4.3.qualifier
Bundle-Vendor: IBM
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Eclipse-BuddyPolicy: registered

View File

@ -0,0 +1,3 @@
#Properties file for com.ibm.wala.core.testdata
Bundle-Vendor = IBM
Bundle-Name = Testdata Plug-in

View File

@ -7,5 +7,7 @@ bin.includes = META-INF/,\
bcel-5.2.jar,\
java-cup-11a.jar,\
com.ibm.wala.core.testdata_1.0.0.jar,\
com.ibm.wala.core.testdata_1.0.0a.jar
com.ibm.wala.core.testdata_1.0.0a.jar,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/

View File

@ -54,6 +54,7 @@ org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warnin
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled

View File

@ -6,17 +6,22 @@ Bundle-Version: 1.4.3.qualifier
Bundle-Vendor: %providerName
Require-Bundle: com.ibm.wala.shrike,
com.ibm.wala.core,
com.ibm.wala.ide.jdt;bundle-version="1.4.3",
org.eclipse.core.runtime,
com.ibm.wala.core.testdata,
org.junit;bundle-version="4.0.0",
org.apache.ant,
org.hamcrest.core;bundle-version="1.3.0"
Bundle-Localization: plugin
Export-Package: com.ibm.wala.core.tests.basic,
Export-Package: com.ibm.wala.core.tests.arraybounds,
com.ibm.wala.core.tests.basic,
com.ibm.wala.core.tests.callGraph,
com.ibm.wala.core.tests.cfg.exc.inter,
com.ibm.wala.core.tests.cfg.exc.intra,
com.ibm.wala.core.tests.cha,
com.ibm.wala.core.tests.collections,
com.ibm.wala.core.tests.demandpa,
com.ibm.wala.core.tests.exceptionpruning,
com.ibm.wala.core.tests.ir,
com.ibm.wala.core.tests.plugin,
com.ibm.wala.core.tests.ptrs,

View File

@ -64,7 +64,7 @@ public class PrimitivesTest extends WalaTestCase {
/**
* Test the MutableSparseIntSet implementation
*/
private void doMutableIntSet(MutableIntSetFactory factory) {
private static void doMutableIntSet(MutableIntSetFactory factory) {
MutableIntSet v = factory.parse("{9,17}");
MutableIntSet w = factory.make(new int[] {});
MutableIntSet x = factory.make(new int[] { 7, 4, 2, 4, 2, 2 });
@ -351,7 +351,7 @@ public class PrimitivesTest extends WalaTestCase {
/**
* Test the MutableSparseIntSet implementation
*/
private void doMutableLongSet(MutableLongSetFactory factory) {
private static void doMutableLongSet(MutableLongSetFactory factory) {
MutableLongSet v = factory.parse("{9,17}");
MutableLongSet w = factory.make(new long[] {});
MutableLongSet x = factory.make(new long[] { 7, 4, 2, 4, 2, 2 });
@ -707,7 +707,7 @@ public class PrimitivesTest extends WalaTestCase {
Assert.assertTrue(c.size() == 10);
}
private NumberedGraph<Integer> makeBFSTestGraph() {
private static NumberedGraph<Integer> makeBFSTestGraph() {
// test graph
NumberedGraph<Integer> G = SlowSparseNumberedGraph.make();
@ -859,7 +859,7 @@ public class PrimitivesTest extends WalaTestCase {
Assert.assertTrue("Got count " + count, count == 2);
}
private int countEquivalenceClasses(IntegerUnionFind uf) {
private static int countEquivalenceClasses(IntegerUnionFind uf) {
HashSet<Integer> s = HashSetFactory.make();
for (int i = 0; i < uf.size(); i++) {
s.add(new Integer(uf.find(i)));
@ -891,7 +891,7 @@ public class PrimitivesTest extends WalaTestCase {
testSingleBitVector(new OffsetBitVector(100, 10));
}
private void testSingleBitVector(BitVectorBase bv) {
private static void testSingleBitVector(BitVectorBase bv) {
// does the following not automatically scale the bitvector to
// a reasonable size?
bv.set(55);
@ -960,7 +960,7 @@ public class PrimitivesTest extends WalaTestCase {
}
@SuppressWarnings("unchecked")
private <T extends BitVectorBase> void testBitVectors(T v1, T v2) {
private static <T extends BitVectorBase> void testBitVectors(T v1, T v2) {
v1.set(100);
v1.set(101);
v1.set(102);

View File

@ -50,7 +50,7 @@ public class CPATest extends WalaTestCase {
doCPATest("Lcpa/CPATest2", "(Lcpa/CPATest2$N;I)Lcpa/CPATest2$N;");
}
private void doCPATest(String testClass, String testIdSignature) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
private static void doCPATest(String testClass, String testIdSignature) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchyFactory.make(scope);

View File

@ -74,7 +74,7 @@ public class PiNodeCallGraphTest extends WalaTestCase {
private static final MemberReference unary2Ref = MethodReference.findOrCreate(whateverRef,
Atom.findOrCreateUnicodeAtom("unary2"), Descriptor.findOrCreateUTF8("()V"));
private CallGraph doGraph(boolean usePiNodes) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
private static CallGraph doGraph(boolean usePiNodes) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -86,7 +86,7 @@ public class PiNodeCallGraphTest extends WalaTestCase {
return CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(new DefaultIRFactory(), options.getSSAOptions()), cha, scope, false);
}
private void checkCallAssertions(CallGraph cg, int desiredNumberOfTargets, int desiredNumberOfCalls, int numLocalCastCallees) {
private static void checkCallAssertions(CallGraph cg, int desiredNumberOfTargets, int desiredNumberOfCalls, int numLocalCastCallees) {
int numberOfCalls = 0;
Set<CGNode> callerNodes = HashSetFactory.make();

View File

@ -316,7 +316,7 @@ public class ReflectionTest extends WalaTestCase {
Assert.assertTrue(filePermToStringNode != null);
}
private Collection<CGNode> getSuccNodes(CallGraph cg, Collection<CGNode> nodes) {
private static Collection<CGNode> getSuccNodes(CallGraph cg, Collection<CGNode> nodes) {
Set<CGNode> succNodes = HashSetFactory.make();
for (CGNode newInstanceNode : nodes) {
Iterator<? extends CGNode> succNodesIter = cg.getSuccNodes(newInstanceNode);

View File

@ -36,6 +36,7 @@ public final class SemiSparseMutableIntSetTest extends WalaTestCase {
// --- Test cases
@SuppressWarnings("static-method")
@Test public void testCase1() {
final SemiSparseMutableIntSet ssmIntSet = new SemiSparseMutableIntSet();
ssmIntSet.add(1);

View File

@ -37,6 +37,7 @@ public final class TwoLevelVectorTest extends WalaTestCase {
// --- Test cases
@SuppressWarnings("static-method")
@Test public void testCase1() {
final TwoLevelVector<Integer> tlVector = new TwoLevelVector<>();
tlVector.iterator();

View File

@ -258,7 +258,7 @@ public abstract class AbstractPtrTest {
* @return
* @throws ClassHierarchyException
*/
private IClassHierarchy findOrCreateCHA(AnalysisScope scope) throws ClassHierarchyException {
private static IClassHierarchy findOrCreateCHA(AnalysisScope scope) throws ClassHierarchyException {
if (cachedCHA == null) {
cachedCHA = ClassHierarchyFactory.make(scope);
}

View File

@ -177,7 +177,7 @@ public class ExceptionAnalysis2EdgeFilterTest {
}
}
private void checkRemovingNormalOk(CGNode node, ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg, ISSABasicBlock block,
private static void checkRemovingNormalOk(CGNode node, ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg, ISSABasicBlock block,
ISSABasicBlock normalSucc) {
if (!block.getLastInstruction().isPEI() || !filter.getFilter(node).alwaysThrowsException(block.getLastInstruction())) {
specialCaseThrowFiltered(cfg, normalSucc);
@ -197,7 +197,7 @@ public class ExceptionAnalysis2EdgeFilterTest {
* @param cfg
* @param normalSucc
*/
private void specialCaseThrowFiltered(ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg, ISSABasicBlock normalSucc) {
private static void specialCaseThrowFiltered(ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg, ISSABasicBlock normalSucc) {
ISSABasicBlock next = normalSucc;
while (!(next.getLastInstruction() instanceof SSAThrowInstruction)) {
assertTrue(cfg.getNormalSuccessors(next).iterator().hasNext());
@ -205,7 +205,7 @@ public class ExceptionAnalysis2EdgeFilterTest {
}
}
private void checkNoNewEdges(ControlFlowGraph<SSAInstruction, ISSABasicBlock> original,
private static void checkNoNewEdges(ControlFlowGraph<SSAInstruction, ISSABasicBlock> original,
ControlFlowGraph<SSAInstruction, ISSABasicBlock> filtered) {
for (ISSABasicBlock block : filtered) {
for (ISSABasicBlock normalSucc : filtered.getNormalSuccessors(block)) {

View File

@ -98,7 +98,7 @@ public class DeterministicIRTest extends WalaTestCase {
/**
* @param iterator
*/
private void checkNoneNull(Iterator<?> iterator) {
private static void checkNoneNull(Iterator<?> iterator) {
while (iterator.hasNext()) {
Assert.assertTrue(iterator.next() != null);
}

Some files were not shown because too many files have changed in this diff Show More