refactor: port applied type descriptors to Java

This commit is contained in:
Algent committed 2026-09-04 20:44:35 +02:00
1 parent 549308667f
commit 24c772310f
4 files changed
+40 -15

No files matched your search

+11 -11
View File
@@ -16,24 +16,24 @@ migration checkout; `codex/tile-compatibility-fixes` was deleted after its fixes
## Current state and next target
**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.
**484 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,
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.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/`.
Latest bounded target: `ScalaSignature.TypeRefType.jDesc` delegates applied-type descriptor routing to
`ScalaSignatureParser.appliedTypeDescriptor`. Seven characterization tests were committed first as `5493086`. They
pin array argument and fallback routing, two/three virtual name reads, repeated uncached reads, malformed/null type
arguments, failure order and the retained method-type view. A frozen Scala 2.11.5 caller and subclass preserve the
old descriptor. All 484 frozen JVM consumers pass; checks preserve 442 retained class/member APIs, all 17
ScalaSignature payloads, 3,739 unrelated method bodies and all 116 generated dumps. No class is added or removed;
the total stays 443 classes. Evidence: `run/migration-applied-type-descriptor-reference/`.
**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.
**Next bounded candidate: `ScalaSignature.ClassSymbolRef.full`.** Characterize owner/name concatenation, virtual
read order, nulls and failures while retaining the trait, 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
@@ -1558,3 +1558,25 @@ 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 / 747 nonblank lines. Next:
`TypeRefType.jDesc`, preserving array/super routing, virtual reads and malformed-input behavior.
### 2026-09-04 — ScalaSignature applied-type descriptors
- Committed seven JVM characterization cases first as `5493086` against the untouched `TypeRefType.jDesc`. They pin
the array branch's first argument descriptor, fallback routing through `TypeRef.jDesc` and `jName`, two/three
virtual name reads, repeated uncached queries, malformed/null argument lists, null descriptors, failure boundaries
and the retained `TMethodType` parameter/return view.
- Added `ReferenceScalaAppliedTypeDescriptor`, compiled once with Scala 2.11.5 under Java 8 against the unchanged dev
jar at `d5bf16f`. Its frozen Scala caller and `TypeRefType` subclass preserve the old method descriptor and virtual
override dispatch. Source, encoded classes and SHA-256 provenance are committed under `src/test/fixtures/` and
`src/test/resources/compat/`; do not regenerate them against the port.
- Extracted the applied-type branch into `ScalaSignatureParser.appliedTypeDescriptor(Object)`. The array path reads
only the first type argument; the fallback reuses `typeDescriptor`, preserving its virtual name and `jName` order.
Scala retains the inferred return type, case class, method-type mixin, product members and serialization shape.
- Normal and clean validation pass 484 JVM tests, all 484 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,739 unrelated method
bodies. The helper adds one package-private method; no class inventory or effective divergence changes.
- Evidence is under ignored `run/migration-applied-type-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. Source totals are 224 Java files and nine Scala files / 744 nonblank lines. Next:
`ClassSymbolRef.full`, preserving owner/name concatenation, virtual reads and failure order.
@@ -132,10 +132,7 @@ class ScalaSignature(val bytes: Bytes) {
def returnType = this
override def jDesc = name match {
case "scala.Array" => "[" + typArgs(0).jDesc
case _ => super.jDesc
}
override def jDesc = ScalaSignatureParser.appliedTypeDescriptor(this)
}
case class ThisType(sym: SymbolRef) extends TypeRef
@@ -44,6 +44,12 @@ final class ScalaSignatureParser {
return "L" + ref.jName() + ";";
}
static String appliedTypeDescriptor(Object value) {
ScalaSignature.TypeRefType ref = (ScalaSignature.TypeRefType) value;
if ("scala.Array".equals(ref.name())) return "[" + ref.typArgs().apply(0).jDesc();
return typeDescriptor(ref);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
static String methodDescriptor(Object value) {
ScalaSignature.TMethodType method = (ScalaSignature.TMethodType) value;