junkdog / artemis-odb

A continuation of the popular Artemis ECS framework
BSD 2-Clause "Simplified" License
777 stars 112 forks source link

Support java 14 (build tools) #602

Closed schosin closed 4 years ago

schosin commented 4 years ago

Request Please upgrade ASM to the most recent version (8.0.1 as of writing) as well as using the newest Opcodes ASM8 to support java 14 with enabled preview features.

Description After upgrading my project to java 14 I tried enabling the gradle weaving plugin and ran into issues with ASM. After forking artemis-odb and upgrading ASM to 8.x (currently 8.0.1) I ran into issues with records, which required me to upgrade the ASM Opcodes to ASM8. After that it worked fine without any other code changes. I don't know ASM well enough to know if this breaks anything, but both the tests and an old java 8 based project of mine worked just fine (only enableArtemisPlugin/optimizeEntitySystems).

I would be happy to provide a pull request.

junkdog commented 4 years ago

And here I was feeling modern having recently upgraded to a java 11 runtime, after being stuck on android's java 8-ish for too long.

I would be happy to provide a pull request.

Please do! :)

schosin commented 4 years ago

Luckily I don't care for mobile or GWT, so I'm free to live on the edge :) Loving my switch expressions, instanceof pattern matching and records.

junkdog commented 4 years ago

hrrm... I was temporally displaced by work and games - looking good! got to say i love the API stability of ASM :) sorry you had to see the code, it's overdue a clean-up (thinking graftt could simplify the current spaghetti, but it's somewhat low prio :)

Loving my switch expressions, instanceof pattern matching and records.

sorely missed in kotlin; would be neat if data classes could be destructured (?) and captured inside when expressions.

are records contiguous in memory - aka Arrays 2.0 as they were called back in the day?

junkdog commented 4 years ago

fixed in #603

schosin commented 4 years ago

Destructors is something that's in the pipeline for a future release. Though I doubt they will be as powerful as scala pattern matching. Never used kotlin, but I guess you mean something like case Positon(x, y) -> <do something with x/y>; or case Positon(x, y) pos -> <do something with pos/x/y>; . That'd be part of project amber.

Regarding records, I don't think that was the main intend, at least for the first version. What you are looking for are value types in project valhalla: JEP 169.

Personally I used records as map keys, immutable implementations of interfaces and return values in utility methods for tests (e.g. setting up an entity in a private method returning record(int entityId, Position pos, SomeOtherComponent component).