diff --git a/JVM_DOWNGRADER_HANDOFF.md b/JVM_DOWNGRADER_HANDOFF.md index 6a5ffbc..99a88eb 100644 --- a/JVM_DOWNGRADER_HANDOFF.md +++ b/JVM_DOWNGRADER_HANDOFF.md @@ -6,8 +6,9 @@ The scoped integration is implemented on `algent/java`, building on baseline `65 are preserved. `build.gradle` adds two tasks; `StackAnalyserLogic` uses pattern and arrow-rule switches, `JavaTraitRegistration` and `ClassInfoLookup` use Java 21 pattern variables, and `ScalaSignatureParser` uses switch expressions. `HollowMicroblockTraitLogic` and `PostMicroblockClientLogic` use the same scoped path for internal -microblock control flow. The nine Scala sources, Scala 2.11.5 dependency, source layout, and normal Gradle entry points -remain in place. Production tasks do not read a frozen jar or any files under `run/jvmdg-trial/`. +microblock control flow, as does `HollowMicroblockClientLogic` for its slot renderer. The nine Scala sources, Scala +2.11.5 dependency, source layout, and normal Gradle entry points remain in place. Production tasks do not read a frozen +jar or any files under `run/jvmdg-trial/`. The subsequent `StackAnalyser` initializer extraction is recorded in `JAVA_MIGRATION_HANDOFF.md`. The exact-byte comparisons and frozen-version reproduction below describe checkpoint `5f0e329`; later helper edits need their own @@ -78,11 +79,11 @@ Recommended order: Scala-facing declarations. `StackAnalyserLogic.java` remains the original proven example. 2. Continue only where modern syntax produces a concrete control-flow gain. `ScalaSignatureParser.java`, the remaining opcode switches in `StackAnalyserLogic.java`, and the hollow/post-client microblock helper group are complete. - `HollowMicroblockClientLogic.java` is the next useful internal candidate because its slot dispatcher can use arrow - rules. `ScalaTraitRegistration.java` should not move merely to restyle its erased `Some` checks. -3. Consider public core implementations such as `RedstoneInteractions$.java`, `TileMultipart.java` and the registries - only after the internal batches. Modern method bodies are technically possible, but their published ABI and frozen - behavior make the review cost higher. + `ScalaTraitRegistration.java` should not move merely to restyle its erased `Some` checks. +3. The next queue is dependency-closure audits for public implementation bodies: start with + `RedstoneInteractions$.java`, then `BlockMultipart.java`, then the previously deferred renderer group. Each has useful + cast/control-flow cleanup and focused characterization tests, but must bring any joint-compiled Java callers that + cannot resolve an excluded declaration. Do not assume one-file routing will work. 4. Defer registered Java trait inputs under `scalatraits/`. Their transformer forbids or rewrites several bytecode shapes, including inner classes, lambdas, string switches and primitive-array allocation; syntax changes need transformer-specific fixtures rather than ordinary compilation success. @@ -123,6 +124,10 @@ version 52, and neither helper has an executable JVM Downgrader API reference. ` from the batch: the retained Scala declaration does not expose `getShape()` through `PostMicroblock`, so its explicit `Microblock` cast is required and modern pattern syntax provides no useful replacement. +The `HollowMicroblockClientLogic` slot-renderer batch has the same clean-build, 576-test, 289-test, version-52 and +134-dump results. Its non-private ABI and callback ordering are unchanged, and its packaged classes have no executable +JVM Downgrader API reference. + ### fastutil audit GTNHLib 0.11.44 currently contributes `it.unimi.dsi:fastutil:8.5.18` to `compileClasspath`. It does **not** contribute @@ -183,8 +188,8 @@ working syntax and record the blocker and revisit condition. Do not add fragile The production source tree now contains 231 Java files and nine Scala files / 782 nonblank Scala lines. Of the 224 Java sources in the Scala source tree, only `StackAnalyserLogic`, `JavaTraitRegistration`, `ClassInfoLookup`, -`ScalaSignatureParser`, `HollowMicroblockTraitLogic` and `PostMicroblockClientLogic` bypass joint compilation. Retained -models, trait +`ScalaSignatureParser`, `HollowMicroblockTraitLogic`, `PostMicroblockClientLogic` and `HollowMicroblockClientLogic` +bypass joint compilation. Retained models, trait metadata, synthetic super accessors, and downstream Scala consumers prevent treating the last nine files as a mechanical deletion queue. Modern GTNH runtime support does not remove the retained Scala compiler's Java 8 requirement. The main migration plan and working handoff carry the current API/adoption priorities and source counts. diff --git a/build.gradle b/build.gradle index 1f10b08..68b2ad7 100644 --- a/build.gradle +++ b/build.gradle @@ -18,6 +18,7 @@ def modernJavaSources = sourceSets.main.scala.matching { include 'codechicken/multipart/asm/ScalaSignatureParser.java' include 'codechicken/microblock/HollowMicroblockTraitLogic.java' include 'codechicken/microblock/PostMicroblockClientLogic.java' + include 'codechicken/microblock/HollowMicroblockClientLogic.java' } def legacyScala = tasks.named('compileScala') { // Zinc does not invalidate joint-compiled Java annotations when Tags.VERSION changes. @@ -29,6 +30,7 @@ def legacyScala = tasks.named('compileScala') { exclude 'codechicken/multipart/asm/ScalaSignatureParser.java' exclude 'codechicken/microblock/HollowMicroblockTraitLogic.java' exclude 'codechicken/microblock/PostMicroblockClientLogic.java' + exclude 'codechicken/microblock/HollowMicroblockClientLogic.java' scalaCompileOptions.additionalParameters = ['-sourcepath', file('src/main/scala').absolutePath] inputs.files(modernJavaSources).withPropertyName('modernJavaDeclarations').withPathSensitivity(PathSensitivity.RELATIVE) } diff --git a/src/main/scala/codechicken/microblock/HollowMicroblockClientLogic.java b/src/main/scala/codechicken/microblock/HollowMicroblockClientLogic.java index 10fad02..48341e8 100644 --- a/src/main/scala/codechicken/microblock/HollowMicroblockClientLogic.java +++ b/src/main/scala/codechicken/microblock/HollowMicroblockClientLogic.java @@ -75,8 +75,7 @@ final class HollowMicroblockClientLogic { int slot = part.getSlot(); int internalMask = 0; switch (slot) { - case 0: - case 1: + case 0, 1 -> { if (face) internalMask = 0x3c; f.apply(pos, material, pass, new Cuboid6(d1, y1, d2, d2, y2, z2), 0x3b | internalMask); f.apply(pos, material, pass, new Cuboid6(d1, y1, z1, d2, y2, d1), 0x37 | internalMask); @@ -84,9 +83,8 @@ final class HollowMicroblockClientLogic { f.apply(pos, material, pass, new Cuboid6(x1, y1, d1, d1, y2, d2), sideMask & 0x13 | 0xc | internalMask); f.apply(pos, material, pass, new Cuboid6(x1, y1, d2, x2, y2, z2), sideMask & 0x3b | 4 | internalMask); f.apply(pos, material, pass, new Cuboid6(x1, y1, z1, x2, y2, d1), sideMask & 0x37 | 8 | internalMask); - break; - case 2: - case 3: + } + case 2, 3 -> { if (face) internalMask = 0x33; f.apply(pos, material, pass, new Cuboid6(d2, d1, z1, x2, d2, z2), 0x2f | internalMask); f.apply(pos, material, pass, new Cuboid6(x1, d1, z1, d1, d2, z2), 0x1f | internalMask); @@ -104,9 +102,8 @@ final class HollowMicroblockClientLogic { pass, new Cuboid6(x1, y1, z1, d1, y2, z2), sideMask & 0x1f | 0x20 | internalMask); - break; - case 4: - case 5: + } + case 4, 5 -> { if (face) internalMask = 0xf; f.apply(pos, material, pass, new Cuboid6(x1, d2, d1, x2, y2, d2), 0x3e | internalMask); f.apply(pos, material, pass, new Cuboid6(x1, y1, d1, x2, d1, d2), 0x3d | internalMask); @@ -114,9 +111,8 @@ final class HollowMicroblockClientLogic { f.apply(pos, material, pass, new Cuboid6(x1, d1, z1, x2, d2, d1), sideMask & 0x34 | 3 | internalMask); f.apply(pos, material, pass, new Cuboid6(x1, d2, z1, x2, y2, z2), sideMask & 0x3e | 1 | internalMask); f.apply(pos, material, pass, new Cuboid6(x1, y1, z1, x2, d1, z2), sideMask & 0x3d | 2 | internalMask); - break; - default: - throw new MatchError(slot); + } + default -> throw new MatchError(slot); } }