refactor: port ScalaSignature interface names

This commit is contained in:
Algent committed 2026-09-04 19:45:47 +02:00
1 parent 6ccb83fd44
commit 035d84a6e0
5 files changed
+51 -14

No files matched your search

+3 -2
View File
@@ -30,8 +30,9 @@ including client bounds/mask updates. `StackAnalyser` initialization and constan
Java; retain its coordinated Scala class/companion/models. `FieldMixin.accessName` also delegates to Java while
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. The next bounded candidate is
`ScalaSignature.ClassSymbolRef.jInterfaces`, with characterization before extraction.
method assembly while preserving virtual lookup and evaluation order. `ClassSymbolRef.jInterfaces` delegates
ordered interface-name mapping while retaining its Scala List contract. The next bounded candidate is
`ScalaSignature.ClassSymbolRef.toString`, 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.
+11 -11
View File
@@ -16,7 +16,7 @@ migration checkout; `codex/tile-compatibility-fixes` was deleted after its fixes
## Current state and next target
**456 plain-JVM tests and 237 Java 8 Forge tests pass, with zero failures/errors/skips.** Sources total **224 Java
**463 plain-JVM tests and 237 Java 8 Forge tests pass, with zero failures/errors/skips.** Sources total **224 Java
files and 9 Scala files / 749 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,17 +24,17 @@ 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.TMethodType.jDesc` delegates to `ScalaSignatureParser.methodDescriptor`.
Seven characterization tests were committed first as `d61aed2`. They pin literal descriptor assembly, ordered
parameter info/return-type reads, repeated queries, nulls, getter failures and the static trait helper. The Java
callback retains Scala collection mapping and finishes parameters before reading the method return type.
All 456 frozen JVM consumers pass; checks preserve 441 retained class/member APIs, all 17 ScalaSignature payloads,
3,732 unrelated method bodies and all 116 generated dumps. One unreferenced Scala callback is replaced by a Java
callback; the total stays 443 classes. Evidence: `run/migration-method-descriptor-reference/`.
The preceding `TypeRef.jDesc` extraction is recorded in history and `run/migration-type-descriptor-reference/`.
Latest bounded target: `ScalaSignature.ClassSymbolRef.jInterfaces` delegates to `ScalaSignatureParser.interfaceNames`.
Seven characterization tests were committed first as `6ccb83f`, including a frozen Scala caller and subclasses
compiled against `240a788`. They pin virtual info/interfaces/jName reads, ordered mapping, duplicates, empty-list
and string identities, repeated queries, nulls, failures and the static trait helper. The Java callback retains the
Scala List builder and result contract. All 463 frozen JVM consumers pass; checks preserve 441 retained class/member
APIs, all 17 ScalaSignature payloads, 3,733 unrelated method bodies and all 116 generated dumps. One unreferenced
Scala callback is replaced by a Java callback; the total stays 443 classes.
Evidence: `run/migration-interface-names-reference/`; fixture provenance is in `src/test/fixtures/README.md`.
**Next bounded candidate: `ScalaSignature.ClassSymbolRef.jInterfaces`.** Characterize virtual info/interface
lookup, ordered jName mapping, empty/null cases and failure order. Retain the trait/model declarations and List API.
**Next bounded candidate: `ScalaSignature.ClassSymbolRef.toString`.** Characterize class-name trimming, hexadecimal
flags, virtual name/owner/infoId reads and null/failure order while retaining the trait and case-class 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
+23
View File
@@ -1497,3 +1497,26 @@ 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. Sources remain 224 Java files and nine Scala files / 749 nonblank lines. Next: `ClassSymbolRef.jInterfaces`,
retaining its List contract, virtual lookup, ordered mapping and failure behavior.
### 2026-09-04 — ScalaSignature interface names
- Committed seven JVM characterization cases first as `6ccb83f` against the untouched `ClassSymbolRef.jInterfaces`.
They pin ClassSymbol/ObjectSymbol parent exclusion, ordered names and duplicates, the empty List singleton,
string identity and null names, repeated queries, virtual info/interfaces/jName dispatch and failure boundaries.
A proxy also exercises the exact static trait-helper descriptor without an outer instance.
- Added `ReferenceScalaInterfaceNames`, compiled once with Scala 2.11.5 under Java 8 against the unchanged dev jar
at `240a788`. Its Scala caller and ClassSymbol/ClassType subclasses prove compatibility with old bytecode and
overridden path-dependent methods. 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 mapping into `ScalaSignatureParser.interfaceNames(Object)`. The Java callback retains virtual
lookup and Scala List map/builder behavior, using the existing TraversableLike bridge pattern. The helper returns
`List<String>`; Scala retains inferred types, trait/model declarations, forwarders and serialization shapes.
- Normal and clean validation pass 463 JVM tests, 463 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 441 retained class/member APIs, all 17 ScalaSignature payloads and 3,733 unrelated method
bodies. The sole inventory replacement is `ClassSymbolRef$$anonfun$jInterfaces$1` with `ScalaSignatureParser$2`,
covered by the existing unreferenced compiler-artifact ledger entry. No new effective divergence is introduced.
- Evidence is under ignored `run/migration-interface-names-reference/`, including the fixture/reference jars,
frozen tests/resources, reports and comparison tools. Frozen runs use its `version.txt`; final builds use the
committed version. Sources remain 224 Java files and nine Scala files / 749 nonblank lines. Next:
`ClassSymbolRef.toString`, preserving formatting, virtual reads and failure order.
@@ -56,7 +56,7 @@ class ScalaSignature(val bytes: Bytes) {
def isObject = false
def info: ClassType = evalT(infoId)
def jParent = info.parent.jName
def jInterfaces = info.interfaces.map(_.jName)
def jInterfaces = ScalaSignatureParser.interfaceNames(this)
}
case class ClassSymbol(
@@ -58,6 +58,19 @@ final class ScalaSignatureParser {
return "(" + parameters.mkString() + ")" + method.returnType().jDesc();
}
@SuppressWarnings({ "unchecked", "rawtypes" })
static List<String> interfaceNames(Object value) {
ScalaSignature.ClassSymbolRef symbol = (ScalaSignature.ClassSymbolRef) value;
return (List<String>) ((TraversableLike) symbol.info().interfaces())
.map(new AbstractFunction1<ScalaSignature.TypeRef, String>() {
@Override
public String apply(ScalaSignature.TypeRef ref) {
return ref.jName();
}
}, List$.MODULE$.canBuildFrom());
}
static byte[] section(Bytes bytes) {
byte[] array = bytes.arr();
int start = bytes.pos();