Commit Graph
14 Commits
Author SHA1 Message Date
Algent 844efac5a2 test: characterize Saw
Freezes the one supplied member before the port: getMaxCuttingStrength
asks the saw about a stack of itself, so the stack handed to
getCuttingStrength wraps the saw and has size 1.

Unlike the constant-returning bridges ported so far, this one dispatches
getCuttingStrength through the interface, so a subclass override is
honoured even when the bridge is called directly. That is asserted
explicitly.

Adds a frozen Scala 2.11.5 consumer compiled against the reference dev jar
at 0de7283. It reports its strength only when handed a stack that actually
wraps itself, so the test proves the bridge built the stack rather than
only that it linked. ProjRed is the only consumer.

First characterization outside codechicken.multipart; these tests live in
codechicken.microblock alongside the type under test.

65 plain-JVM tests, all passing against the untouched Scala.
2026-08-14 21:42:03 +02:00
Algent f82b5d2294 test: characterize TEdgePart
Freezes the single trait default before the port: conductsRedstone returns
false, TEdgePart extends TSlottedPart, and the $class static holds the
default rather than dispatching, so an overriding part gets its own value
from a direct call but false from the bridge.

The member is abstract on the reference interface, so a Java class cannot
inherit it today; the test part mirrors the forwarder Scala emits instead,
which keeps the file compiling before and after the port.

Adds a frozen Scala 2.11.5 consumer compiled against the reference dev jar
at f2f1870. OpenComputers is the only consumer, and it links against
$init$ rather than conductsRedstone.

61 plain-JVM tests, all passing against the untouched Scala.
2026-08-14 21:28:51 +02:00
Algent 6813144d84 test: characterize TItemMultiPart
Freezes the placement logic before the port. getHitDepth projects the hit
vector onto the axis for that side and adds 1 on even sides, giving the
six frozen values, and it copies the vector rather than mutating the
caller's. onItemUse tries the clicked block first only when the depth is
below 1, then always tries the neighbour on that side, reusing and
mutating a single BlockCoord across both attempts.

Placement short-circuits as soon as newPart returns null, before any
world, player or stack access, so all of that is reachable headless with
null arguments. Real placement needs a world and stays on the functional
and manual layers.

Adds a frozen Scala 2.11.5 consumer compiled against the reference dev jar
at 7843f13, whose forwarders call all three statics. ProjRed is the only
consumer of this bridge.

57 plain-JVM tests, all passing against the untouched Scala.
2026-08-14 21:23:45 +02:00
Algent 07ffc01db1 test: characterize TIconHitEffects
Freezes what is reachable without a client: getBreakingIcon falls back to
getBrokenIcon for the same side and ignores its subPart argument, destroy
effects request sides 0 through 5 in order, and the scaleDensity overload
decides whether the part's own bounds are consulted at all. The particle
calls need a world and an EffectRenderer, so actual appearance stays on
the manual checklist.

Adds a frozen Scala 2.11.5 consumer compiled against the reference dev jar
at 57130a6. It exercises both bridges: getBreakingIcon proves
JIconHitEffects$class delegates to the fixture's getBrokenIcon, and
addDestroyEffects proves TIconHitEffects$class resolves by collecting all
six icons before failing on the null tile.

49 plain-JVM tests, all passing against the untouched Scala.
2026-08-14 21:12:52 +02:00
Algent d71a4b893d test: characterize TFacePart
Freezes the trait defaults before the port: solid returns true for every
side including out-of-range values, and redstoneConductionMap returns 0.
Also freezes that TFacePart extends TSlottedPart, and that the $class
statics hold the defaults rather than dispatching, so an overriding part
gets its own values from a direct call but the trait values from the
bridge.

Both members are abstract on the reference interface, so a Java class
cannot inherit them today; the test part mirrors the forwarders Scala
emits instead, which keeps the file compiling before and after the port.

Adds a frozen Scala 2.11.5 consumer compiled against the reference dev jar
at a1bf3c8, whose forwarders call all three statics. OpenComputers,
ProjRed and ProjectBlue depend on them.

