mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-27 23:45:52 +00:00
docs: record guidenh's reflective member surface from source
The constant-pool scan sees the 20 names guidenh reflects on but not the members it looks up on them. Read from the checked-out source at 6137525. Adds three constraints the ABI diff cannot see: MultipartGenerator$.MODULE$ is the only route to generateCompositeTile because it is private[multipart] and gets no static forwarder; MicroblockGenerator$.create is matched by exact parameter types with MicroblockClass's FQN string-compared; and TileMultipart.partList_$eq is reflectively load-bearing despite having no Java-facing equivalent. Verified the last of those survived the TileMultipart port already on this branch, along with loadParts, notifyTileChange and markRender.
This commit is contained in:
1 parent
c3d5b08ff7
commit
097f527856
2 files changed
+53
No files matched your search
@@ -515,3 +515,8 @@ These ranges were formed before designing the characterization suite and should
|
||||
- Confirmed that erasure does not weaken `IPartTileConverter.convert`. The cast to `T` compiles away, but the `ClassCastException` a mismatched tile produces comes from the synthetic bridge on the subclass overriding `convertMulti(T)`, which is the same mechanism Scala's `asInstanceOf[T]` relied on. It is now pinned by a test, because the code reads as though the check was lost.
|
||||
- Added five Forge server tests, doubling that suite, because most of this class cannot run headless. They cover tile construction through the ASM generator, the NBT round trip through the save/load hooks, `registerTileConverter` appending to a Scala `MutableList` from Java, and `sendDescPacket` against a loaded chunk.
|
||||
- Dropped the two commented-out blocks the reference carried, the `PlayerInstance.playersInChunk` reflection and the multi-tile `sendDescPackets`, rather than reproducing dead Scala as dead Java. The reason they existed, a missing forge access transformer, is now in the class javadoc.
|
||||
- Read guidenh's actual source at `6137525` rather than inferring from its constant pool, and recorded the exact reflective member list in `JAVA_MIGRATION_ABI_INVENTORY.md`. The scan could see the 20 names; only the source shows which members are looked up on them, and none of it is visible to the ABI diff.
|
||||
- Found that `MultipartGenerator$.MODULE$` is load-bearing through reflection. `generateCompositeTile` is `private[multipart]`, so no static forwarder exists and guidenh's static attempt always misses, leaving the companion as the only route. Phase 6/7 must keep it.
|
||||
- Found that `MicroblockGenerator$.create` is matched by exact parameter types, with `MicroblockClass`'s fully qualified name string-compared. Widening a parameter or renaming the class breaks the lookup while every call site still links.
|
||||
- Verified against the already-ported `TileMultipart` that `partList_$eq(scala.collection.Seq)`, `loadParts`, `notifyTileChange` and `markRender` all survived. `partList_$eq` is a Scala `var` setter with no Java-facing equivalent and is reflectively load-bearing, so dropping it for a list mutator would have broken guidenh invisibly. It was kept.
|
||||
- Confirmed the MultipartHelper port satisfies guidenh directly: it resolves `createTileFromNBT` as a static on the plain class and only falls back to `MultipartHelper$.MODULE$` if that misses, so the retained companion is belt-and-braces rather than the primary path.
|
||||
@@ -156,3 +156,51 @@ object breaks these even where no bytecode reference exists.
|
||||
3. Bridge effort should be spent on the 8 `$class` helpers, 17 `MODULE$` singletons, and 5 Scala-typed descriptors
|
||||
listed above. Every other converted file can drop its Scala bridge after checking this inventory, as `IDWriter` can.
|
||||
4. Add the reflective names to the manual compatibility checklist; the automated ABI diff cannot see them.
|
||||
|
||||
## guidenh's reflective surface, from source
|
||||
|
||||
The constant-pool scan can see the names guidenh reflects on but not the members it looks up. This section is read
|
||||
from the checked-out source at `6137525`, in
|
||||
`src/main/java/com/hfstudio/guidenh/integration/forgemultipart/ForgeMultipartHelpers.java`. **None of this is visible
|
||||
to the ABI diff**; a break here is silent until a user opens a guide page.
|
||||
|
||||
The dispatch helper is `invokeStaticOrSingletonMethod(class, companion, method, args...)`. It tries a **static** method
|
||||
on the plain class first, and only on `INVOCATION_MISSING` falls back to reading `companion.MODULE$` and invoking the
|
||||
method on it. So for most entries the companion is a fallback. The exceptions below are the ones that matter.
|
||||
|
||||
| Owner | Member reflected on | Reached via |
|
||||
| --- | --- | --- |
|
||||
| `MultipartHelper` | `createTileFromNBT(World, NBTTagCompound)` | static; companion is fallback |
|
||||
| `MultipartRenderer` | `renderWorldBlock(IBlockAccess, int, int, int, Block, int, RenderBlocks)` | static; companion is fallback |
|
||||
| `MultipartGenerator` | `generateCompositeTile(TileEntity, Iterable, boolean)` | **companion only** — see below |
|
||||
| `BlockMicroMaterial` | `register(material)`, plus a constructor of arity 2 `(Block, int)` or 1 `(Block)` | static; companion is fallback |
|
||||
| `MicroMaterialRegistry` | `getMaterial(int)` | static; companion is fallback |
|
||||
| `MicroblockGenerator$` | `create(MicroblockClass, int, boolean)` | **companion only**, matched by exact parameter types |
|
||||
| `TileMultipart` | `partList()`, `partList_$eq(scala.collection.Seq)`, `loadParts(...)`, `notifyTileChange()`, `markRender()` | instance |
|
||||
| `Microblock` | `microClass()`, `material()`, `shape()` | instance |
|
||||
| `TMultiPart` | `getDrops()` | instance |
|
||||
| `IMicroMaterial` | `block()`, `meta()` | instance |
|
||||
|
||||
Types used only for `isInstanceOf`: `BlockMultipart`, `TileMultipart`, `TileMultipartClient`, `Microblock`,
|
||||
`MicroblockClient`, `BlockMicroMaterial`.
|
||||
|
||||
### Three constraints this adds
|
||||
|
||||
1. **`MultipartGenerator$.MODULE$` is load-bearing through reflection.** `generateCompositeTile` is `private[multipart]`
|
||||
in Scala, so no static forwarder is emitted on `MultipartGenerator` and guidenh's static attempt always misses. It
|
||||
reaches the method only through the companion. A Phase 6/7 port that keeps the class but drops the companion, or
|
||||
promotes the method to a public static and removes it from the companion, breaks guidenh silently.
|
||||
|
||||
2. **`MicroblockGenerator$.create` is matched by exact parameter types**, including `pts[0].getName()` string-compared
|
||||
against `"codechicken.microblock.MicroblockClass"`. That pins `create(MicroblockClass, int, boolean)` on the
|
||||
companion and pins `MicroblockClass`'s fully qualified name. Widening a parameter or renaming the class breaks the
|
||||
lookup even though every call site still links.
|
||||
|
||||
3. **`TileMultipart.partList_$eq(scala.collection.Seq)` is reflectively load-bearing.** It is a Scala `var` setter with
|
||||
no Java-facing equivalent, so a Java-first port that drops it in favour of a list mutator would break guidenh
|
||||
invisibly. The current port keeps it, verified by `javap`. `resolvePartList` also falls back to a public *field*
|
||||
named `partList`, which never existed — Scala emits the field private — so that path is dead in the reference too.
|
||||
|
||||
`MultipartHelper$` is retained on the strength of the fallback path alone: the static is found first today, so the
|
||||
companion is never reached in practice. That is a weaker justification than the two "companion only" entries above,
|
||||
but the cost of keeping a four-method forwarder is negligible against a silent break.
|
||||
Reference in new issue
Block a user