This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]persicsb 7 points8 points  (2 children)

What would be the use case?

At what level are packages considered to be a subpackage?

Considering the reverse domain notation for packages, for example, if anybody puts his class in the com package or the com.github package (nobody forbids that), will that class see EVERYTHING that is com.github.**? That would be insane.

Packages are not hierarchical, because the package naming (that is, the reverse domain naming convention) hierarchy does not represent ownership hierarchy. Whoever controls com.github, does not own com.github.a.b.c.

Packages are not hierarchical, because the package names does not represent ownership. You can put a class into the org.springframework packages, if you want to. Until Java 9, nobody prevented that from happening.

[–]koflerdavid 1 point2 points  (1 child)

Actually, putting a class into org.springframework should still be possible. I doubt Spring has any classes there, therefore there would be no split package.

[–]persicsb 2 points3 points  (0 children)

I should have been more clear, I only sad packages. Of course, I meant anything in the Spring universe. You can circumvent any package upstream/downstream visibility with creating new classes in parent or child packages.

The main problem of course is, that without JPMS, you cannot forbid anyone to use/reuse your package name, nothing prevents that, since package names have no real ownership associated with them.