question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make the Java mod contain additional information

See original GitHub issue

The Issue

Currently, the built-in java mod has a version format of vJAVA_MAJOR_VERSION.

This version does not contain the minor and patch versions of Java (e.g. it is only 15 when running Java 15.0.2) and does not contain the vendor and VM.

My Proposed Solution

For the Java version, include the minor and patch versions as well. This may have problems with older Java versions that use the 1.x versioning system, but it shouldn’t be too difficult to implement.

I also propose including the vendor and the VM type in the build metadata (ignored in version comparisons) of the version.

Examples

  • Version 15.0.2 from vendor AdoptOpenJdk running HotSpot would look like v15.0.2+adopt-hotspot
  • Version 14.0 from vendor OpenJdk running J9 would look like v14.0.0+openjdk-j9
  • Version (1.)8.0_282 from vendor AdoptOpenJdk running HotSpot would look like v8.0.282+adopt-hotspot

Why Would This be Useful?

A mod may be known to be incompatible with J9. It could just perform a check on the java version to see if it ends with -j9 and throw an exception with a detailed error if that is the case.

Or, a mod may have a special compatibility mode for J9 or HotSpot. It would do the same thing.

Although Java is not made by our friends at Mojank, there can be a rare case of a mod breaking (native mods?) with a minor Java version upgrade. They could insert a breaks dependency to that minor version (combined with the reason property PR, this would be even more useful).

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
sfPlayer1commented, Jun 14, 2021

While introducing the feature we decided against including more version parts because only the specification version is reliable across vendors, everything else is at best convention that is already not followed by everyone. This makes it useless or even dangerous for dep matching. The same info is still available the same way we retrieve it - querying system properties. The proposed build metadata approach doesn’t have a real benefit over querying those, both have to be checked manually and don’t feed into the dependency solving.

I don’t think preview features are not worth supporting explicitly, if really needed mods can still do some checking/gating internally.

1reaction
haykam821commented, Jun 14, 2021

Mods can depend on newer Java features even if Minecraft does not provide that Java version by default. The Minecraft dependency on Java (#437) later on as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's the syntax for mod in java - Stack Overflow
I'll now break it down into its components. The modulus operator in Java is the percent character (%). Therefore taking an int %...
Read more >
The Ultimate Guide to Minecraft Modding with Java - CodaKid
In this step-by-step Minecraft Modding tutorial, CodaKid instructors teach you how to create a custom mod in Minecraft 1.12 using Java and ...
Read more >
Minecraft, But I Show You How to Code a Modded Item!
In this tutorial I show you how to code a Minecraft mod for the Fabric Mod ... JDK 11 (MUST HAVE ): https://www.oracle.com/...
Read more >
Minecraft: Java Edition modding guide — How to install and ...
Minecraft: Java Edition is made better with mods, and we have everything you need to know to install and play with mods on...
Read more >
Creating a Minecraft Mod using Java and Fabric | Horus Lugo
Multiple tools help you build Minecraft mods, and I chose Fabric because ... we also need to have the Java Development Kit or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found