Giter VIP home page Giter VIP logo

Comments (13)

sciwhiz12 avatar sciwhiz12 commented on June 13, 2024 1

stevefan:
It is not a workaround to disable the CoreMods system. Forge uses the CoreMods system for runtime patching that would be too maintenance-heavy, such as the IExtensibleEnum system.
The draft PR you linked is the envisioned solution in moving towards Java 15 support, but it will still need to be tested extensively and reviewed to ensure that nothing breaks in all situations (since the picture that LexManos posted in that PR does not indicate any mods are installed).
Would you mind joining the Discord, so we can continue this conversation there?

from coremods.

LexManos avatar LexManos commented on June 13, 2024

We know, however Minecraft still targets J8 so that is what we target.
Last time I looked into it, there were external projects ready to go for re-adding JS to the JVM.
So we just need to find one that we can ship IF Mojang ever adopts J15+

from coremods.

jamierocks avatar jamierocks commented on June 13, 2024

Last time I looked into it, there were external projects ready to go for re-adding JS to the JVM.

I guess there's always been Mozilla's Rhino, though according to the original JEP to add Nashorn, "Performance and memory usage of Nashorn applications should be significantly better than Rhino".

Oracle seems to be pushing for people to migrate to GraalVM, so that may well be worth looking into.

from coremods.

gigaherz avatar gigaherz commented on June 13, 2024

It has been in the back of Lex & CPW's mind for as many years as Nashorn has been deprecated. But so long as the vanilla launcher keeps using java8, there isn't much point changing the code.

I'd say, and this is my personal opinion: whenever the active LTS version of java (currently java11) starts being distributed without Nashorn, then it will be when it's worth looking into having options for when the platform's installed java isn't enough to run forge. Any platform should at least support the LTS version of Java, and if they don't, that's their issue, not ours.

from coremods.

LexManos avatar LexManos commented on June 13, 2024

Ya, Rhino is one of the options I've looked at. It seems like it'd be fine for our use cases, both license and functionality wise. As well as being a respectable download size. GraalVM isn't quite possible as as I said we have to target what Mojang ships. I need to look into it's native compiler to see if it could make the installer native without being 30MB. But that's a different task.

If someone wants to spend some time, feel free to make a POC of switching to Rhino. However it's not a high priority as we're still years away from Mojang even considering shipping J15+

from coremods.

kb-1000 avatar kb-1000 commented on June 13, 2024

GraalJS/Truffle are able to be used independent of GraalVM to my knowledge. And it has an option (polyglot.js.nashorn-compat) that makes it more Nashorn compatible on the JS side.

from coremods.

BedrockLegends avatar BedrockLegends commented on June 13, 2024

Figured to post this here if anyone has not seen this https://mail.openjdk.java.net/pipermail/nashorn-dev/2020-October/007557.html

from coremods.

jamierocks avatar jamierocks commented on June 13, 2024

The independent Nashorn project has now been released[1], though note that it requires Java 15 to run.

[1] https://mail.openjdk.java.net/pipermail/nashorn-dev/2020-November/007597.html

from coremods.

LatvianModder avatar LatvianModder commented on June 13, 2024

I think it's worth noting that I have a fork of Rhino as a mod to power KubeJS (for the same reason, nashorn dying) here: https://www.curseforge.com/minecraft/mc-mods/rhino which has some improvements over original

from coremods.

stevefan1999-personal avatar stevefan1999-personal commented on June 13, 2024

Maybe we need to consider a short-term transition to Rhino first since Mozilla claims to have added ScriptEngine support in their latest release (as of Jan 2021).

An even simpler workaround is the simply disable CoreMods support if JVM 15 platform detected.
A quick scoop led me here:

final NashornScriptEngineFactory nashornScriptEngineFactory = new NashornScriptEngineFactory();
final ScriptEngine scriptEngine = nashornScriptEngineFactory.getScriptEngine(
s -> ALLOWED_CLASSES.stream().anyMatch(s::equals)
);

This line is also pretty evil:

There's a draft PR that fixes this by building multi-targeting release for Java >=15 and 8 <= Java <= 11. This could be a viable long term solution.

from coremods.

TheSilkMiner avatar TheSilkMiner commented on June 13, 2024

There's already work being done towards getting Forge to run on Java 15, leveraging an existing Nashorn repack which seems to play nice with Java 14 and lower and doesn't waste that many resources being only 2 MBs in size (Source: Twitter).

I doubt a transition towards another scripting engine would benefit both the end user and the developers, due to potential compatibility issues between different implementations that could lead to different features being supported.

from coremods.

stevefan1999-personal avatar stevefan1999-personal commented on June 13, 2024

@sciwhiz12 I haven't really get into the architecture of Forge just yet...while I just made a few learning mods in Kotlin, I had never been touching the Forge main code.

This could take another week to learn the system...

from coremods.

LexManos avatar LexManos commented on June 13, 2024

The Nashorn issue has been resolved in 47918e2

Any other issues would need to be addressed separately, but I haven't encountered any.

from coremods.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.