diff --git a/JAVA_MIGRATION_DIVERGENCES.md b/JAVA_MIGRATION_DIVERGENCES.md index c9a197f..b28d5ec 100644 --- a/JAVA_MIGRATION_DIVERGENCES.md +++ b/JAVA_MIGRATION_DIVERGENCES.md @@ -411,3 +411,35 @@ private static method rather than a closure class in both versions. - Clean `spotlessApply checkstyleTest build`: passing. - Java 8 Forge dedicated-server suite: 3 tests, 0 failures, 0 errors. - Real placement into a world needs a client or a server scenario and stays on the functional and manual layers. + +## 2026-08-14 — TEdgePart Java port + +### Observable behavior + +No known divergence. `conductsRedstone` still returns false and `TEdgePart` still extends `TSlottedPart`. + +### Default method, same test as TFacePart + +`TMultiPart` does not declare `conductsRedstone`, and nothing in the microblock superclass chain does either, so the +member is emitted as a real Java `default`. `EdgeMicroblock` never declared its own forwarder even in the reference, +because it is a Scala trait rather than a concrete class, and the generated concrete classes now resolve the interface +default instead of a Scala trait forwarder. The functional microblock generation case added during the `TFacePart` +port already covers that resolution path. + +No in-repo Scala needed changing. + +### Supported JVM API + +- `TEdgePart` is descriptor-identical to the reference. +- `TEdgePart$class` keeps both statics and adds only a private constructor. OpenComputers links against `$init$` only, + but `conductsRedstone` is retained because the bridge class is being kept regardless and dropping one static from a + live bridge would be a gratuitous shape change. +- The emitted class-file set for this area is unchanged; the Scala implementation generated no closure classes here. + +### Validation + +- `EdgePartCharacterizationTest`: 3 tests, 0 failures, 0 errors, unchanged from the Scala baseline. +- `TEdgePartBinaryCompatibilityTest`: 1 test, 0 failures, 0 errors. +- Complete plain-JVM suite: 61 tests, 0 failures, 0 errors. +- Clean `spotlessApply checkstyleTest build`: passing. +- Java 8 Forge dedicated-server suite: 3 tests, 0 failures, 0 errors. diff --git a/src/main/scala/codechicken/multipart/TEdgePart$class.java b/src/main/scala/codechicken/multipart/TEdgePart$class.java new file mode 100644 index 0000000..1ffb403 --- /dev/null +++ b/src/main/scala/codechicken/multipart/TEdgePart$class.java @@ -0,0 +1,17 @@ +package codechicken.multipart; + +/** + * Binary bridge for Scala implementations compiled against the original trait. Their forwarders call these statics + * directly, so the body cannot delegate back to the instance method without recursing. + */ +@Deprecated +public abstract class TEdgePart$class { + + private TEdgePart$class() {} + + public static boolean conductsRedstone(TEdgePart part) { + return false; + } + + public static void $init$(TEdgePart part) {} +} diff --git a/src/main/scala/codechicken/multipart/TEdgePart.java b/src/main/scala/codechicken/multipart/TEdgePart.java new file mode 100644 index 0000000..7f39db6 --- /dev/null +++ b/src/main/scala/codechicken/multipart/TEdgePart.java @@ -0,0 +1,14 @@ +package codechicken.multipart; + +/** + * Interface which must be implemented by parts that go in an edge slot. + *
+ * TMultiPart does not declare conductsRedstone, so it can safely be a default method. + */ +public interface TEdgePart extends TSlottedPart { + + /** Return true if this part can conduct redstone signal or let redstone signal pass through it. */ + default boolean conductsRedstone() { + return false; + } +} diff --git a/src/main/scala/codechicken/multipart/TEdgePart.scala b/src/main/scala/codechicken/multipart/TEdgePart.scala deleted file mode 100644 index 6f81250..0000000 --- a/src/main/scala/codechicken/multipart/TEdgePart.scala +++ /dev/null @@ -1,11 +0,0 @@ -package codechicken.multipart - -/** Interface which must be implemented by parts that go in an edge slot. - */ -trait TEdgePart extends TSlottedPart { - - /** Return true if this part can conduct redstone signal or let redstone - * signal pass through it. - */ - def conductsRedstone = false -}