refactor: port class parent names to Java

This commit is contained in:
Algent committed 2026-09-04 21:24:26 +02:00
1 parent 6e3a30192d
commit 27863b4ca7
4 files changed
+38 -10

No files matched your search

+10 -9
View File
@@ -16,7 +16,7 @@ migration checkout; `codex/tile-compatibility-fixes` was deleted after its fixes
## Current state and next target
**498 plain-JVM tests and 237 Java 8 Forge tests pass, with zero failures/errors/skips.** Sources total **224 Java
**505 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,15 +24,16 @@ 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.MethodSymbol.full` delegates owner/name concatenation to
`ScalaSignatureParser.methodSymbolFull`. Seven characterization tests were committed first as `55f21ef`. They pin
literal/null results, owner/full/name read order, repeated uncached reads, failure boundaries, unused derived-member
access and the old Scala caller descriptor. All 498 frozen JVM consumers pass; checks preserve 442 retained
class/member APIs, all 17 ScalaSignature payloads, 3,741 unrelated method bodies and all 116 generated dumps. No
class is added or removed; the total stays 443 classes. Evidence: `run/migration-method-symbol-full-reference/`.
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/`.
**Next bounded candidate: `ScalaSignature.ClassSymbolRef.jParent`.** Characterize info/parent/name lookup order,
nulls and failures while retaining the trait, case-class and path-dependent declarations.
**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.
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
+22
View File
@@ -1622,3 +1622,25 @@ differences belong in the [divergence ledger](../../JAVA_MIGRATION_DIVERGENCES.m
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:
`ClassSymbolRef.jParent`, preserving info/parent/name lookup order and failures.
### 2026-09-04 — ScalaSignature class parent names
- Committed seven JVM characterization cases first as `6e3a301` against the untouched `ClassSymbolRef.jParent`.
They pin ClassSymbol/ObjectSymbol results, repeated virtual info/parent/jName order, first-parent selection without
interface reads, empty-list behavior, null results/chains, getter failures and the static trait-helper descriptor.
- Added `ReferenceScalaClassParent`, compiled once with Scala 2.11.5 under Java 8 against the unchanged dev jar at
`a670ea3`. Its frozen Scala caller, direct `ClassSymbolRef` implementation and `ClassType` subclass preserve the old
`$class.jParent` forwarder and virtual dispatch. A frozen Scala constructor also covers default head/empty-list
behavior because javac's accepted extra-outer `ClassType` call resolves to a nonexistent descriptor at runtime.
Source, encoded classes and SHA-256 provenance are committed under `src/test/fixtures/` and resources.
- Extracted the lookup chain into `ScalaSignatureParser.classParentName(Object)`. Java retains virtual info, parent
and `jName` order and passes through a null name. Scala keeps the inferred return type, trait helper, case-class
forwarders, path-dependent declarations, products and serialization shapes.
- Normal and clean validation pass 505 JVM tests, all 505 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,742 unrelated method
bodies. The helper adds one package-private method; no class inventory or effective divergence changes.
- Evidence is under ignored `run/migration-class-parent-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.jDesc`, preserving info/descriptor lookup order and failures.
@@ -54,7 +54,7 @@ class ScalaSignature(val bytes: Bytes) {
def isObject = false
def info: ClassType = evalT(infoId)
def jParent = info.parent.jName
def jParent = ScalaSignatureParser.classParentName(this)
def jInterfaces = ScalaSignatureParser.interfaceNames(this)
}
@@ -82,6 +82,11 @@ final class ScalaSignatureParser {
return symbol.owner().full() + "." + symbol.name();
}
static String classParentName(Object value) {
ScalaSignature.ClassSymbolRef symbol = (ScalaSignature.ClassSymbolRef) value;
return symbol.info().parent().jName();
}
static String classSymbolString(Object value) {
ScalaSignature.ClassSymbolRef symbol = (ScalaSignature.ClassSymbolRef) value;
return symbol.getClass().getName().replaceAll(".+\\$", "") + "("