Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align definePackage behavior with JRE modular classloaders #64

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shartte
Copy link
Contributor

@shartte shartte commented Mar 28, 2024

This is an obvious breaking change

SJH will currently "manually" definePackage every package it comes across. The revised Javadoc for definePackage says this is discouraged, and the JRE itself does not do this.

This leads to a discrepancy between SJH and platform modular loaders which prevents us from using them, currently. (As a consequence we cannot put FML or ML directly onto the JRE module path).

A version of SJH with this change will no longer return the implementation version and specification version of packages, and calls to Package#isCompatibleWith will not work.

@shartte shartte marked this pull request as ready for review March 28, 2024 10:34
@marchermans
Copy link
Member

Do we know why this is discouraged by the JDK?

@shartte
Copy link
Contributor Author

shartte commented Mar 30, 2024

Do we know why this is discouraged by the JDK?

Nope. Probably because they define the package implicitly anyway in modular loaders.

p.s.: A side-effect is that the fix to load package-info is no longer needed since it'll be implicitly loaded by the package definition that results from defining a class in that package (fun!)

@Matyrobbrt
Copy link
Member

Was the use of the package in fabric mixin fixed?

@shartte
Copy link
Contributor Author

shartte commented Jun 2, 2024

Fabric Mixin released a new version that contains this change:
0.14.0+mixin.0.8.6

@shartte shartte requested a review from Matyrobbrt June 2, 2024 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants