--- old/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java 2016-09-28 15:01:51.000000000 -0700 +++ new/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java 2016-09-28 15:01:51.000000000 -0700 @@ -40,6 +40,7 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; + import jdk.tools.jlink.internal.Archive.Entry; import jdk.tools.jlink.internal.Archive.Entry.EntryType; import jdk.tools.jlink.internal.ResourcePoolManager.CompressedModuleData; @@ -122,10 +123,6 @@ }); } - public static boolean isClassPackage(String path) { - return path.endsWith(".class") && !path.endsWith("module-info.class"); - } - public static void recreateJimage(Path jimageFile, Set archives, ImagePluginStack pluginSupport) @@ -268,22 +265,7 @@ for (Archive archive : archives) { String mn = archive.moduleName(); for (Entry entry : entriesForModule.get(mn)) { - String path; - if (entry.type() == EntryType.CLASS_OR_RESOURCE) { - // Removal of "classes/" radical. - path = entry.name(); - if (path.endsWith("module-info.class")) { - path = "/" + path; - } else { - path = "/" + mn + "/" + path; - } - } else { - // Entry.path() contains the kind of file native, conf, bin, ... - // Keep it to avoid naming conflict (eg: native/jvm.cfg and config/jvm.cfg - path = "/" + mn + "/" + entry.path(); - } - - resources.add(new ArchiveEntryResourcePoolEntry(mn, path, entry)); + resources.add(new ArchiveEntryResourcePoolEntry(mn, entry.getResourceName(), entry)); } } return resources; @@ -320,6 +302,20 @@ return result.toArray(array); } + /** + * Returns the path of the resource. + */ + public static String resourceName(String path) { + Objects.requireNonNull(path); + String s = path.substring(1); + int index = s.indexOf("/"); + return s.substring(index + 1); + } + + public static String toPackage(String name) { + return toPackage(name, false); + } + private static String toPackage(String name, boolean log) { int index = name.lastIndexOf('/'); if (index > 0) {