diff --git a/com.ibm.wala.core/src/com/ibm/wala/classLoader/EclipseSourceDirectoryTreeModule.java b/com.ibm.wala.core/src/com/ibm/wala/classLoader/EclipseSourceDirectoryTreeModule.java index 906c05b05..fb2a44fc8 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/classLoader/EclipseSourceDirectoryTreeModule.java +++ b/com.ibm.wala.core/src/com/ibm/wala/classLoader/EclipseSourceDirectoryTreeModule.java @@ -13,11 +13,11 @@ package com.ibm.wala.classLoader; import java.io.File; import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; + import com.ibm.wala.eclipse.util.EclipseProjectPath; public class EclipseSourceDirectoryTreeModule extends SourceDirectoryTreeModule { diff --git a/com.ibm.wala.core/src/com/ibm/wala/eclipse/AbstractJavaAnalysisAction.java b/com.ibm.wala.core/src/com/ibm/wala/eclipse/AbstractJavaAnalysisAction.java index c83fe4c2c..ca9ac71ff 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/eclipse/AbstractJavaAnalysisAction.java +++ b/com.ibm.wala.core/src/com/ibm/wala/eclipse/AbstractJavaAnalysisAction.java @@ -58,10 +58,10 @@ public abstract class AbstractJavaAnalysisAction implements IObjectActionDelegat * Compute an analysis scope for the current selection */ public static AnalysisScope computeScope(IStructuredSelection selection) throws IOException { - return computeScope(selection, false); + return computeScope(selection, false, true); } - public static AnalysisScope computeScope(IStructuredSelection selection, boolean includeSource) throws IOException { + public static AnalysisScope computeScope(IStructuredSelection selection, boolean includeSource, boolean includeClassFiles) throws IOException { if (selection == null) { throw new IllegalArgumentException("null selection"); } @@ -72,7 +72,7 @@ public abstract class AbstractJavaAnalysisAction implements IObjectActionDelegat IJavaElement e = (IJavaElement) object; IJavaProject jp = e.getJavaProject(); try { - projectPaths.add(EclipseProjectPath.make(jp, includeSource)); + projectPaths.add(EclipseProjectPath.make(jp, includeSource, includeClassFiles)); } catch (CoreException e1) { e1.printStackTrace(); // skip and continue diff --git a/com.ibm.wala.core/src/com/ibm/wala/eclipse/util/EclipseProjectPath.java b/com.ibm.wala.core/src/com/ibm/wala/eclipse/util/EclipseProjectPath.java index f8e093b83..b5c78b9cd 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/eclipse/util/EclipseProjectPath.java +++ b/com.ibm.wala.core/src/com/ibm/wala/eclipse/util/EclipseProjectPath.java @@ -45,7 +45,6 @@ import com.ibm.wala.classLoader.BinaryDirectoryTreeModule; import com.ibm.wala.classLoader.EclipseSourceDirectoryTreeModule; import com.ibm.wala.classLoader.JarFileModule; import com.ibm.wala.classLoader.Module; -import com.ibm.wala.classLoader.SourceDirectoryTreeModule; import com.ibm.wala.client.AbstractAnalysisEngine; import com.ibm.wala.ipa.callgraph.AnalysisScope; import com.ibm.wala.types.ClassLoaderReference; @@ -105,12 +104,18 @@ public class EclipseProjectPath { * Should the analysis scope include source files */ private final boolean includeSource; + + /** + * Should the analysis scope include class files generated by the Eclipse build process? + */ + private final boolean includeClassFiles; - protected EclipseProjectPath(IJavaProject project, boolean includeSource) throws IOException, CoreException { + protected EclipseProjectPath(IJavaProject project, boolean includeSource, boolean includeClassFiles) throws IOException, CoreException { if (project == null) { throw new IllegalArgumentException("null project"); } this.includeSource = includeSource; + this.includeClassFiles = includeClassFiles; this.project = project; assert project != null; for (Loader loader : Loader.values()) { @@ -123,11 +128,11 @@ public class EclipseProjectPath { } public static EclipseProjectPath make(IJavaProject project) throws IOException, CoreException { - return make(project, false); + return make(project, false, true); } - public static EclipseProjectPath make(IJavaProject project, boolean includeSource) throws IOException, CoreException { - return new EclipseProjectPath(project, includeSource); + public static EclipseProjectPath make(IJavaProject project, boolean includeSource, boolean includeClassFiles) throws IOException, CoreException { + return new EclipseProjectPath(project, includeSource, includeClassFiles); } /** @@ -311,7 +316,7 @@ public class EclipseProjectPath { public AnalysisScope toAnalysisScope(AnalysisScope scope) { try { List l = MapUtil.findOrCreateList(modules, Loader.APPLICATION); - if (! includeSource) { + if (includeClassFiles) { File dir = makeAbsolute(project.getOutputLocation()).toFile(); if (!dir.isDirectory()) { System.err.println("PANIC: project output location is not a directory: " + dir);