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

update for support of modern JDKs #113

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

fabrice-ducos
Copy link

The official luaj repository still relies on very old versions of Java and JDK (<= 1.4). It supports JSE (Java Standard Edition) and JME (Java Micro Edition, for embedded Java).

For personal needs, I have updated it to modern versions of Java (8+) and JDK in this fork. The fork has been tested successfully on several modern operating systems (Windows 10, Linux Ubuntu 21.04, MacOSX Monterey 12.6).

Unfortunately, because of limitations of JME (generics are not, and probably will never be implemented in JME, as well as StringBuilder that is now required for concatenation of strings in modern Java), the support of JME had to be removed from the fork. The code for JME is still there (and it is possible to try to compile it optionally, but it will likely not pass) and is not planned to be removed in the near future.

JME is not actively developed anymore by Oracle and should be considered a legacy technology.

This pull request is provided as is, in the hope it might be useful for the maintainers of the official luaj repo. However, since the support of JME has been dropped in the fork (at least temporarily), they may consider not integrating these changes. This will be at the cost of staying at obsolete versions of Java (< 5).

Fabrice Ducos and others added 26 commits June 14, 2022 21:37
…jme and compile-jse

New versions of ant (e.g. 1.10.11) at this time of writing fail to build jar-jme

because the source (1.2) and target (1.3) are considered too old.

The jme target can now be compiled separately with 'ant jar-jme'

and the jse target with 'ant jar-jse'

The jse target will now be built with source="1.8" and target="1.8"
…eger, new Double...)

Replaced with valueOf() in order to silence many warnings from modern versions of the JDK
Internal classes create, resume, ..., yield, wrap renamed Create, Resume, ... Yield, Wrap

This change was motivated by the fact that yield is a restricted name in JDK 14+

A lowercase 'yield' class was producing a warning in JDK 8 and could potentially not compile in newer JDK.
…cted symbol fixed (it was returning a strange character

corresponding to an internal token code, meaningless to the user)
  -target 1.4 -> -target 1.8

<param name=java_version value="1.4+"/> -> <param name=java_version value="1.8+"/>
Replaced the deprecated, non generic Hashtable with generic Map (interface) and HashMap (implementation)

Hashtable h -> Map<LuaValue, Integer> h

this.h = new Hashtable() -> this.h = new HashMap<>()
…generic HashMap to non generic Hashtable for JME portability
Store Integers directly in h (instead of String): this.h.put(v, Integer.valueOf(idx)) -> this.h.put(v, new Integer(idx))
Store Integers directly in RESERVED (instead of String): Integer.valueOf(FIRST_RESERVED+i) -> new Integer(FIRST_RESERVED+i)
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.

None yet

2 participants