Skip to content

Moduleloading: Fix loading of classes in packages only present as versioned entries#9396

Open
matthiasblaesing wants to merge 2 commits into
apache:masterfrom
matthiasblaesing:versioned_jarfile_packages
Open

Moduleloading: Fix loading of classes in packages only present as versioned entries#9396
matthiasblaesing wants to merge 2 commits into
apache:masterfrom
matthiasblaesing:versioned_jarfile_packages

Conversation

@matthiasblaesing
Copy link
Copy Markdown
Contributor

The NetBeans classloader infrastructure relies on a mapping of packages
classloaders can load resources/classes from. That mapping is currently
not scanning META-INF/versions/ for packages. This becomes a
problem if the versioned folder contains packages not present in the
non-versioned part of the JAR.

This change adds coverage for the versioned folder.

Closes: #9371

@matthiasblaesing matthiasblaesing added this to the NB31 milestone May 17, 2026
@matthiasblaesing matthiasblaesing added the ci:all-tests [ci] enable all tests label May 17, 2026
- General cleanups
- JarClassLoader#addURL is unused
- JarClassLoader#getClassData is unused
- Archive#isActive is unused
…sioned entries

The NetBeans classloader infrastructure relies on a mapping of packages
classloaders can load resources/classes from. That mapping is currently
not scanning META-INF/versions/<version> for packages. This becomes a
problem if the versioned folder contains packages not present in the
non-versioned part of the JAR.

This change adds coverage for the versioned folder.

Closes: apache#9371
@matthiasblaesing matthiasblaesing force-pushed the versioned_jarfile_packages branch from 8d8e8d7 to fc5f876 Compare May 17, 2026 14:14
@matthiasblaesing matthiasblaesing added Platform [ci] enable platform tests (platform/*) ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) and removed ci:all-tests [ci] enable all tests labels May 19, 2026
@apache apache locked and limited conversation to collaborators May 19, 2026
@apache apache unlocked this conversation May 19, 2026
@mbien
Copy link
Copy Markdown
Member

mbien commented May 22, 2026

have you tried:

ret = new JarFile(file, false);

->

ret = new JarFile(file, false, JarFile.OPEN_READ, JarFile.runtimeVersion());

and checked if the packages show up automatically when the jdk api is used? This will open the jar in multi release mode, default is jdk8 mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Platform [ci] enable platform tests (platform/*)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OneModuleClassLoader / JarClassLoader doesnt load versioned classess in MR (Multi-Release) jars

2 participants