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

Side-safety docs #1

Merged
merged 4 commits into from
Nov 12, 2023
Merged

Conversation

Shadows-of-Fire
Copy link
Contributor

This PR adds javadocs to Dist explaining best practices with examples on how to prevent Dist-related classloading errors.

Resurrection of MinecraftForge/MergeTool#8

Supports the goal of removing DistExecutor and informing modders of how to properly guard code.

@sciwhiz12 sciwhiz12 added the documentation Improvements or additions to documentation label Oct 17, 2023
Copy link
Member

@sciwhiz12 sciwhiz12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the explanation for the example code needs to be reworked. It has some inaccuracies, as I've noted in my review comments.

We probably ought to mention the quirk that JVMs are free to load classes lazily or eagerly (see JLS 17 § 12.3 "Linking of Classes and Interfaces") -- it's just that most if not all JVMs, including HotSpot, currently available prefer the lazy way. (Initialization, where static initializers run, is a different matter, and is clearly defined by JLS 17 § 12.4.1 "When Initialization Occurs".)

src/forgeAPI/java/net/neoforged/api/distmarker/Dist.java Outdated Show resolved Hide resolved
src/forgeAPI/java/net/neoforged/api/distmarker/Dist.java Outdated Show resolved Hide resolved
src/forgeAPI/java/net/neoforged/api/distmarker/Dist.java Outdated Show resolved Hide resolved
src/forgeAPI/java/net/neoforged/api/distmarker/Dist.java Outdated Show resolved Hide resolved
src/forgeAPI/java/net/neoforged/api/distmarker/Dist.java Outdated Show resolved Hide resolved
src/forgeAPI/java/net/neoforged/api/distmarker/Dist.java Outdated Show resolved Hide resolved
Shadows-of-Fire and others added 2 commits November 12, 2023 01:58
its too hard

go look at the JLS or something idk
@Shadows-of-Fire Shadows-of-Fire merged commit be34907 into neoforged:main Nov 12, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants