-
Bug
-
Resolution: Fixed
-
P3
-
21
-
b14
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8333773 | 21.0.5 | Sergey Bylokhov | P3 | Resolved | Fixed | b01 |
Attempts to unpack and pack the java.compiler.jmod produces the next exception:
===========================================
Error: More than one ModuleTarget attribute
java.lang.module.InvalidModuleDescriptorException: More than one ModuleTarget attribute
at java.base/jdk.internal.module.ModuleInfo.invalidModuleDescriptor(ModuleInfo.java:1216)
at java.base/jdk.internal.module.ModuleInfo.doRead(ModuleInfo.java:243)
at java.base/jdk.internal.module.ModuleInfo.read(ModuleInfo.java:129)
at jdk.jlink/jdk.tools.jmod.JmodTask.describe(JmodTask.java:318)
at jdk.jlink/jdk.tools.jmod.JmodTask.run(JmodTask.java:207)
at jdk.jlink/jdk.tools.jmod.Main.main(Main.java:35)
===========================================
The bug can be reproduced if jmod tool from JDK21 is used for jmods files from jdk20 or jdk21. The tool from JDK20 works fine with jmods files from jdk20.
Steps to reproduce:
JAVA_HOME=/jdk21/build/windows-x86_64-server-release/images/jdk/
JMOD_BINARY=${JAVA_HOME}/bin/jmod.exe
JMOD_DIR=${JAVA_HOME}/jmods
TEST_JMOD=java.compiler.jmod
mkdir extract
mkdir pack
${JMOD_BINARY} extract ${JMOD_DIR}/${TEST_JMOD} --dir extract/${TEST_JMOD}
cd extract/${TEST_JMOD}
${JMOD_BINARY} create --target-platform -amd64 --module-version 21 --class-path classes --legal-notices legal ../../pack/java.compiler.jmod
cd ../../
${JMOD_BINARY} describe pack/java.compiler.jmod
The last command produced this error.
Tested on windows and linux.
The same exception can occur if the java.base jmod file should be repacked using hash+module-path of repacked java.compiler.jmod.
===========================================
Error: More than one ModuleTarget attribute
java.lang.module.InvalidModuleDescriptorException: More than one ModuleTarget attribute
at java.base/jdk.internal.module.ModuleInfo.invalidModuleDescriptor(ModuleInfo.java:1216)
at java.base/jdk.internal.module.ModuleInfo.doRead(ModuleInfo.java:243)
at java.base/jdk.internal.module.ModuleInfo.read(ModuleInfo.java:129)
at jdk.jlink/jdk.tools.jmod.JmodTask.describe(JmodTask.java:318)
at jdk.jlink/jdk.tools.jmod.JmodTask.run(JmodTask.java:207)
at jdk.jlink/jdk.tools.jmod.Main.main(Main.java:35)
===========================================
The bug can be reproduced if jmod tool from JDK21 is used for jmods files from jdk20 or jdk21. The tool from JDK20 works fine with jmods files from jdk20.
Steps to reproduce:
JAVA_HOME=/jdk21/build/windows-x86_64-server-release/images/jdk/
JMOD_BINARY=${JAVA_HOME}/bin/jmod.exe
JMOD_DIR=${JAVA_HOME}/jmods
TEST_JMOD=java.compiler.jmod
mkdir extract
mkdir pack
${JMOD_BINARY} extract ${JMOD_DIR}/${TEST_JMOD} --dir extract/${TEST_JMOD}
cd extract/${TEST_JMOD}
${JMOD_BINARY} create --target-platform -amd64 --module-version 21 --class-path classes --legal-notices legal ../../pack/java.compiler.jmod
cd ../../
${JMOD_BINARY} describe pack/java.compiler.jmod
The last command produced this error.
Tested on windows and linux.
The same exception can occur if the java.base jmod file should be repacked using hash+module-path of repacked java.compiler.jmod.
- backported by
-
JDK-8333773 jmod create --target-platform should replace existing ModuleTarget attribute
- Resolved
- relates to
-
JDK-8294962 Convert java.base/jdk.internal.module package to use the Classfile API to modify and write module-info.class
- Resolved
- links to
-
Commit openjdk/jdk21u-dev/1bb396f3
-
Commit openjdk/jdk/c2e01eba
-
Review openjdk/jdk21u-dev/666
-
Review openjdk/jdk/15514
(1 links to)