Made ctor protected so it can be called from subclasses. Added method isPrimordialJarFile() so subclasses can prevent certain jar files from being processed by the Primordial loader and handle them themselves (e.g. to let the X10Primordial loader handle the X10 runtime jar).

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2516 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
rmfuhrer 2008-01-31 15:56:19 +00:00
parent ddd7456fc0
commit ac26773e16
1 changed files with 15 additions and 3 deletions

View File

@ -100,7 +100,7 @@ public class EclipseProjectPath {
private final Collection<IClasspathEntry> alreadyResolved = HashSetFactory.make();
private EclipseProjectPath(IPath workspaceRootPath, IJavaProject project) throws JavaModelException, IOException {
protected EclipseProjectPath(IPath workspaceRootPath, IJavaProject project) throws JavaModelException, IOException {
this.workspaceRootPath = workspaceRootPath;
this.project = project;
assert workspaceRootPath != null;
@ -145,8 +145,10 @@ public class EclipseProjectPath {
// a corrupted file. ignore it.
return;
}
Set<Module> s = MapUtil.findOrCreateSet(binaryModules, loader);
s.add(file.isDirectory() ? (Module) new BinaryDirectoryTreeModule(file) : (Module) new JarFileModule(j));
if (isPrimordialJarFile(j)) {
Set<Module> s = MapUtil.findOrCreateSet(binaryModules, loader);
s.add(file.isDirectory() ? (Module) new BinaryDirectoryTreeModule(file) : (Module) new JarFileModule(j));
}
} else if (e.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
File file = makeAbsolute(e.getPath()).toFile();
Set<Module> s = MapUtil.findOrCreateSet(sourceModules, Loader.SOURCE);
@ -178,6 +180,16 @@ public class EclipseProjectPath {
}
}
/**
* @return true if the given jar file should be handled by the Primordial
* loader. If false, other provisions should be made to add the jar file
* to the appropriate component of the AnalysisScope. Subclasses can
* override this method.
*/
protected boolean isPrimordialJarFile(JarFile j) {
return true;
}
protected void resolveClasspathEntries(IClasspathEntry[] entries, Loader loader, String fileExtension) throws JavaModelException, IOException {
for (int i = 0; i < entries.length; i++) {
resolveClasspathEntry(entries[i], loader, fileExtension);