> Try to create an image containing two modules, each with an > `OSGI-INF/MANIFEST.MF` resource. Although `OSGI_INF` is a non-package > resource directory, `jlink` fails with: > > java.lang.IllegalStateException: Multiple modules contain non-empty package: > OSGI-INF > at > jdk.jlink/jdk.tools.jlink.internal.ImageResourcesTree$PackageNode.<init>(ImageResourcesTree.java:144) > at > jdk.jlink/jdk.tools.jlink.internal.ImageResourcesTree$Tree.lambda$buildTree$1(ImageResourcesTree.java:219) > at java.base/java.util.TreeMap.forEach(TreeMap.java:1318) > at > jdk.jlink/jdk.tools.jlink.internal.ImageResourcesTree$Tree.buildTree(ImageResourcesTree.java:211) > at > jdk.jlink/jdk.tools.jlink.internal.ImageResourcesTree$Tree.<init>(ImageResourcesTree.java:182) > at > jdk.jlink/jdk.tools.jlink.internal.ImageResourcesTree.<init>(ImageResourcesTree.java:457) > at > jdk.jlink/jdk.tools.jlink.internal.ImageFileCreator.generateJImage(ImageFileCreator.java:272) > at > jdk.jlink/jdk.tools.jlink.internal.ImageFileCreator.writeImage(ImageFileCreator.java:196) > at > jdk.jlink/jdk.tools.jlink.internal.ImageFileCreator.create(ImageFileCreator.java:127) > > The problem is that `ImageResourcesTree.Tree.buildTree()` excludes only the > empty package and `META-INF` paths when populating `/packages`. It does not > check whether the remaining names are valid package names. > > The proposed fix is to exclude all invalid package names from `/packages` > while preserving their resources in the image. > > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai).
Dušan Bálek has updated the pull request incrementally with one additional commit since the last revision: Comment updated ------------- Changes: - all: https://git.openjdk.org/jdk/pull/33162/files - new: https://git.openjdk.org/jdk/pull/33162/files/634b9506..5f017956 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=33162&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=33162&range=00-01 Stats: 3 lines in 1 file changed: 1 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/33162.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/33162/head:pull/33162 PR: https://git.openjdk.org/jdk/pull/33162
