Skip to content

Hide the enclosing package of a package import - #171

Merged
slachiewicz merged 1 commit into
own-package-on-java-8from
package-import-keeps-enclosing-package-hidden
Nov 27, 2026
Merged

slachiewicz merged 1 commit into
own-package-on-java-8from
package-import-keeps-enclosing-package-hidden

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

A package import such as a.b was read as an import of class b in package a, so getPackage("a") and getPackages() returned the foreign realm's package a although no class of a was visible. The import now counts as a class import only when the import realm has that class file. This sits on #170 (same ClassRealm.getPackage), so the base is its branch.

Verified: mvn verify on JDK 21 and mvn test on JDK 8 (Docker) → 229 tests, 0 failures.

An import a.b names a package or a class b in a; only treat it as a class when the class file exists.
@slachiewicz slachiewicz added the bug Something isn't working label Nov 26, 2026
@slachiewicz
slachiewicz marked this pull request as ready for review November 27, 2026 05:40
@slachiewicz
slachiewicz merged commit fec23eb into own-package-on-java-8 Nov 27, 2026
15 checks passed
@slachiewicz
slachiewicz deleted the package-import-keeps-enclosing-package-hidden branch November 27, 2026 05:42
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.

1 participant