43 plain-JVM tests, all passing against the untouched Scala.
2026-08-14 20:56:55 +02:00
Algent 75900d0602 test: characterize TNormalOcclusion
Extends the occlusion characterization to the parts of the area the port
will touch: the NormalOcclusionTest$ singleton and its MODULE$ field, the
TNormalOcclusion$class bridge, the super accessor the bridge calls back
through, NormallyOccludedPart's single-box constructor that AE2 links
against, and its null getType.

The generated codechicken$multipart$TNormalOcclusion$$super$occlusionTest
accessor is ACC_SYNTHETIC on the reference interface, so javac neither
sees nor allows implementing it. It is reached by reflection here, and the
port has to expose it as an ordinary method for any new implementor to be
able to satisfy it.

Adds a frozen Scala 2.11.5 consumer compiled against the reference dev jar
at cd6420f. It mixes in the trait without overriding occlusionTest, so
invoking it covers the whole bridge round trip: forwarder, $class,
singleton, and the callback through the accessor. ForgeRelocationFMP,
OpenComputers and ProjRed all depend on that path.

38 plain-JVM tests, all passing against the untouched Scala.
2026-08-14 20:24:28 +02:00
Algent 8294240659 test: characterize TCuboidPart
Freezes the observable behavior of TCuboidPart, JCuboidPart and the
TCuboidPart$class bridge before the Java port, per the test-first gate in
JAVA_MIGRATION.md. All cases pass against the untouched Scala.

Records two asymmetries worth preserving: getSubParts wraps the bounds in
an IndexedCuboid6, whose copy constructor makes it a copy carrying a boxed
Integer 0 as data, while getCollisionBoxes aliases the bounds instance
itself. Cuboid6 has no equals, so geometry is compared component-wise.

Also adds a frozen Scala consumer compiled with 2.11.5 against the
reference dev jar at 246daff. Its forwarders call all four $class statics,
so it detects the linkage break that a freshly recompiled test would miss.
ForgeRelocationFMP, OpenComputers, ProjRed and ProjectBlue all depend on
those descriptors.

One case exists specifically to guard the port: TMultiPart supplies empty
getSubParts and getCollisionBoxes, and on the JVM a superclass method beats
an interface default, so a Java interface cannot reproduce Scala trait
linearization on its own.
2026-08-14 20:03:33 +02:00
Algent 246dafffda refactor: drop unused IDWriter and JPartialOcclusion Scala bridges
The downstream ABI inventory scanned 240 mod jars in GTNH daily
2026-08-14+678 and found no consumer of either bridge. Both were written
speculatively, before the inventory existed.

IDWriter had no downstream reference at all, so its four Scala function
accessors are removed and the class now selects a carrier width directly.
That also removes the Integer boxing and Function1/Function2 allocation
per read and write that the first port had preserved. Calling write or
read before setMax now throws IllegalStateException rather than
NullPointerException; no caller reaches that state.

JPartialOcclusion$class had no downstream reference either. The two
consumers that touch JPartialOcclusion only call getPartialOcclusionBoxes,
and the two jars that implement the interface emit no call to the helper.
The interface and both of its method descriptors are unchanged. The
ReferenceScalaPartialOcclusion fixture is removed with the helper it
existed to verify.

Validated with 27 plain-JVM tests, a clean checkstyleTest build with
Spotless re-enabled, and the Java 8 Forge dedicated-server suite.
2026-08-14 19:52:28 +02:00
Algent 5c087c50b5 run spotless 2026-08-14 19:44:56 +02:00
Algent a0428b9994 refactor: port partial occlusion to Java
Keep the Scala trait helper so reference-compiled implementations remain linkable.
2026-08-14 18:24:59 +02:00
Algent 60818853e3 test: freeze Scala partial-occlusion ABI
Load a reference-compiled consumer so the Java bridge must retain the Scala trait helper.
2026-08-14 18:19:18 +02:00
Algent 07530d93bf test: characterize partial occlusion
Freeze voxel ownership and visibility rules before the Java port.
2026-08-14 17:46:30 +02:00
Algent a69f846775 test: characterize normal occlusion
Freeze contact tolerance and partial-box delegation before the Java port.
2026-08-14 17:38:53 +02:00
Algent e33d3b2493 Add first characterization tests 2026-08-14 16:52:22 +02:00