--- old/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolEntry.java 2016-12-07 23:01:50.000000000 -0800 +++ new/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolEntry.java 2016-12-07 23:01:50.000000000 -0800 @@ -52,7 +52,10 @@ *
  • * * - * + * + * + * + * * * * @@ -61,10 +64,11 @@ public enum Type { CLASS_OR_RESOURCE, CONFIG, - NATIVE_CMD, - NATIVE_LIB, HEADER_FILE, + LEGAL_NOTICE, MAN_PAGE, + NATIVE_CMD, + NATIVE_LIB, TOP, OTHER } @@ -105,6 +109,17 @@ public InputStream content(); /** + * Returns a target linked with this entry. + * + * @implSpec The default implementation returns {@code null}. + * + * @return the target ResourcePoolEntry linked with this entry. + */ + public default ResourcePoolEntry linkedTarget() { + return null; + } + + /** * The ResourcePoolEntry content as an array of bytes. * * @return An Array of bytes. @@ -199,4 +214,21 @@ public static ResourcePoolEntry create(String path, Path file) { return create(path, Type.CLASS_OR_RESOURCE, file); } + + /** + * Create a ResourcePoolEntry for a resource the given path and type. + * If the target platform supports symbolic links, it will be created + * as a symbolic link to the given target entry; otherwise, the + * ResourcePoolEntry contains the relative path to the target entry. + * + * @param path The resource path. + * @param type The ResourcePoolEntry type. + * @param target The target entry + * @return A new ResourcePoolEntry + */ + public static ResourcePoolEntry createSymLink(String path, + ResourcePoolEntry.Type type, + ResourcePoolEntry target) { + return ResourcePoolEntryFactory.createSymbolicLink(path, type, target); + } }