From 53cad9e7ba34e75d0957d0599eced414303ada4b Mon Sep 17 00:00:00 2001 From: dolby Date: Tue, 21 Aug 2012 16:06:01 -0400 Subject: [PATCH] more separation for JS eclipse stuff --- com.ibm.wala.cast.java.jdt.test/.project | 2 +- .../META-INF/MANIFEST.MF | 4 +-- .../launchers/JDTJava15IRTests.launch | 4 +-- .../launchers/JDTJavaIRTests (Manu).launch | 4 +-- .../launchers/JDTJavaIRTests.launch | 4 +-- .../util/JavaScriptEclipseProjectPath.java | 16 ++++++++++-- com.ibm.wala.ide/META-INF/MANIFEST.MF | 4 +-- .../ibm/wala/ide/util/EclipseProjectPath.java | 25 +++++++++++-------- 8 files changed, 38 insertions(+), 25 deletions(-) diff --git a/com.ibm.wala.cast.java.jdt.test/.project b/com.ibm.wala.cast.java.jdt.test/.project index 18c1f2267..82bcfaa91 100644 --- a/com.ibm.wala.cast.java.jdt.test/.project +++ b/com.ibm.wala.cast.java.jdt.test/.project @@ -1,6 +1,6 @@ - com.ibm.wala.cast.java.jdt.test + com.ibm.wala.ide.jdt.test diff --git a/com.ibm.wala.cast.java.jdt.test/META-INF/MANIFEST.MF b/com.ibm.wala.cast.java.jdt.test/META-INF/MANIFEST.MF index 3249129f4..1f5d6efaf 100644 --- a/com.ibm.wala.cast.java.jdt.test/META-INF/MANIFEST.MF +++ b/com.ibm.wala.cast.java.jdt.test/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: WALA CAst Java JDT Test Plug-in -Bundle-SymbolicName: com.ibm.wala.cast.java.jdt.test +Bundle-SymbolicName: com.ibm.wala.ide.jdt.test Bundle-Version: 1.0.0 Bundle-Activator: com.ibm.wala.cast.java.jdt.test.Activator Bundle-Vendor: IBM @@ -9,7 +9,7 @@ Require-Bundle: com.ibm.wala.cast.java.test;bundle-version="1.0.0", com.ibm.wala.cast.test;bundle-version="1.0.0", com.ibm.wala.ide.tests;bundle-version="1.1.3", com.ibm.wala.core.tests;bundle-version="1.1.3", - com.ibm.wala.cast.java.jdt;bundle-version="1.0.0", + com.ibm.wala.ide.jdt;bundle-version="1.0.0", com.ibm.wala.cast.java;bundle-version="1.0.0", com.ibm.wala.cast;bundle-version="1.0.0", com.ibm.wala.ide;bundle-version="1.1.3", diff --git a/com.ibm.wala.cast.java.jdt.test/launchers/JDTJava15IRTests.launch b/com.ibm.wala.cast.java.jdt.test/launchers/JDTJava15IRTests.launch index 69c793d9c..66e1e549d 100644 --- a/com.ibm.wala.cast.java.jdt.test/launchers/JDTJava15IRTests.launch +++ b/com.ibm.wala.cast.java.jdt.test/launchers/JDTJava15IRTests.launch @@ -16,7 +16,7 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/com.ibm.wala.cast.java.jdt.test/launchers/JDTJavaIRTests (Manu).launch b/com.ibm.wala.cast.java.jdt.test/launchers/JDTJavaIRTests (Manu).launch index dcd40c821..33de77075 100644 --- a/com.ibm.wala.cast.java.jdt.test/launchers/JDTJavaIRTests (Manu).launch +++ b/com.ibm.wala.cast.java.jdt.test/launchers/JDTJavaIRTests (Manu).launch @@ -16,7 +16,7 @@ - + @@ -27,7 +27,7 @@ - + diff --git a/com.ibm.wala.cast.java.jdt.test/launchers/JDTJavaIRTests.launch b/com.ibm.wala.cast.java.jdt.test/launchers/JDTJavaIRTests.launch index 8d13ecf9b..d266dfd6b 100644 --- a/com.ibm.wala.cast.java.jdt.test/launchers/JDTJavaIRTests.launch +++ b/com.ibm.wala.cast.java.jdt.test/launchers/JDTJavaIRTests.launch @@ -16,7 +16,7 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/JavaScriptEclipseProjectPath.java b/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/JavaScriptEclipseProjectPath.java index 105199781..b4f8a5597 100644 --- a/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/JavaScriptEclipseProjectPath.java +++ b/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/JavaScriptEclipseProjectPath.java @@ -10,9 +10,21 @@ import org.eclipse.wst.jsdt.core.IJavaScriptProject; import org.eclipse.wst.jsdt.core.JavaScriptCore; import org.eclipse.wst.jsdt.core.JavaScriptModelException; +import com.ibm.wala.cast.js.types.JavaScriptTypes; +import com.ibm.wala.types.ClassLoaderReference; + public class JavaScriptEclipseProjectPath extends EclipseProjectPath { + public enum JSLoader implements ILoader { + JAVASCRIPT(JavaScriptTypes.jsLoader); + + private ClassLoaderReference ref; + JSLoader(ClassLoaderReference ref) { + this.ref = ref; + } + } + protected JavaScriptEclipseProjectPath(IJavaScriptProject p) throws IOException, CoreException { super(AnalysisScopeType.SOURCE_FOR_PROJ_AND_LINKED_PROJS); @@ -44,12 +56,12 @@ public class JavaScriptEclipseProjectPath extends EclipseProjectPath { protected abstract E resolve(E entry); - protected abstract void resolveClasspathEntry(P project, E entry, Loader loader, boolean includeSource, boolean cpeFromMainProject); + protected abstract void resolveClasspathEntry(P project, E entry, ILoader loader, boolean includeSource, boolean cpeFromMainProject); protected abstract void resolveProjectClasspathEntries(P project, boolean includeSource); + interface ILoader { + + }; + /** * Eclipse projects are modeled with 3 loaders, as described above. */ - public enum Loader { + public enum Loader implements ILoader { APPLICATION(ClassLoaderReference.Application), EXTENSION(ClassLoaderReference.Extension), PRIMORDIAL( - ClassLoaderReference.Primordial), JAVASCRIPT(JavaScriptTypes.jsLoader); + ClassLoaderReference.Primordial); private ClassLoaderReference ref; @@ -98,7 +101,7 @@ public abstract class EclipseProjectPath { // SJF: Intentionally do not use HashMapFactory, since the Loader keys in the following must use // identityHashCode. TODO: fix this source of non-determinism? - protected final Map> modules = new HashMap>(); + protected final Map> modules = new HashMap>(); /** * Classpath entries that have already been resolved and added to the scope. @@ -112,7 +115,7 @@ public abstract class EclipseProjectPath { protected EclipseProjectPath(AnalysisScopeType scopeType) throws IOException, CoreException { this.scopeType = scopeType; - for (Loader loader : Loader.values()) { + for (ILoader loader : Loader.values()) { MapUtil.findOrCreateList(modules, loader); } } @@ -133,7 +136,7 @@ public abstract class EclipseProjectPath { } - protected void resolveLibraryPathEntry(Loader loader, IPath p) throws IOException { + protected void resolveLibraryPathEntry(ILoader loader, IPath p) throws IOException { File file = makeAbsolute(p).toFile(); JarFile j; try { @@ -151,7 +154,7 @@ public abstract class EclipseProjectPath { } } - protected void resolveSourcePathEntry(Loader loader, boolean includeSource, boolean cpeFromMainProject, IPath p, IPath o, String fileExtension) { + protected void resolveSourcePathEntry(ILoader loader, boolean includeSource, boolean cpeFromMainProject, IPath p, IPath o, String fileExtension) { if (includeSource) { List s = MapUtil.findOrCreateList(modules, loader); s.add(new EclipseSourceDirectoryTreeModule(p, fileExtension)); @@ -162,7 +165,7 @@ public abstract class EclipseProjectPath { } } - protected void resolveProjectPathEntry(Loader loader, boolean includeSource, IPath p) throws IOException { + protected void resolveProjectPathEntry(ILoader loader, boolean includeSource, IPath p) throws IOException { IPath projectPath = makeAbsolute(p); IWorkspace ws = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = ws.getRoot(); @@ -219,7 +222,7 @@ public abstract class EclipseProjectPath { /** * traverse a bundle description and populate the analysis scope accordingly */ - private void resolveBundleDescriptionClassPath(P project, BundleDescription bd, Loader loader, boolean includeSource) throws CoreException, + private void resolveBundleDescriptionClassPath(P project, BundleDescription bd, ILoader loader, boolean includeSource) throws CoreException, IOException { assert bd != null; if (alreadyProcessed(bd)) { @@ -273,7 +276,7 @@ public abstract class EclipseProjectPath { return true; } - protected void resolveClasspathEntries(P project, List l, Loader loader, boolean includeSource, boolean entriesFromTopLevelProject) { + protected void resolveClasspathEntries(P project, List l, ILoader loader, boolean includeSource, boolean entriesFromTopLevelProject) { for (int i = 0; i < l.size(); i++) { resolveClasspathEntry(project, resolve((E)l.get(i)), loader, includeSource, entriesFromTopLevelProject); }