refactor: port method symbol descriptors to Java

This commit is contained in:
Algent committed 2026-09-04 21:55:28 +02:00
1 parent 16f4568c2d
commit 257d0e4a04
4 files changed
+35 -11

No files matched your search

+9 -10
View File
@@ -16,7 +16,7 @@ migration checkout; `codex/tile-compatibility-fixes` was deleted after its fixes
## Current state and next target
**505 plain-JVM tests and 237 Java 8 Forge tests pass, with zero failures/errors/skips.** Sources total **224 Java
**512 plain-JVM tests and 237 Java 8 Forge tests pass, with zero failures/errors/skips.** Sources total **224 Java
files and 9 Scala files / 744 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,
@@ -24,16 +24,15 @@ virtual tile accessor dispatch throughout `TMultiPart`, and null-safe equality f
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.jParent` delegates the parent-name chain to
`ScalaSignatureParser.classParentName`. Seven characterization tests were committed first as `6e3a301`. They pin
info/parent/jName order, repeated uncached reads, first-parent selection, empty lists, nulls, failures and the legacy
static trait helper descriptor. A frozen Scala 2.11.5 caller, direct trait implementation and ClassType constructor
preserve both bridge paths. All 505 frozen JVM consumers pass; checks preserve 442 retained class/member APIs, all 17
ScalaSignature payloads, 3,742 unrelated method bodies and all 116 generated dumps. No class is added or removed;
the total stays 443 classes. Evidence: `run/migration-class-parent-reference/`.
Latest bounded target: `ScalaSignature.MethodSymbol.jDesc` delegates the descriptor lookup to
`ScalaSignatureParser.methodSymbolDescriptor`. Seven characterization tests were committed first as `16f4568`. They
pin info/jDesc order, repeated uncached reads, literal null descriptors, null info, failures, unused symbol members and
the frozen Scala caller descriptor. All 512 frozen JVM consumers pass; checks preserve 442 retained class/member APIs,
all 17 ScalaSignature payloads, 3,743 unrelated method bodies and all 116 generated dumps. No class is added or
removed; the total stays 443 classes. Evidence: `run/migration-method-symbol-descriptor-reference/`.
**Next bounded candidate: `ScalaSignature.MethodSymbol.jDesc`.** Characterize info/descriptor lookup order, repeated
reads, nulls and failures while retaining the case-class and path-dependent declarations.
**Next bounded candidate: `ScalaSignature.MethodSymbol.info`.** Characterize info-id/evaluation lookup order, repeated
reads, nulls, casts and failures while retaining the case-class and path-dependent 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
+20
View File
@@ -1644,3 +1644,23 @@ differences belong in the [divergence ledger](../../JAVA_MIGRATION_DIVERGENCES.m
tests/resources, reports, logs and comparison tools. Frozen runs use its `version.txt`; final builds use the
committed version. Sources remain 224 Java files and nine Scala files / 744 nonblank lines. Next:
`MethodSymbol.jDesc`, preserving info/descriptor lookup order and failures.
### 2026-09-04 — ScalaSignature method-symbol descriptors
- Committed seven JVM characterization cases first as `16f4568` against the untouched `MethodSymbol.jDesc`. They pin
literal and null descriptors, repeated virtual info/descriptor read order, changing uncached info results, null info,
both failure boundaries, unused method shape/symbol members and a frozen Scala caller's descriptor/null behavior.
- Added `ReferenceScalaMethodSymbolDescriptor`, compiled once with Scala 2.11.5 under Java 8 against the unchanged dev
jar at `27863b4`. Its frozen Scala caller and `MethodSymbol` subclass preserve the original descriptor and virtual
info override. Source, encoded classes and SHA-256 provenance are committed under `src/test/fixtures/` and resources.
- Extracted the lookup into `ScalaSignatureParser.methodSymbolDescriptor(Object)`. Java retains virtual info and
`jDesc` order and passes through a null descriptor. Scala keeps the inferred return type, case class, path-dependent
declaration, products and serialization shape.
- Normal and clean validation pass 512 JVM tests, all 512 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,743 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-descriptor-reference/`, including the reference/fixture jars,
frozen tests/resources, reports, logs and comparison tools. Frozen runs use its `version.txt`; final builds use the
committed version. Sources remain 224 Java files and nine Scala files / 744 nonblank lines. Next:
`MethodSymbol.info`, preserving info-id/evaluation lookup order, casts and failures.
@@ -84,7 +84,7 @@ class ScalaSignature(val bytes: Bytes) {
def full = ScalaSignatureParser.methodSymbolFull(this)
def info: TMethodType = evalT(infoId)
def jDesc = info.jDesc
def jDesc = ScalaSignatureParser.methodSymbolDescriptor(this)
}
case class ExternalSymbol(name: String) extends SymbolRef {
@@ -117,6 +117,11 @@ final class ScalaSignatureParser {
return symbol.owner().full() + "." + symbol.name();
}
static String methodSymbolDescriptor(Object value) {
ScalaSignature.MethodSymbol symbol = (ScalaSignature.MethodSymbol) value;
return symbol.info().jDesc();
}
static byte[] section(Bytes bytes) {
byte[] array = bytes.arr();
int start = bytes.pos();