Skip to content

Resolve packages through realm imports and parent in ClassRealm - #161

Open
slachiewicz wants to merge 3 commits into
masterfrom
agent/class-realm-get-package
Open

slachiewicz wants to merge 3 commits into
masterfrom
agent/class-realm-get-package

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Overrides getPackage and getPackages in ClassRealm so a package is visible exactly where a class in it would load: own class path, imports (package and exact class), then the parent where parent imports allow it. This is #159 carried onto current master: its two commits are cherry-picked as authored, with one commit on top that also exposes the unnamed package through an exact class import, the last open review finding there.

Merge with "Rebase and merge": a squash would drop the original commits and their author from the history.

Closes #126

Verified: mvn -B -ntp verify → BUILD SUCCESS, 221 tests, 0 failures, 1 skipped; the unnamed-package test fails without the last commit (macOS, JDK 17)

slachiewicz and others added 3 commits November 8, 2026 21:10
getPackage and getPackages now follow the same import and parent-import
rules as loadClass, so Package.getPackage sees imported packages. Do not
widen this past those rules: a package must never be visible where a
class in it is not.
@slachiewicz slachiewicz added the bug Something isn't working label Nov 8, 2026
@slachiewicz
slachiewicz marked this pull request as ready for review November 8, 2026 23:00

This branch has not been deployed

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Packages imported from other ClassLoaders are not visible

1 participant