fixes for users of JDT interfaces, such as Miniatur/MemSAT
This commit is contained in:
parent
d7b2b3cd30
commit
fae5c86114
|
@ -25,7 +25,7 @@
|
|||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 6"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JDK 1.6"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.cast.java.test.JDTJava15IRTests"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.ide.jdt.test"/>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 6"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JDK 1.6"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.cast.java.test.JDTJavaIRTests"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.ide.jdt.test"/>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="source"/>
|
||||
<classpathentry kind="lib" path="lib/polyglot.jar"/>
|
||||
<classpathentry kind="lib" path="lib/java_cup.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/polyglot.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/java_cup.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
|
|||
Bundle-Name: WALA CAst Java Polyglot Plug-in
|
||||
Bundle-SymbolicName: com.ibm.wala.cast.java.polyglot
|
||||
Bundle-Version: 1.0.0
|
||||
Bundle-Activator: com.ibm.wala.cast.java.polyglot.Activator
|
||||
Bundle-Vendor: IBM
|
||||
Require-Bundle: com.ibm.wala.cast.java,
|
||||
com.ibm.wala.cast,
|
||||
|
@ -29,4 +28,21 @@ Export-Package: com.ibm.wala.cast.java.translator.polyglot;
|
|||
polyglot.frontend.goals,
|
||||
com.ibm.wala.cast.tree.impl,
|
||||
com.ibm.wala.cast.java.translator,
|
||||
com.ibm.wala.cast.java.types"
|
||||
com.ibm.wala.cast.java.types",
|
||||
java_cup,
|
||||
java_cup.runtime,
|
||||
polyglot.ast,
|
||||
polyglot.dispatch,
|
||||
polyglot.frontend,
|
||||
polyglot.lex,
|
||||
polyglot.main,
|
||||
polyglot.parse,
|
||||
polyglot.qq,
|
||||
polyglot.types,
|
||||
polyglot.types.reflect,
|
||||
polyglot.util,
|
||||
polyglot.util.typedump,
|
||||
polyglot.visit
|
||||
Bundle-ClassPath: lib/java_cup.jar,
|
||||
lib/polyglot.jar,
|
||||
.
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
source.. = source/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
.,\
|
||||
lib/java_cup.jar,\
|
||||
lib/polyglot.jar
|
||||
|
|
|
@ -139,7 +139,7 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
result.add(domoType);
|
||||
}
|
||||
if (domoType == null && !getClassHierarchy().getScope().getExclusions().contains(name.toString().substring(1))){
|
||||
assert false : "Failed to find all non-excluded interfaces.";
|
||||
assert false : "Failed to find non-excluded interface: " + name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
|
||||
<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
|
||||
<mapEntry key="[run]" value="org.eclipse.jdt.junit.launchconfig"/>
|
||||
</mapAttribute>
|
||||
<stringAttribute key="org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE" value="/tmp/console.txt"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.ibm.wala.cast.js.rhino.test"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="source"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/js.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
||||
<classpathentry kind="lib" path="lib/js.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -12,4 +12,28 @@ Require-Bundle: org.eclipse.core.runtime,
|
|||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.ibm.wala.cast.js.translator,
|
||||
org.mozilla.javascript
|
||||
com.ibm.wala.js.rhino,
|
||||
org.mozilla.classfile,
|
||||
org.mozilla.javascript,
|
||||
org.mozilla.javascript.annotations,
|
||||
org.mozilla.javascript.ast,
|
||||
org.mozilla.javascript.commonjs.module,
|
||||
org.mozilla.javascript.commonjs.module.provider,
|
||||
org.mozilla.javascript.debug,
|
||||
org.mozilla.javascript.jdk13,
|
||||
org.mozilla.javascript.jdk15,
|
||||
org.mozilla.javascript.json,
|
||||
org.mozilla.javascript.optimizer,
|
||||
org.mozilla.javascript.regexp,
|
||||
org.mozilla.javascript.serialize,
|
||||
org.mozilla.javascript.tools,
|
||||
org.mozilla.javascript.tools.debugger,
|
||||
org.mozilla.javascript.tools.debugger.treetable,
|
||||
org.mozilla.javascript.tools.idswitch,
|
||||
org.mozilla.javascript.tools.jsc,
|
||||
org.mozilla.javascript.tools.shell,
|
||||
org.mozilla.javascript.xml,
|
||||
org.mozilla.javascript.xml.impl.xmlbeans,
|
||||
org.mozilla.javascript.xmlimpl
|
||||
Bundle-ClassPath: lib/js.jar,
|
||||
.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
source.. = source/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
.,\
|
||||
lib/js.jar
|
||||
|
|
|
@ -34,7 +34,7 @@ public class JSAnalysisOptions extends AnalysisOptions {
|
|||
public JSAnalysisOptions(AnalysisScope scope, Iterable<? extends Entrypoint> e) {
|
||||
super(scope, e);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* should the analysis model the semantics of Function.prototype.call / apply?
|
||||
*/
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.Set;
|
|||
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.IField;
|
||||
import com.ibm.wala.classLoader.Language;
|
||||
import com.ibm.wala.classLoader.NewSiteReference;
|
||||
import com.ibm.wala.classLoader.ProgramCounter;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -117,7 +118,7 @@ public class PointerAnalysisImpl extends AbstractPointerAnalysis {
|
|||
InstanceFieldKey ifk = (InstanceFieldKey) key;
|
||||
if (ifk.getInstanceKey() instanceof ConstantKey) {
|
||||
ConstantKey<?> i = (ConstantKey<?>) ifk.getInstanceKey();
|
||||
if (i.getValue() instanceof String) {
|
||||
if (i.getValue() instanceof String && i.getConcreteType().getClassLoader().getLanguage().equals(Language.JAVA)) {
|
||||
StringConstantCharArray contents = StringConstantCharArray.make((ConstantKey<String>) i);
|
||||
instanceKeys.add(contents);
|
||||
Collection<InstanceKey> singleton = HashSetFactory.make();
|
||||
|
|
|
@ -8,16 +8,22 @@ import org.eclipse.wst.jsdt.core.IJavaScriptProject;
|
|||
|
||||
import com.ibm.wala.cast.ipa.callgraph.CAstAnalysisScope;
|
||||
import com.ibm.wala.cast.ir.ssa.AstIRFactory;
|
||||
import com.ibm.wala.cast.js.client.impl.ZeroCFABuilderFactory;
|
||||
import com.ibm.wala.cast.js.ipa.callgraph.JSAnalysisOptions;
|
||||
import com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil;
|
||||
import com.ibm.wala.cast.js.loader.JavaScriptLoader;
|
||||
import com.ibm.wala.cast.js.loader.JavaScriptLoaderFactory;
|
||||
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
||||
import com.ibm.wala.cast.js.types.JavaScriptTypes;
|
||||
import com.ibm.wala.classLoader.ClassLoaderFactory;
|
||||
import com.ibm.wala.ide.client.EclipseProjectSourceAnalysisEngine;
|
||||
import com.ibm.wala.ide.util.JavaScriptEclipseProjectPath;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
|
||||
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.impl.SetOfClasses;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.types.ClassLoaderReference;
|
||||
|
||||
|
@ -27,7 +33,29 @@ public class EclipseJavaScriptAnalysisEngine extends EclipseProjectSourceAnalysi
|
|||
super(project, "js");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AnalysisOptions getDefaultOptions(Iterable<Entrypoint> entrypoints) {
|
||||
return JSCallGraphUtil.makeOptions(getScope(), getClassHierarchy(), entrypoints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExclusionsFile() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope, IClassHierarchy cha) {
|
||||
return JSCallGraphUtil.makeScriptRoots(cha);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassLoaderFactory makeClassLoaderFactory(SetOfClasses exclusions) {
|
||||
return JSCallGraphUtil.makeLoaders();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AnalysisScope makeAnalysisScope() {
|
||||
return new CAstAnalysisScope(new JavaScriptLoaderFactory(new CAstRhinoTranslatorFactory()), Collections.singleton(JavaScriptLoader.JS));
|
||||
}
|
||||
|
@ -50,8 +78,7 @@ public class EclipseJavaScriptAnalysisEngine extends EclipseProjectSourceAnalysi
|
|||
@Override
|
||||
protected CallGraphBuilder getCallGraphBuilder(IClassHierarchy cha,
|
||||
AnalysisOptions options, AnalysisCache cache) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return new ZeroCFABuilderFactory().make((JSAnalysisOptions)options, cache, cha, scope, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.junit.Assert;
|
|||
import org.junit.Test;
|
||||
|
||||
import com.ibm.wala.cast.ipa.callgraph.CAstAnalysisScope;
|
||||
import com.ibm.wala.cast.js.client.EclipseJavaScriptAnalysisEngine;
|
||||
import com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil;
|
||||
import com.ibm.wala.cast.js.loader.JavaScriptLoader;
|
||||
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
||||
|
@ -21,6 +22,8 @@ import com.ibm.wala.ide.util.JavaScriptHeadlessUtil;
|
|||
import com.ibm.wala.ide.util.JsdtUtil;
|
||||
import com.ibm.wala.ide.util.JsdtUtil.CGInfo;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
|
||||
import com.ibm.wala.util.CancelException;
|
||||
|
||||
public class AbstractJSProjectScopeTest {
|
||||
|
||||
|
@ -58,4 +61,14 @@ public class AbstractJSProjectScopeTest {
|
|||
Assert.assertTrue("cannot find any cg nodes", info.cg.getNumberOfNodes()>0);
|
||||
}
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void testEngine() throws IOException, CoreException, IllegalArgumentException, CancelException {
|
||||
IJavaScriptProject p = JavaScriptHeadlessUtil.getJavaScriptProjectFromWorkspace(project.projectName);
|
||||
EclipseJavaScriptAnalysisEngine e = new EclipseJavaScriptAnalysisEngine(p);
|
||||
JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
||||
CallGraphBuilder b = e.defaultCallGraphBuilder();
|
||||
Assert.assertTrue(b != null);
|
||||
}
|
||||
*/
|
||||
}
|
Loading…
Reference in New Issue