Skip to content

Generate @NullMarked package infos directly into the src dir#5355

Open
DennisOchulor wants to merge 6 commits intoFabricMC:26.1.2from
DennisOchulor:package-info
Open

Generate @NullMarked package infos directly into the src dir#5355
DennisOchulor wants to merge 6 commits intoFabricMC:26.1.2from
DennisOchulor:package-info

Conversation

@DennisOchulor
Copy link
Copy Markdown
Contributor

This allows IDEs to actually give out nullability warnings to FAPI devs.

I've also renamed generatePackageInfos to generateMainPackageInfos and checkPackageInfos to checkMainPackageInfos to make it clear that it only involves the main sourceset. Also added an applyFixups task to run spotlessApply, generateMainPackageInfos and generateClientPackageInfos all at once.

I've not committed the generated package infos yet to ease reviewing.

@sylv256
Copy link
Copy Markdown
Member

sylv256 commented Apr 25, 2026

This is just going to create a ton of spam in commits. It's not worth it IMO

@sylv256 sylv256 added the enhancement New feature or request label Apr 25, 2026
@CallMeEchoCodes
Copy link
Copy Markdown
Contributor

This is just going to create a ton of spam in commits. It's not worth it IMO

We could exclude package-infos from diff if it becomes a major issue

I feel the better IDE integration is worth it, this is very likely the exact same thing Mojang does as well.

@sylv256
Copy link
Copy Markdown
Member

sylv256 commented Apr 26, 2026

We could exclude package-infos from diff if it becomes a major issue

How is that even possible? It's going to be in the diff anyway so we don't exclude regular package-info.java files. In fact, what are we going to do about those? What if I want documentation on my package?

@DennisOchulor
Copy link
Copy Markdown
Contributor Author

We could exclude package-infos from diff if it becomes a major issue

How is that even possible? It's going to be in the diff anyway so we don't exclude regular package-info.java files. In fact, what are we going to do about those? What if I want documentation on my package?

The generation code checks if there is an existing package-info and throws an error if it is not @NullMarked, otherwise it just skips that package. It already worked like that before this PR. So if you want a "regular" package-info, you just write it like normal.

@sylv256
Copy link
Copy Markdown
Member

sylv256 commented Apr 26, 2026

The generation code checks if there is an existing package-info and throws an error if it is not @NullMarked, otherwise it just skips that package. It already worked like that before this PR. So if you want a "regular" package-info, you just write it like normal.

Either way, it's going to make it more difficult to find the package-info.java files you intentionally created.

@modmuss50
Copy link
Copy Markdown
Member

I think this is the only solution, its a real shame intelij cannot figure it out even though they are already present in the generated src dir.

Loom does the same as this: FabricMC/fabric-loom#1443 its not ideal but I dont have a better solution.

In the long run I'd love to expand the IDE warnings to be CI build failuires, im not sure how feasible that is however.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants