mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-17 19:15:11 +00:00
refactor: port TEdgePart to Java
Replaces TEdgePart.scala with a Java interface and retains the TEdgePart$class bridge for OpenComputers. The interface is descriptor-identical to the reference, the bridge adds only a private constructor, and the emitted class-file set for this area is unchanged. TMultiPart does not declare conductsRedstone and neither does anything in the microblock superclass chain, so it becomes a real default method and no in-repo Scala needed changing. The generated microblock classes now resolve the interface default instead of a Scala trait forwarder, which the functional generation case added during the TFacePart port covers. conductsRedstone is kept on the bridge even though OpenComputers only links against $init$, since the bridge class is being kept regardless. Validated with 61 plain-JVM tests, a clean build, and the Java 8 Forge dedicated-server suite.
This commit is contained in:
1 parent
f82b5d2294
commit
0de728345a
4 files changed
+63
-11
No files matched your search
@@ -411,3 +411,35 @@ private static method rather than a closure class in both versions.
|
|||||||
- Clean `spotlessApply checkstyleTest build`: passing.
|
- Clean `spotlessApply checkstyleTest build`: passing.
|
||||||
- Java 8 Forge dedicated-server suite: 3 tests, 0 failures, 0 errors.
|
- 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.
|
- 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.
|
||||||
@@ -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) {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package codechicken.multipart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface which must be implemented by parts that go in an edge slot.
|
||||||
|
* <p>
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user