Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java')
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java33
1 files changed, 21 insertions, 12 deletions
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java
index 0ef53adfc0..1d48b3d0b2 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java
@@ -19,6 +19,7 @@ import java.util.Map;
import java.util.StringTokenizer;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.eclipse.jdt.internal.compiler.CompilationResult;
@@ -35,45 +36,46 @@ import org.eclipse.jdt.internal.compiler.util.Util;
public class ModuleFinder {
- public static List<FileSystem.Classpath> findModules(File f, String destinationPath, Parser parser, Map<String, String> options, boolean isModulepath) {
+ public static List<FileSystem.Classpath> findModules(File f, String destinationPath, Parser parser, Map<String, String> options, boolean isModulepath, String release) {
List<FileSystem.Classpath> collector = new ArrayList<>();
- scanForModules(destinationPath, parser, options, isModulepath, false, collector, f);
+ scanForModules(destinationPath, parser, options, isModulepath, false, collector, f, release);
return collector;
}
protected static FileSystem.Classpath findModule(final File file, String destinationPath, Parser parser,
- Map<String, String> options, boolean isModulepath) {
+ Map<String, String> options, boolean isModulepath, String release) {
FileSystem.Classpath modulePath = FileSystem.getClasspath(file.getAbsolutePath(), null, !isModulepath, null,
- destinationPath == null ? null : (destinationPath + File.separator + file.getName()), options);
+ destinationPath == null ? null : (destinationPath + File.separator + file.getName()), options, release);
if (modulePath != null) {
- scanForModule(modulePath, file, parser, isModulepath);
+ scanForModule(modulePath, file, parser, isModulepath, release);
}
return modulePath;
}
protected static void scanForModules(String destinationPath, Parser parser, Map<String, String> options, boolean isModulepath,
- boolean thisAnAutomodule, List<FileSystem.Classpath> collector, final File file) {
+ boolean thisAnAutomodule, List<FileSystem.Classpath> collector, final File file, String release) {
FileSystem.Classpath entry = FileSystem.getClasspath(
file.getAbsolutePath(),
null,
!isModulepath,
null,
destinationPath == null ? null : (destinationPath + File.separator + file.getName()),
- options);
+ options,
+ release);
if (entry != null) {
- IModule module = scanForModule(entry, file, parser, thisAnAutomodule);
+ IModule module = scanForModule(entry, file, parser, thisAnAutomodule, release);
if (module != null) {
collector.add(entry);
} else {
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File f : files) {
- scanForModules(destinationPath, parser, options, isModulepath, isModulepath, collector, f);
+ scanForModules(destinationPath, parser, options, isModulepath, isModulepath, collector, f, release);
}
}
}
}
}
- protected static IModule scanForModule(FileSystem.Classpath modulePath, final File file, Parser parser, boolean considerAutoModules) {
+ protected static IModule scanForModule(FileSystem.Classpath modulePath, final File file, Parser parser, boolean considerAutoModules, String release) {
IModule module = null;
if (file.isDirectory()) {
String[] list = file.list(new FilenameFilter() {
@@ -106,7 +108,7 @@ public class ModuleFinder {
} else {
String moduleDescPath = getModulePathForArchive(file);
if (moduleDescPath != null) {
- module = extractModuleFromArchive(file, modulePath, moduleDescPath);
+ module = extractModuleFromArchive(file, modulePath, moduleDescPath, release);
}
}
if (considerAutoModules && module == null && !(modulePath instanceof ClasspathJrt)) {
@@ -224,10 +226,17 @@ public class ModuleFinder {
}
return null;
}
- private static IModule extractModuleFromArchive(File file, Classpath pathEntry, String path) {
+ private static IModule extractModuleFromArchive(File file, Classpath pathEntry, String path, String release) {
ZipFile zipFile = null;
try {
zipFile = new ZipFile(file);
+ if (release != null) {
+ String releasePath = "META-INF/versions/" + release + "/" + path; //$NON-NLS-1$ //$NON-NLS-2$
+ ZipEntry entry = zipFile.getEntry(releasePath);
+ if (entry != null) {
+ path = releasePath;
+ }
+ }
ClassFileReader reader = ClassFileReader.read(zipFile, path);
IModule module = getModule(reader);
if (module != null) {

Back to the top