diff --git a/JAVA_MIGRATION.md b/JAVA_MIGRATION.md index 6f0484b..896a9d1 100644 --- a/JAVA_MIGRATION.md +++ b/JAVA_MIGRATION.md @@ -31,8 +31,9 @@ Java; retain its coordinated Scala class/companion/models. `FieldMixin.accessNam retaining its case class. `MixinInfo.linearise` and `ScalaSignature.Bytes.section` delegate traversal and array-copy behavior to Java. `TypeRef.jName`, `TypeRef.jDesc` and `TMethodType.jDesc` delegate name/descriptor conversion and method assembly while preserving virtual lookup and evaluation order. `ClassSymbolRef.jInterfaces` delegates -ordered interface-name mapping while retaining its Scala List contract, and its formatter now delegates to Java. -The next bounded candidate is `ScalaSignature.MethodSymbol.toString`, with characterization before extraction. +ordered interface-name mapping while retaining its Scala List contract. Class and method symbol formatting also +delegate to Java. The next bounded candidate is `ScalaSignature.TypeRefType.jDesc`, with characterization before +extraction. Java-trait rewriting and compiler startup also delegate to Java helpers. Abstract Java mixins and Java-path side-only filtering are complete; multiple Scala-trait inheritance still needs its metadata. Retain trait state/accessor/super bridges and the compiler/signature/analyser model shells. diff --git a/JAVA_MIGRATION_HANDOFF.md b/JAVA_MIGRATION_HANDOFF.md index bb0fba3..c9e3520 100644 --- a/JAVA_MIGRATION_HANDOFF.md +++ b/JAVA_MIGRATION_HANDOFF.md @@ -16,24 +16,24 @@ migration checkout; `codex/tile-compatibility-fixes` was deleted after its fixes ## Current state and next target -**470 plain-JVM tests and 237 Java 8 Forge tests pass, with zero failures/errors/skips.** Sources total **224 Java -files and 9 Scala files / 748 nonblank Scala lines**. The packaged inventory has 443 classes. +**477 plain-JVM tests and 237 Java 8 Forge tests pass, with zero failures/errors/skips.** Sources total **224 Java +files and 9 Scala files / 747 nonblank Scala lines**. The packaged inventory has 443 classes. Review follow-up: restored packet-scheduler callback mutation behavior with the original Scala hash-map traversal, virtual tile accessor dispatch throughout `TMultiPart`, and null-safe equality for scheduled-tick deduplication. Six JVM and two Forge regression cases cover the fixes. Callable signatures remain unchanged; the packet traversal callback adds one anonymous class. See the latest history entries for the individual fixes and validation. -Latest bounded target: `ScalaSignature.ClassSymbolRef.toString` delegates formatting to -`ScalaSignatureParser.classSymbolString`. Seven characterization tests were committed first as `1234112`. They pin -concrete and anonymous runtime-name trimming, literal/null values, two's-complement hexadecimal flags, repeated -virtual getter order, owner formatting and failures, and the static trait helper. All 470 frozen JVM consumers pass; -checks preserve 442 retained class/member APIs, all 17 ScalaSignature payloads, 3,737 unrelated method bodies and all -116 generated dumps. No class is added or removed; the total stays 443 classes. -Evidence: `run/migration-class-symbol-string-reference/`. +Latest bounded target: `ScalaSignature.MethodSymbol.toString` delegates formatting to +`ScalaSignatureParser.methodSymbolString`. Seven characterization tests were committed first as `d81195a`. They pin +the fixed MethodSymbol prefix for concrete/anonymous instances, literal/null values, two's-complement hexadecimal +flags, repeated virtual getter order, owner formatting/failures and the absence of derived-info reads. All 477 frozen +JVM consumers pass; checks preserve 442 retained class/member APIs, all 17 ScalaSignature payloads, 3,738 unrelated +method bodies and all 116 generated dumps. No class is added or removed; the total stays 443 classes. +Evidence: `run/migration-method-symbol-string-reference/`. -**Next bounded candidate: `ScalaSignature.MethodSymbol.toString`.** Characterize exact formatting, hexadecimal flags, -virtual name/owner/infoId reads and null/failure order while retaining the case-class declaration and bridges. +**Next bounded candidate: `ScalaSignature.TypeRefType.jDesc`.** Characterize array argument/super routing, virtual +name/typArgs reads, malformed lists, nulls and failure order while retaining the case-class and trait declarations. Keep case-class/product/serialization shapes and simple model accessors. Broader shell replacement and opcode algorithm fixes remain separate work. The external ProjectRed Scala-trait fixture and ScalaSignature model bridges remain required. Actual client diff --git a/docs/migration/HISTORY.md b/docs/migration/HISTORY.md index 1a529e7..4304e61 100644 --- a/docs/migration/HISTORY.md +++ b/docs/migration/HISTORY.md @@ -1540,3 +1540,21 @@ differences belong in the [divergence ledger](../../JAVA_MIGRATION_DIVERGENCES.m tests/resources, reports and comparison tools. Frozen runs use its `version.txt`; final builds use the committed version. Source totals are 224 Java files and nine Scala files / 748 nonblank lines. Next: `MethodSymbol.toString`, preserving formatting, virtual reads and failure order. + +### 2026-09-04 — ScalaSignature method-symbol strings + +- Committed seven JVM characterization cases first as `d81195a` against the untouched `MethodSymbol.toString`. + They cover its fixed prefix for concrete and anonymous subclasses, punctuation/nulls, lowercase two's-complement + hexadecimal flags, negative/limit info IDs, repeated virtual reads, owner formatting and every failure boundary. + Derived full-name, info, descriptor and flag-query methods must not be read during formatting. +- Extracted formatting into `ScalaSignatureParser.methodSymbolString(Object)`. Java retains left-to-right virtual + getter order, object-to-string conversion and hexadecimal representation. Scala keeps the inferred return type, + case-class declaration, symbol/flag bridges, product members and serialization shape. +- Normal and clean validation pass 477 JVM tests, 477 frozen consumers and 237 Java 8 Forge tests with zero + failures/errors/skips. All 116 generated dumps match. Both jars contain 443 Java 8 classes and matching sources; + comparison preserves 442 retained class/member APIs, all 17 ScalaSignature payloads and 3,738 unrelated method + bodies. The helper adds one package-private method; no class inventory or effective divergence changes. +- Evidence is under ignored `run/migration-method-symbol-string-reference/`, including the reference jar, frozen + tests/resources, reports and comparison tools. Frozen runs use its `version.txt`; final builds use the committed + version. Source totals are 224 Java files and nine Scala files / 747 nonblank lines. Next: + `TypeRefType.jDesc`, preserving array/super routing, virtual reads and malformed-input behavior. diff --git a/src/main/scala/codechicken/multipart/asm/ScalaSignature.scala b/src/main/scala/codechicken/multipart/asm/ScalaSignature.scala index e798a6b..97cf493 100644 --- a/src/main/scala/codechicken/multipart/asm/ScalaSignature.scala +++ b/src/main/scala/codechicken/multipart/asm/ScalaSignature.scala @@ -80,8 +80,7 @@ class ScalaSignature(val bytes: Bytes) { flags: Int, infoId: Int ) extends SymbolRef { - override def toString = - "MethodSymbol(" + name + "," + owner + "," + flags.toHexString + "," + infoId + ")" + override def toString = ScalaSignatureParser.methodSymbolString(this) def full = owner.full + "." + name def info: TMethodType = evalT(infoId) diff --git a/src/main/scala/codechicken/multipart/asm/ScalaSignatureParser.java b/src/main/scala/codechicken/multipart/asm/ScalaSignatureParser.java index eb3c2d8..b671b9a 100644 --- a/src/main/scala/codechicken/multipart/asm/ScalaSignatureParser.java +++ b/src/main/scala/codechicken/multipart/asm/ScalaSignatureParser.java @@ -84,6 +84,18 @@ final class ScalaSignatureParser { + ")"; } + static String methodSymbolString(Object value) { + ScalaSignature.MethodSymbol symbol = (ScalaSignature.MethodSymbol) value; + return "MethodSymbol(" + symbol.name() + + "," + + symbol.owner() + + "," + + Integer.toHexString(symbol.flags()) + + "," + + symbol.infoId() + + ")"; + } + static byte[] section(Bytes bytes) { byte[] array = bytes.arr(); int start = bytes.pos();