jMonkeyEngine / jMonkeyEngine/jmonkeyengine

List of problematic code on non-standard jvms

Open
#2,551 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs investigation Refactoring and Cleanup
Dominant language
Java
Stars
4.3k
Forks
1.2k
Avg merge
4d 7h
Merged PRs (30d)
14

Description

I will use this issue to compile a list of code that requires workarounds when running the engine on non fully-compliant or non fully-reflective jvms.
Some of these instances are legacy reflect code that, with the newer paradigms and changing expectations, could be easily rewritten in non reflective java.

PS. If you know other instances of problematic code, feel free to comment with your findings.

Problematic Reflection: DesktopAssetManager.loadConfigFile()

Loads a predefined list of locators and loaders from a .cfg file.
This could be rewritten by:

  • making JmeSystemDelegate.newAssetManager non-final, so platforms can register the very bare-minimum requirements (bitmap font loader for stats and resource locator).
  • creating a set of helpers classes that the developer can use to load additional stuff (eg. CoreLoaders.load(assetManager) ExtraLoaders.load(assetManager)...)

Problematic Reflection: Method calling Tweens

Might be replaced by a global map of named Runnables

Serialization: readExternal/writeExternal

Quaternions, Vectors and Matrices classes have serialization methods

readExternal(ObjectInput in)
writeExternal(ObjectOutput out)

that use the internal jvm serialization.
Afaik they are not used in the engine, and they cause issues with teavm that does not support the java native serialization.

GltfLoader CustomContentManager

https://github.com/jMonkeyEngine/jmonkeyengine/blob/8cc308616271604f13f9311207cc1e5ebd7a8169/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/CustomContentManager.java#L48-L71

All the reflective instantiation of the extensions and extra loader here can be easily replaced with Suppliers.

Json

setParser could accept a parser object instead of a class

https://github.com/jMonkeyEngine/jmonkeyengine/blob/8cc308616271604f13f9311207cc1e5ebd7a8169/jme3-plugins-json/src/main/java/com/jme3/plugins/json/Json.java#L58-L63

...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the listed areas: DesktopAssetManager.loadConfigFile(), method-calling tweens, readExternal/writeExternal implementations, gltf CustomContentManager.java, and Json.setParser. The issue is a catalog of possible workarounds rather than one bounded change, so first confirm which reflection or serialization case to address and define a separate completion test for it.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.