RFR: 8353267: jmod create finds the wrong set of packages when class file are in non-package location

Alan Bateman alanb at openjdk.org
Mon Apr 7 15:26:54 UTC 2025


On Mon, 7 Apr 2025 15:08:56 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> `jmod create` maps the contents of the module to a set of packages. This mapping derives illegal package names when class resources are located in non-package locations, e.g. in the META-INF tree. `jlink` also has an issue in this area and doesn't correctly determine if a resource is in a named package when the resource is class file in a non-package location.
>
> src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java line 752:
> 
>> 750:          * Throws IOException for a .class file that is not module-info.class.
>> 751:          */
>> 752:         private void ensureNotClassFile(String name) {
> 
> The mention of the "unnamed package" may not always be applicable.

module-info.class aside, all classes in a named module must be in a named package so the exception message is correct. Or maybe you mean something else?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24362#discussion_r2031492041


More information about the core-libs-dev mailing list