Skip to content

Conversation

SWinxy
Copy link
Collaborator

@SWinxy SWinxy commented Jun 17, 2025

The JDK version for Amidst is now 24, up from 8 (released in 2014). Several dependencies have also been upgraded. Moving to Java 24 will improve performance and allow for the use of language features and APIs added in the decade plus since. This is also a part of a plan to bundle the JRE with Amidst in distributing the application, rather than relying on users to download a (unsupported) Java version themselves. Modern Java applications should have the runtime, dependencies, and code bundled into a package, which Uber/shaded JARs do not do (and why I note that the Maven plugin will be removed). (This will also mean that the JRE we distribute can be much smaller, only including the modules necessary.)

Aside from that, I've been working to condense the launch code. Methods used once were mostly inlined, as the code run needn't be abstracted. (Abstracting something away should really only be done when the method is invoked more than once, if the logic is detached from the rest of the code, or to inline something with a result from a more complicated function.) 'Factory' methods were also inlined, as they were only used once and belie what the code is actually doing (creating a new object).

The three 'Injector' classes were merged with their respective classes. These pairs were so tightly coupled, that it made it more complicated splitting it in two. The result is much cleaner and direct, and will help in my ability to maintain the application. In theory, all these changes should cause no regressions.

SWinxy added 10 commits May 18, 2025 16:08
Build process is broken because the Shade plugin does not support class files compiled by JDK 24. I plan to remove it in the future because I do not think applications should not use "Uber" jars.
The initialization logic is contained in the main method, rather than split into sub-methods. Removed code relating to graphics acceleration, a feature that is enabled by default on Swing; Swing defaults to the best pipeline on the system.
I expect to remove this class soon. Too many indirections to open the UI.
Everything initialized is in the, well, initializer.
This will be merged into ProfileSelectWindow as those are tightly coupled.
…method

I doubt there are any issues, and I suspect the issue that Amidst was trying to get around was fixed between JDK 8 and JDK 24.
These interfaces were for lambdas, but it's better to pass objects or primitives through.
@stefandollase
Copy link
Contributor

stefandollase commented Sep 28, 2025

I just reviewed your changes. Its great, that you updated the Java version! Maybe, it can be updated again, to the new LTS? You might also want to adjust the file metadata.properties. It still contains Java 1.8, and you added some of the other properties from this file to the main pom.xml.

(This will also mean that the JRE we distribute can be much smaller, only including the modules necessary.)

I would like that, but am a bit worried that this might be harder for Amidst than for other Applications. The reason is, that the bundled JRE does not only need to provide all modules to run Amidst, but it also needs to provide the modules to run Minecraft, in all the different versions. Just a small heads-up.

Since you plan to maintain the project, I don't mind the other code adjustments. And I agree, that constructors with lots of parameters are not great.

When I try to build it with Java 24, then I get the following error.

➜  amidst git:(swinxy) ✗ mvn clean install            
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper (file:/usr/share/maven/lib/guava.jar)
WARNING: Please consider reporting this to the maintainers of class com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------------< amidst:amidst >----------------------------
[INFO] Building amidst 5.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ amidst ---
[INFO] Deleting /data/topics/amidst/amidst/target
[INFO] 
[INFO] --- properties-maven-plugin:1.0.0:read-project-properties (default) @ amidst ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ amidst ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 136 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.11.0:compile (default-compile) @ amidst ---
[INFO] Changes detected - recompiling the module! :source
[INFO] Compiling 338 source files with javac [debug target 24] to target/classes
[INFO] /data/topics/amidst/amidst/src/main/java/amidst/mojangapi/file/service/PlayerInformationService.java: Some input files use or override a deprecated API.
[INFO] /data/topics/amidst/amidst/src/main/java/amidst/mojangapi/file/service/PlayerInformationService.java: Recompile with -Xlint:deprecation for details.
[INFO] /data/topics/amidst/amidst/src/main/java/amidst/gui/main/menu/Menus.java: /data/topics/amidst/amidst/src/main/java/amidst/gui/main/menu/Menus.java uses unchecked or unsafe operations.
[INFO] /data/topics/amidst/amidst/src/main/java/amidst/gui/main/menu/Menus.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ amidst ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 142 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.11.0:testCompile (default-testCompile) @ amidst ---
[INFO] Changes detected - recompiling the module! :dependency
[INFO] Compiling 47 source files with javac [debug target 24] to target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ amidst ---
[INFO] Surefire report directory: /data/topics/amidst/amidst/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running amidst.mojangapi.world.test.TestWorldEntryEquality
[info] Unable to find spawn biome. Falling back to [0, 0].
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.798 sec
Running amidst.mojangapi.world.test.VersionFeaturesTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.123 sec
Running amidst.mojangapi.world.test.RecognisedVersionTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running amidst.mojangapi.world.test.CoordinateUtilsTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.007 sec
Running amidst.logging.MessageFormatterTest
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.011 sec

Results :

Tests run: 17, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ amidst ---
[INFO] Building jar: /data/topics/amidst/amidst/target/amidst-v4-7.jar
[INFO] 
[INFO] --- maven-shade-plugin:3.6.0:shade (default) @ amidst ---
[INFO] Including com.google.code.gson:gson:jar:2.13.1 in the shaded jar.
[INFO] Including com.google.errorprone:error_prone_annotations:jar:2.38.0 in the shaded jar.
[INFO] Including com.miglayout:miglayout-swing:jar:4.2 in the shaded jar.
[INFO] Including com.miglayout:miglayout-core:jar:4.2 in the shaded jar.
[INFO] Including args4j:args4j:jar:2.37 in the shaded jar.
[INFO] Including com.github.Querz:NBT:jar:6.1 in the shaded jar.
[INFO] Minimizing jar amidst:amidst:jar:5.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12.251 s
[INFO] Finished at: 2025-09-28T14:03:45+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.6.0:shade (default) on project amidst: Error creating shaded jar: Unsupported class file major version 68 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Please let me know about your plans for this PR. Would you like me to review (done) and integrate the changes? Also, I recommend to change only one thing per PR. For me it is also fine, if you integrate the changes into master by yourself. I think you have the right to do that. Otherwise, please let me know in #1144.

Its great to see this project to get some attention again =)

@SWinxy
Copy link
Collaborator Author

SWinxy commented Oct 11, 2025

Hey Stefan, sorry about the wait. I've been taking a break programming (the past 6 or 7 weeks have not been conducive for it). I had made this PR because I can't push directly to the branch, then forgot about it! oops. The intention is to break the build pipeline as it exists currently, and fix it later with a non-shaded JAR solution.

@SWinxy SWinxy merged commit e824b41 into master Oct 13, 2025
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.

2 participants