CaffeineMC / hydrogen-fabric

Things of which are too dangerous to put in Lithium.
GNU Lesser General Public License v3.0
511 stars 66 forks source link

Migrate to modern MethodHandles.Lookup usage on Java 9 and above #14

Closed magneticflux- closed 3 years ago

magneticflux- commented 3 years ago

Closes #13

magneticflux- commented 3 years ago

The publish action might have to be changed as well to compile on 14 like the build action does. Alternatively, I could just reference all the Java 9 classes by name through reflection, but that would be tedious.

DragonEggBedrockBreaking commented 3 years ago

Would this prevent people who use Java 8 from using this mod (I use Java 11, so just I'm curious and this doesn't apply to me, but I also know many people who use Java 8).

pajicadvance commented 3 years ago

Would this prevent people who use Java 8 from using this mod (I use Java 11, so just I'm curious and this doesn't apply to me, but I also know many people who use Java 8).

Taking a quick look at the code, MethodHandles.Lookup is only used if Java 9 or above is detected, so the old code is still being used if you're running Java 8.

DragonEggBedrockBreaking commented 3 years ago

Would this prevent people who use Java 8 from using this mod (I use Java 11, so just I'm curious and this doesn't apply to me, but I also know many people who use Java 8).

Taking a quick look at the code, MethodHandles.Lookup is only used if Java 9 or above is detected, so the old code is still being used if you're running Java 8.

OK, cool. Thanks for the quick answer!!

jellysquid3 commented 3 years ago

Closing as #21 refines this solution a little bit further. Thank you for your contribution.