Skip to content

Report constructor arguments and default values that no constructor uses - #802

Merged
lagergren merged 7 commits into
masterfrom
lagergren/unused-constructor-args
Nov 30, 2026
Merged

lagergren merged 7 commits into
masterfrom
lagergren/unused-constructor-args

Conversation

@lagergren

@lagergren lagergren commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A class's extends and incorporates arguments, and the default values in its shorthand constructor declaration, reach the compiled class only through the synthetic constructor that the declaration implies. Where explicit constructors take its place, the compiler ignored them without checking them, so this compiled without an error:

class C extends Base(noSuchName) {
    construct(Int n) {
        construct Base(n);
    }
}
  • COMPILER-188 reported unused contribution arguments only beside an explicit default or shorthand constructor. It now reports them whenever no synthetic constructor passes them: beside an explicit shorthand constructor, or beside the explicit constructors of a class without a shorthand declaration.
  • New COMPILER-210 reports a shorthand parameter's default value when an explicit constructor replaces the shorthand one and the class declares the property itself, so that neither one takes the value. If the class doesn't declare the property, the default still initializes the property the declaration implies, and no error is reported.

The checks found eight such places in the XDK. None of them ran, and they are removed with no change in behavior:

  • Unused extends arguments: OrderedMapSet, JsonLogStoreBase, JsonProcessorStore, KeyCredential and the native OSFileChannel. Their constructors construct their super classes themselves.
  • Unused shorthand defaults: ConsoleAppender, Instruction and PseudoRandom. Their explicit constructors declare the same defaults.

The language server's semantic model found these. It left the names in such arguments without a binding, and so refused a rename that spelled one, for example renaming OrderedMapSet.contents.

Why the library code is removed

The arguments in extends ObjectStore(catalog, info) are passed only by the constructor the compiler generates from a shorthand declaration, the parameter list after the class name. JsonLogStoreBase has no such list, and its explicit constructor runs construct ObjectStore(catalog, info); itself, so nothing ever evaluated the (catalog, info) on the extends line, and the compiler never resolved its names. The same holds for the other four extends arguments. The three shorthand defaults are values that no constructor takes, as the explicit constructors declare their own.

The compiler has exactly one consumer of contribution arguments: TypeCompositionStatement.generateCode reads them (m_mapContribArgs) only to generate the synthetic shorthand constructor, and skips that unless the constructor is synthetic and empty. A class with its own constructors never reaches it, so in these classes the arguments cannot take effect without changing the language's semantics.

The code had to go because this PR makes it an error: the XDK would not compile with it. Removing it changes nothing at runtime, as none of it ran.

The check is an error, not a warning, because it extends an existing error to the cases that the existing error missed. COMPILER-188 (2023, "Disallow parameterized contribution if default or shorthand constructor is present") already rejects these arguments beside an explicit default or shorthand constructor; a class with only other explicit constructors slipped past it.

Alternatives considered

  • Remove the dead code and leave the compiler as it is. This fixes the XDK, but nothing stops new instances, in the XDK or in anyone else's code, and the compiler keeps accepting extends Base(noSuchName).
  • Report a warning instead of an error. The code could then stay, but it would still mislead: the line says the super class is constructed from (catalog, info), and nothing checks that it matches what the constructor really passes. It is also weaker than COMPILER-188, which is already an error for the neighboring case.
  • Make the compiler check the arguments without using them. There is no scope to check them in: with several explicit constructors, it is not defined whose parameters catalog and info name.
  • Have the language server tolerate them. It already does: its rename proof treats a name it cannot bind as unprovable, and only refuses a rename where such a name spells the old or new name, as renaming OrderedMapSet.contents was refused. Special-casing these arguments in the server would hide a compiler gap rather than close it.

Testing

  • ConstructorArgumentsTest covers three cases:

    • unused extends arguments beside an explicit constructor;
    • a shorthand default that an explicit constructor replaces;
    • arguments and defaults that a synthetic constructor or a property uses, which still compile.

    The first two fail without the compiler change.

  • ./gradlew build passes. The XDK, javatools_bridge and manualTests compile, the XDK's testXtc tasks pass, and javatools' tests pass: 387 tests, 0 failures, 42 skipped, all disabled or platform-specific.

  • ./gradlew spotlessCheck passes.

lagergren added a commit that referenced this pull request Nov 24, 2026
lagergren added a commit that referenced this pull request Nov 25, 2026
doc/errs/errs-693-pr-map-2026-11-25.tsv gives every commit of #693
(49b5f8a, 468 commits on master 535e80f) its position, subject,
the layers its paths touch, a proposed PR and notes. pr-roadmap.md's new
top section, "#693 commit -> PR map - 2026-11-25", gives the units in
merge order with their commits, files, lines, test share, dependencies
and status, what each holds and what review should watch, the 51
commits that need splitting, the steps to squash or leave out, and what
is not for master. Nothing after 2026-10-16 had been mapped before.

How the units were decided: what master's own code must accept comes
first, the javatools compiler, runtime, debugger and embedding API (units
1-9; 2-4 are the earlier #685-successor, semantic facts and partial
analysis units, the breaking API of 0.5.0), then the Gradle plugin's
pieces as small PRs (10-14), the lang build (15), and the product last
(16-29): commit 8, the whole product in one commit, split by component,
later commits by feature area, tours and docs at the end. A commit's
files go to units by path; one whose files fall in several units is a
split, proposed for the unit of its main part.

Counts: 29 units plus "not for master" (41, 68, 118, 405). Already on
master: 405 (#800). Open: 460 (#802) and 468 (#804), each its own unit.

doc/errs/errs-693-sync-2026-11-25.tsv records tonight's mirror,
positions 462-468, and the errs-only records 93c065e, db87170 and
60c4dcc that stayed on errs.

The header line, "Current review branches and merge order" and "Existing
PRs" now give the 2026-11-25 state: the 2026-10-09 branches are stale,
#685's contracts come first, and the PRs from gh.

Checked by script: the map has 468 rows in #693's order, each commit
once, its hashes and subjects equal to git log's; every commit has
exactly one proposed PR, and the units' commit lists cover all 468;
files and lines per unit are summed from git log --numstat; supersede
notes come from deleted files traced to the commits that added them;
the sync record's positions and subjects match #693 and its errs commits
exist. Limits: no unit was built or tested on its own, and the line
counts are churn over each unit's commits, not its net diff.
lagergren added a commit that referenced this pull request Nov 25, 2026
lagergren added a commit that referenced this pull request Nov 25, 2026
doc/errs/errs-693-pr-map-2026-11-25.tsv gives every commit of #693
(49b5f8a, 468 commits on master 535e80f) its position, subject,
the layers its paths touch, a proposed PR and notes. pr-roadmap.md's new
top section, "#693 commit -> PR map - 2026-11-25", gives the units in
merge order with their commits, files, lines, test share, dependencies
and status, what each holds and what review should watch, the 51
commits that need splitting, the steps to squash or leave out, and what
is not for master. Nothing after 2026-10-16 had been mapped before.

How the units were decided: what master's own code must accept comes
first, the javatools compiler, runtime, debugger and embedding API (units
1-9; 2-4 are the earlier #685-successor, semantic facts and partial
analysis units, the breaking API of 0.5.0), then the Gradle plugin's
pieces as small PRs (10-14), the lang build (15), and the product last
(16-29): commit 8, the whole product in one commit, split by component,
later commits by feature area, tours and docs at the end. A commit's
files go to units by path; one whose files fall in several units is a
split, proposed for the unit of its main part.

Counts: 29 units plus "not for master" (41, 68, 118, 405). Already on
master: 405 (#800). Open: 460 (#802) and 468 (#804), each its own unit.

doc/errs/errs-693-sync-2026-11-25.tsv records tonight's mirror,
positions 462-468, and the errs-only records 93c065e, db87170 and
60c4dcc that stayed on errs.

The header line, "Current review branches and merge order" and "Existing
PRs" now give the 2026-11-25 state: the 2026-10-09 branches are stale,
#685's contracts come first, and the PRs from gh.

Checked by script: the map has 468 rows in #693's order, each commit
once, its hashes and subjects equal to git log's; every commit has
exactly one proposed PR, and the units' commit lists cover all 468;
files and lines per unit are summed from git log --numstat; supersede
notes come from deleted files traced to the commits that added them;
the sync record's positions and subjects match #693 and its errs commits
exist. Limits: no unit was built or tested on its own, and the line
counts are churn over each unit's commits, not its net diff.
@lagergren
lagergren force-pushed the lagergren/unused-constructor-args branch from 24d639c to 27b4c9e Compare November 25, 2026 13:03
lagergren added a commit that referenced this pull request Nov 25, 2026
…he 29-unit map it replaces

squash-693.md planned #693's first 397 commits (2026-11-23); the 2026-11-25 rebase gave them new hashes and 77
commits came after. A second plan, the 29-unit map in pr-roadmap.md with its per-commit table, was made that day
without it. squash-693.md is now the plan:
- commits 1-397 keep their numbers, topics, groups and PRs, with the rebase's hashes;
- 398-474 are placed by the plan's rules: each in a topic and a group (17 new groups, the rest join existing
  ones), divided at lang/ into its topic's xvm and lang PR, 28 of them listed as mixed commits to divide by path;
  459 (#802) and 467, 471, 473, 474 (#804) are already open on master and leave #693 when those merge;
- the PR and topic tables, each topic's counts and added lines, and the appendix include them;
- the 29-unit map's review notes that the plan lacked (0.5.0 as the boundary of X1-X3's breaking API, X1 as one
  PR, the stale compiler snapshot branches, X4's debugger assembled by path, X5's maintainer go-ahead, L6 on
  0.30.1 with tagged workarounds) are its new Notes for review.

pr-roadmap.md's map section now points to squash-693.md, and errs-693-pr-map-2026-11-25.tsv is gone; the
rebase's old and new positions stay in errs-693-rebase-2026-11-25.tsv. The roadmap's open-PR line names the
current positions: #802 is commit 459, #804 commits 467, 471, 473 and 474.

Checked: the appendix lists exactly #693's 474 commits at ab5521d, in order, each with an xvm or lang PR;
every commit is in exactly one topic group but the 60 the plan keeps alone, as before; no pre-rebase hash is
left; every table row has its table's column count; nothing else linked the removed table.
lagergren added a commit that referenced this pull request Nov 25, 2026
lagergren added a commit that referenced this pull request Nov 25, 2026
doc/errs/errs-693-pr-map-2026-11-25.tsv gives every commit of #693
(49b5f8a, 468 commits on master 535e80f) its position, subject,
the layers its paths touch, a proposed PR and notes. pr-roadmap.md's new
top section, "#693 commit -> PR map - 2026-11-25", gives the units in
merge order with their commits, files, lines, test share, dependencies
and status, what each holds and what review should watch, the 51
commits that need splitting, the steps to squash or leave out, and what
is not for master. Nothing after 2026-10-16 had been mapped before.

How the units were decided: what master's own code must accept comes
first, the javatools compiler, runtime, debugger and embedding API (units
1-9; 2-4 are the earlier #685-successor, semantic facts and partial
analysis units, the breaking API of 0.5.0), then the Gradle plugin's
pieces as small PRs (10-14), the lang build (15), and the product last
(16-29): commit 8, the whole product in one commit, split by component,
later commits by feature area, tours and docs at the end. A commit's
files go to units by path; one whose files fall in several units is a
split, proposed for the unit of its main part.

Counts: 29 units plus "not for master" (41, 68, 118, 405). Already on
master: 405 (#800). Open: 460 (#802) and 468 (#804), each its own unit.

doc/errs/errs-693-sync-2026-11-25.tsv records tonight's mirror,
positions 462-468, and the errs-only records 93c065e, db87170 and
60c4dcc that stayed on errs.

The header line, "Current review branches and merge order" and "Existing
PRs" now give the 2026-11-25 state: the 2026-10-09 branches are stale,
#685's contracts come first, and the PRs from gh.

Checked by script: the map has 468 rows in #693's order, each commit
once, its hashes and subjects equal to git log's; every commit has
exactly one proposed PR, and the units' commit lists cover all 468;
files and lines per unit are summed from git log --numstat; supersede
notes come from deleted files traced to the commits that added them;
the sync record's positions and subjects match #693 and its errs commits
exist. Limits: no unit was built or tested on its own, and the line
counts are churn over each unit's commits, not its net diff.
lagergren added a commit that referenced this pull request Nov 25, 2026
…he 29-unit map it replaces

squash-693.md planned #693's first 397 commits (2026-11-23); the 2026-11-25 rebase gave them new hashes and 77
commits came after. A second plan, the 29-unit map in pr-roadmap.md with its per-commit table, was made that day
without it. squash-693.md is now the plan:
- commits 1-397 keep their numbers, topics, groups and PRs, with the rebase's hashes;
- 398-474 are placed by the plan's rules: each in a topic and a group (17 new groups, the rest join existing
  ones), divided at lang/ into its topic's xvm and lang PR, 28 of them listed as mixed commits to divide by path;
  459 (#802) and 467, 471, 473, 474 (#804) are already open on master and leave #693 when those merge;
- the PR and topic tables, each topic's counts and added lines, and the appendix include them;
- the 29-unit map's review notes that the plan lacked (0.5.0 as the boundary of X1-X3's breaking API, X1 as one
  PR, the stale compiler snapshot branches, X4's debugger assembled by path, X5's maintainer go-ahead, L6 on
  0.30.1 with tagged workarounds) are its new Notes for review.

pr-roadmap.md's map section now points to squash-693.md, and errs-693-pr-map-2026-11-25.tsv is gone; the
rebase's old and new positions stay in errs-693-rebase-2026-11-25.tsv. The roadmap's open-PR line names the
current positions: #802 is commit 459, #804 commits 467, 471, 473 and 474.

Checked: the appendix lists exactly #693's 474 commits at ab5521d, in order, each with an xvm or lang PR;
every commit is in exactly one topic group but the 60 the plan keeps alone, as before; no pre-rebase hash is
left; every table row has its table's column count; nothing else linked the removed table.
lagergren added a commit that referenced this pull request Nov 25, 2026
… its four commits, and place commit 480

#804 merged to master as 2e26663. #693 was rebased onto it without #804's four commits (467, 471, 473 and 474
then), which gave every commit a new hash and moved the sixteen after 467 up. The plan follows:
- every commit's number and hash, in the groups, the findings, the mixed commits and the appendix;
- #804's group and its four rows are gone, and P9's counts and lines no longer hold them (328 lines);
- the notes that name commits after 467 (the model export, the Javadoc fix) take their new numbers;
- the header and the PR note say that #804 merged and #802 is still open;
- commit 480, the user guide's boxed screenshots, joins the user guide group.
pr-roadmap.md names the new head and master and says #804 merged.

Checked: the appendix lists exactly #693's 480 commits on 2e26663, in order, each with a PR; every commit is in
one group but the plan's stand-alone ones; no hash from before the rebase is left; every table row has its table's
column count.
@cpurdy

cpurdy commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

@ggleyzer Let's go over this when you are back from lunch. I'd like to make sure that we're in agreement with the selected solution before I approve this.

@ggleyzer ggleyzer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cam and I reviewed this together; CAPS are his :)

Comment thread lib_sec/src/main/x/sec/KeyCredential.x Resolved
Comment thread lib_xml/src/main/x/xml/Instruction.x Resolved
lagergren added a commit that referenced this pull request Nov 25, 2026
…ich fails on an unbound occurrence

The census that sorted the rename facts' unprovable bindings on 2026-11-24 was a temporary test. It is now
SemanticModelCensusTest, a heavy test (-PlspTests=heavy or all): it compiles the 22 modules of the
repository's 21 libraries from source in build order, each against the ones before it, as a workspace that
holds the repository does, and sorts every binding that a proof cannot prove by the construct that wrote it:
an occurrence without a symbol (unbound), or one bound through an identity that no declaration or artifact
proves (unproven), as XdkRename's comparison judges them. No compiling construct is known to leave a name
unbound since #802, so an unbound occurrence fails the test with its examples; the unproven bindings are
counted, by construct and by library with examples, in lang/lsp-server/build/semantic-model-census.txt, and
summarized in the output's lines that start with census.

On errs at 4a9709c: 0 unbound, 138 unproven (80 occurrences, 58 calls), the count remaining.md gives.
By construct: a formal type's child, as Element in CompileType.Element, 42 (Element 23, Key 8, Value 7,
OuterType 3, ParentInput 1); the call of an anonymous class's constructor, new Iterator() {...}, 39; a call
whose site keeps its receiver's route (a union receiver's or a recursive one), 19 sites, each a name and a
call (appendTo 15, estimateStringLength 3, toString 1); this in an anonymous class 17; this.Map naming an
anonymous class 1; httpMethod of a union receiver 1. By library: ecstasy 76, json 29, xml 11, net 8, jsondb 7,
collections 6, xenia 1.

Validated: the census itself, run alone with -PlspTests=heavy, --rerun --no-build-cache, 1 test, 0 skipped,
0 failures, from fresh JUnit XML.
lagergren added a commit that referenced this pull request Nov 25, 2026
lagergren added a commit that referenced this pull request Nov 25, 2026
doc/errs/errs-693-pr-map-2026-11-25.tsv gives every commit of #693
(49b5f8a, 468 commits on master 535e80f) its position, subject,
the layers its paths touch, a proposed PR and notes. pr-roadmap.md's new
top section, "#693 commit -> PR map - 2026-11-25", gives the units in
merge order with their commits, files, lines, test share, dependencies
and status, what each holds and what review should watch, the 51
commits that need splitting, the steps to squash or leave out, and what
is not for master. Nothing after 2026-10-16 had been mapped before.

How the units were decided: what master's own code must accept comes
first, the javatools compiler, runtime, debugger and embedding API (units
1-9; 2-4 are the earlier #685-successor, semantic facts and partial
analysis units, the breaking API of 0.5.0), then the Gradle plugin's
pieces as small PRs (10-14), the lang build (15), and the product last
(16-29): commit 8, the whole product in one commit, split by component,
later commits by feature area, tours and docs at the end. A commit's
files go to units by path; one whose files fall in several units is a
split, proposed for the unit of its main part.

Counts: 29 units plus "not for master" (41, 68, 118, 405). Already on
master: 405 (#800). Open: 460 (#802) and 468 (#804), each its own unit.

doc/errs/errs-693-sync-2026-11-25.tsv records tonight's mirror,
positions 462-468, and the errs-only records 93c065e, db87170 and
60c4dcc that stayed on errs.

The header line, "Current review branches and merge order" and "Existing
PRs" now give the 2026-11-25 state: the 2026-10-09 branches are stale,
#685's contracts come first, and the PRs from gh.

Checked by script: the map has 468 rows in #693's order, each commit
once, its hashes and subjects equal to git log's; every commit has
exactly one proposed PR, and the units' commit lists cover all 468;
files and lines per unit are summed from git log --numstat; supersede
notes come from deleted files traced to the commits that added them;
the sync record's positions and subjects match #693 and its errs commits
exist. Limits: no unit was built or tested on its own, and the line
counts are churn over each unit's commits, not its net diff.
lagergren added a commit that referenced this pull request Nov 25, 2026
…he 29-unit map it replaces

squash-693.md planned #693's first 397 commits (2026-11-23); the 2026-11-25 rebase gave them new hashes and 77
commits came after. A second plan, the 29-unit map in pr-roadmap.md with its per-commit table, was made that day
without it. squash-693.md is now the plan:
- commits 1-397 keep their numbers, topics, groups and PRs, with the rebase's hashes;
- 398-474 are placed by the plan's rules: each in a topic and a group (17 new groups, the rest join existing
  ones), divided at lang/ into its topic's xvm and lang PR, 28 of them listed as mixed commits to divide by path;
  459 (#802) and 467, 471, 473, 474 (#804) are already open on master and leave #693 when those merge;
- the PR and topic tables, each topic's counts and added lines, and the appendix include them;
- the 29-unit map's review notes that the plan lacked (0.5.0 as the boundary of X1-X3's breaking API, X1 as one
  PR, the stale compiler snapshot branches, X4's debugger assembled by path, X5's maintainer go-ahead, L6 on
  0.30.1 with tagged workarounds) are its new Notes for review.

pr-roadmap.md's map section now points to squash-693.md, and errs-693-pr-map-2026-11-25.tsv is gone; the
rebase's old and new positions stay in errs-693-rebase-2026-11-25.tsv. The roadmap's open-PR line names the
current positions: #802 is commit 459, #804 commits 467, 471, 473 and 474.

Checked: the appendix lists exactly #693's 474 commits at ab5521d, in order, each with an xvm or lang PR;
every commit is in exactly one topic group but the 60 the plan keeps alone, as before; no pre-rebase hash is
left; every table row has its table's column count; nothing else linked the removed table.
lagergren added a commit that referenced this pull request Nov 25, 2026
… its four commits, and place commit 480

#804 merged to master as 2e26663. #693 was rebased onto it without #804's four commits (467, 471, 473 and 474
then), which gave every commit a new hash and moved the sixteen after 467 up. The plan follows:
- every commit's number and hash, in the groups, the findings, the mixed commits and the appendix;
- #804's group and its four rows are gone, and P9's counts and lines no longer hold them (328 lines);
- the notes that name commits after 467 (the model export, the Javadoc fix) take their new numbers;
- the header and the PR note say that #804 merged and #802 is still open;
- commit 480, the user guide's boxed screenshots, joins the user guide group.
pr-roadmap.md names the new head and master and says #804 merged.

Checked: the appendix lists exactly #693's 480 commits on 2e26663, in order, each with a PR; every commit is in
one group but the plan's stand-alone ones; no hash from before the rebase is left; every table row has its table's
column count.
lagergren added a commit that referenced this pull request Nov 25, 2026
…ich fails on an unbound occurrence

The census that sorted the rename facts' unprovable bindings on 2026-11-24 was a temporary test. It is now
SemanticModelCensusTest, a heavy test (-PlspTests=heavy or all): it compiles the 22 modules of the
repository's 21 libraries from source in build order, each against the ones before it, as a workspace that
holds the repository does, and sorts every binding that a proof cannot prove by the construct that wrote it:
an occurrence without a symbol (unbound), or one bound through an identity that no declaration or artifact
proves (unproven), as XdkRename's comparison judges them. No compiling construct is known to leave a name
unbound since #802, so an unbound occurrence fails the test with its examples; the unproven bindings are
counted, by construct and by library with examples, in lang/lsp-server/build/semantic-model-census.txt, and
summarized in the output's lines that start with census.

On errs at 4a9709c: 0 unbound, 138 unproven (80 occurrences, 58 calls), the count remaining.md gives.
By construct: a formal type's child, as Element in CompileType.Element, 42 (Element 23, Key 8, Value 7,
OuterType 3, ParentInput 1); the call of an anonymous class's constructor, new Iterator() {...}, 39; a call
whose site keeps its receiver's route (a union receiver's or a recursive one), 19 sites, each a name and a
call (appendTo 15, estimateStringLength 3, toString 1); this in an anonymous class 17; this.Map naming an
anonymous class 1; httpMethod of a union receiver 1. By library: ecstasy 76, json 29, xml 11, net 8, jsondb 7,
collections 6, xenia 1.

Validated: the census itself, run alone with -PlspTests=heavy, --rerun --no-build-cache, 1 test, 0 skipped,
0 failures, from fresh JUnit XML.
@lagergren
lagergren force-pushed the lagergren/unused-constructor-args branch from 27b4c9e to 014f060 Compare November 26, 2026 09:29
@lagergren

Copy link
Copy Markdown
Contributor Author

Thanks, Gene and Cam. The changes are in 014f060 (rebased on master):

  • Matching redundant information is allowed now. ConsoleAppender, PseudoRandom and Instruction are restored as they were, and nothing reports them. Both checks report only what differs:
    • A shorthand default (COMPILER-210) is reported only when it differs from the explicit shorthand constructor's default for that parameter. Both are compared as compiled constants, so 0x10 matches 16. The check moved to code generation, where those defaults are compiled.
    • Contribution arguments (COMPILER-188) are reported only when they differ from what the explicit shorthand or default constructor passes. That constructor's single construct T(...) statement must pass the same parameter at the same position, the same literal, or the same non-parameter name (such as False). Arguments are compared as written, so an expression like x + 1 never matches.
    • Both messages now say what differs.
  • fExplicitDefault is now constructorExplicit, the explicit shorthand or default constructor. The argument check compares against it, so it's declared where it's used.
  • Cam's question about constructors != null: with no constructors, not reporting is correct. The compiler then generates the default constructor, and that constructor passes the arguments, so class Implicit extends Base(1) {} is valid code that a report would reject. The code comment now says so.
  • The jsondb and sec removals stay. So do OrderedMapSet and OSFileChannel: their arguments name no constructor parameter, so they still differ.
  • Also: an enum value with an explicit constructor crashed the argument check with a NullPointerException, because enum values have no compositions. Master already crashes this way with an explicit default constructor; this PR had widened it, and it now has a guard.

Tests: ConstructorArgumentsTest has 8 cases. The matching cases fail on the previous logic, the reporting cases fail if the checks allow everything, and the enum case fails without the guard. :javatools:test has 392 tests with 0 failures; xdk:installDist builds with no warnings; javadoc and spotless pass.

@lagergren
lagergren requested review from cpurdy and ggleyzer November 26, 2026 09:29
lagergren added a commit that referenced this pull request Nov 26, 2026
…ich fails on an unbound occurrence

The census that sorted the rename facts' unprovable bindings on 2026-11-24 was a temporary test. It is now
SemanticModelCensusTest, a heavy test (-PlspTests=heavy or all): it compiles the 22 modules of the
repository's 21 libraries from source in build order, each against the ones before it, as a workspace that
holds the repository does, and sorts every binding that a proof cannot prove by the construct that wrote it:
an occurrence without a symbol (unbound), or one bound through an identity that no declaration or artifact
proves (unproven), as XdkRename's comparison judges them. No compiling construct is known to leave a name
unbound since #802, so an unbound occurrence fails the test with its examples; the unproven bindings are
counted, by construct and by library with examples, in lang/lsp-server/build/semantic-model-census.txt, and
summarized in the output's lines that start with census.

On errs at 4a9709c: 0 unbound, 138 unproven (80 occurrences, 58 calls), the count remaining.md gives.
By construct: a formal type's child, as Element in CompileType.Element, 42 (Element 23, Key 8, Value 7,
OuterType 3, ParentInput 1); the call of an anonymous class's constructor, new Iterator() {...}, 39; a call
whose site keeps its receiver's route (a union receiver's or a recursive one), 19 sites, each a name and a
call (appendTo 15, estimateStringLength 3, toString 1); this in an anonymous class 17; this.Map naming an
anonymous class 1; httpMethod of a union receiver 1. By library: ecstasy 76, json 29, xml 11, net 8, jsondb 7,
collections 6, xenia 1.

Validated: the census itself, run alone with -PlspTests=heavy, --rerun --no-build-cache, 1 test, 0 skipped,
0 failures, from fresh JUnit XML.
lagergren added a commit that referenced this pull request Nov 26, 2026
lagergren added a commit that referenced this pull request Nov 26, 2026
doc/errs/errs-693-pr-map-2026-11-25.tsv gives every commit of #693
(49b5f8a, 468 commits on master 535e80f) its position, subject,
the layers its paths touch, a proposed PR and notes. pr-roadmap.md's new
top section, "#693 commit -> PR map - 2026-11-25", gives the units in
merge order with their commits, files, lines, test share, dependencies
and status, what each holds and what review should watch, the 51
commits that need splitting, the steps to squash or leave out, and what
is not for master. Nothing after 2026-10-16 had been mapped before.

How the units were decided: what master's own code must accept comes
first, the javatools compiler, runtime, debugger and embedding API (units
1-9; 2-4 are the earlier #685-successor, semantic facts and partial
analysis units, the breaking API of 0.5.0), then the Gradle plugin's
pieces as small PRs (10-14), the lang build (15), and the product last
(16-29): commit 8, the whole product in one commit, split by component,
later commits by feature area, tours and docs at the end. A commit's
files go to units by path; one whose files fall in several units is a
split, proposed for the unit of its main part.

Counts: 29 units plus "not for master" (41, 68, 118, 405). Already on
master: 405 (#800). Open: 460 (#802) and 468 (#804), each its own unit.

doc/errs/errs-693-sync-2026-11-25.tsv records tonight's mirror,
positions 462-468, and the errs-only records 93c065e, db87170 and
60c4dcc that stayed on errs.

The header line, "Current review branches and merge order" and "Existing
PRs" now give the 2026-11-25 state: the 2026-10-09 branches are stale,
#685's contracts come first, and the PRs from gh.

Checked by script: the map has 468 rows in #693's order, each commit
once, its hashes and subjects equal to git log's; every commit has
exactly one proposed PR, and the units' commit lists cover all 468;
files and lines per unit are summed from git log --numstat; supersede
notes come from deleted files traced to the commits that added them;
the sync record's positions and subjects match #693 and its errs commits
exist. Limits: no unit was built or tested on its own, and the line
counts are churn over each unit's commits, not its net diff.
lagergren added a commit that referenced this pull request Nov 26, 2026
…he 29-unit map it replaces

squash-693.md planned #693's first 397 commits (2026-11-23); the 2026-11-25 rebase gave them new hashes and 77
commits came after. A second plan, the 29-unit map in pr-roadmap.md with its per-commit table, was made that day
without it. squash-693.md is now the plan:
- commits 1-397 keep their numbers, topics, groups and PRs, with the rebase's hashes;
- 398-474 are placed by the plan's rules: each in a topic and a group (17 new groups, the rest join existing
  ones), divided at lang/ into its topic's xvm and lang PR, 28 of them listed as mixed commits to divide by path;
  459 (#802) and 467, 471, 473, 474 (#804) are already open on master and leave #693 when those merge;
- the PR and topic tables, each topic's counts and added lines, and the appendix include them;
- the 29-unit map's review notes that the plan lacked (0.5.0 as the boundary of X1-X3's breaking API, X1 as one
  PR, the stale compiler snapshot branches, X4's debugger assembled by path, X5's maintainer go-ahead, L6 on
  0.30.1 with tagged workarounds) are its new Notes for review.

pr-roadmap.md's map section now points to squash-693.md, and errs-693-pr-map-2026-11-25.tsv is gone; the
rebase's old and new positions stay in errs-693-rebase-2026-11-25.tsv. The roadmap's open-PR line names the
current positions: #802 is commit 459, #804 commits 467, 471, 473 and 474.

Checked: the appendix lists exactly #693's 474 commits at ab5521d, in order, each with an xvm or lang PR;
every commit is in exactly one topic group but the 60 the plan keeps alone, as before; no pre-rebase hash is
left; every table row has its table's column count; nothing else linked the removed table.
lagergren added a commit that referenced this pull request Nov 26, 2026
… its four commits, and place commit 480

#804 merged to master as 2e26663. #693 was rebased onto it without #804's four commits (467, 471, 473 and 474
then), which gave every commit a new hash and moved the sixteen after 467 up. The plan follows:
- every commit's number and hash, in the groups, the findings, the mixed commits and the appendix;
- #804's group and its four rows are gone, and P9's counts and lines no longer hold them (328 lines);
- the notes that name commits after 467 (the model export, the Javadoc fix) take their new numbers;
- the header and the PR note say that #804 merged and #802 is still open;
- commit 480, the user guide's boxed screenshots, joins the user guide group.
pr-roadmap.md names the new head and master and says #804 merged.

Checked: the appendix lists exactly #693's 480 commits on 2e26663, in order, each with a PR; every commit is in
one group but the plan's stand-alone ones; no hash from before the rebase is left; every table row has its table's
column count.
lagergren added a commit that referenced this pull request Nov 26, 2026
…ich fails on an unbound occurrence

The census that sorted the rename facts' unprovable bindings on 2026-11-24 was a temporary test. It is now
SemanticModelCensusTest, a heavy test (-PlspTests=heavy or all): it compiles the 22 modules of the
repository's 21 libraries from source in build order, each against the ones before it, as a workspace that
holds the repository does, and sorts every binding that a proof cannot prove by the construct that wrote it:
an occurrence without a symbol (unbound), or one bound through an identity that no declaration or artifact
proves (unproven), as XdkRename's comparison judges them. No compiling construct is known to leave a name
unbound since #802, so an unbound occurrence fails the test with its examples; the unproven bindings are
counted, by construct and by library with examples, in lang/lsp-server/build/semantic-model-census.txt, and
summarized in the output's lines that start with census.

On errs at 4a9709c: 0 unbound, 138 unproven (80 occurrences, 58 calls), the count remaining.md gives.
By construct: a formal type's child, as Element in CompileType.Element, 42 (Element 23, Key 8, Value 7,
OuterType 3, ParentInput 1); the call of an anonymous class's constructor, new Iterator() {...}, 39; a call
whose site keeps its receiver's route (a union receiver's or a recursive one), 19 sites, each a name and a
call (appendTo 15, estimateStringLength 3, toString 1); this in an anonymous class 17; this.Map naming an
anonymous class 1; httpMethod of a union receiver 1. By library: ecstasy 76, json 29, xml 11, net 8, jsondb 7,
collections 6, xenia 1.

Validated: the census itself, run alone with -PlspTests=heavy, --rerun --no-build-cache, 1 test, 0 skipped,
0 failures, from fresh JUnit XML.
lagergren added a commit that referenced this pull request Nov 26, 2026
…ee commits out, 501 and 502 placed

#808 merged as fb7ba82 on 2026-11-26, after Gene's #809, and #693 was rebased onto it without its commits 481-483,
whose net change #808 is; the #802 review round came on top. squash-693.md now covers #693's 502 commits at
4a746eb:
- 481-483 are gone from the appendix, the mixed commits and P13's groups; 484-503 are 481-500, every hash is #693's
  new one, matched by position with the subjects checked.
- 501, lang's opt-in detekt and CPD, is a P13 group of its own; its version pins go to X5, its tasks to L10.
- 502, #802's review round, joins 459 in P1's #802 group, and is a mixed commit (it touches the XDK's libraries).
- P1, P13, X5, L10 and the totals are counted again; the header and the open-PR line say #808 is merged.
The roadmap's GitHub line says the same, and errs-693-rebase-2026-11-26.tsv maps every old commit to its new one: 501
replayed, 3 dropped, 1 added.

Validated: the appendix runs 1-502 in order with #693's hashes, all 636 number-hash references agree with it, and the
topics' counts sum to 502.
lagergren added a commit that referenced this pull request Nov 26, 2026
…tion's arguments

With neither a shorthand declaration nor any constructor, the compiler generates a default constructor, which passes
the contribution's arguments, so #802 doesn't report them; the review asked whether it should. The new case shows
both halves: class Implicit extends Base(1) {} compiles without a diagnostic, and with Base(noSuchName) the name is
unresolvable (COMPILER-38) and the implicit super constructor call that it is in fails (COMPILER-103), not "unused"
(COMPILER-188), so the arguments are compiled.

Validated: ConstructorArgumentsTest, 9 tests, 0 failures; spotlessCheck passes.
lagergren added a commit that referenced this pull request Nov 27, 2026
…tion's arguments

With neither a shorthand declaration nor any constructor, the compiler generates a default constructor, which passes
the contribution's arguments, so #802 doesn't report them; the review asked whether it should. The new case shows
both halves: class Implicit extends Base(1) {} compiles without a diagnostic, and with Base(noSuchName) the name is
unresolvable (COMPILER-38) and the implicit super constructor call that it is in fails (COMPILER-103), not "unused"
(COMPILER-188), so the arguments are compiled.

Validated: ConstructorArgumentsTest, 9 tests, 0 failures; spotlessCheck passes.
lagergren added a commit that referenced this pull request Nov 27, 2026
… in its #802 group in squash-693.md

524 adds ConstructorArgumentsTest's case that a class with no constructor compiles and uses its contribution's
arguments, which answered the review's question on #802 (b94ab8f there). It joins 459 and 502 in P1's #802 group;
the header, the open-PR line and the roadmap say so, with #693's new head.

Validated: the appendix runs 1-524 in order with #693's hashes, and all 667 number-hash references agree with it.
lagergren added a commit that referenced this pull request Nov 27, 2026
…rged: 643 commits, #813's four dropped

#813 (the Gradle model's build-tree paths and run settings, and its reports written whole) merged to master as
ede5667, and errs and #693 were rebased onto it without its four commits, 407, 465, 470 and 613 (errs' 1fc3e5e,
1a19ceb, 298026b and d4cfbb8), whose combined change is ede5667's byte for byte. The plan follows: the
appendix runs 1-643 with #693's new hashes, every number-hash reference is renumbered and rehashed, the group "The
Gradle model: each source set's project path, xtcRun's and xtcTest's settings" (only those four) is gone, P9 and X4
lose four commits, one group and their 166 main and 186 test lines added, #802's commits are now 458, 499 and 521, and
#813 joins the merged PRs in the header and the note on open ones. The roadmap names the new head and master.

Validated: the four commits applied to the old base 4350e40 give exactly ede5667's five files; after the rebase,
#693's tree (5029fdc) and errs' tree are identical to their backed-up tips (backup/20261127-1930/...); the appendix
runs 1-643 in #693's order with its hashes, all 836 number-hash references agree with it, and the topic and pull request
counts match it.
lagergren added a commit that referenced this pull request Nov 27, 2026
…, with #802's commits

squash-693.md places 644 (COMPILER-188 and COMPILER-210 say plainly what is unused and what to do) in P1's "Unused
constructor arguments and defaults (open PR #802)", whose commits leave #693 when #802 merges, and names it with #802's
458, 499 and 521 in the header and the note on open PRs; the roadmap follows.

Validated: the appendix runs 1-644 with #693's hashes, all 837 number-hash references agree with it, and the topic and
pull request counts match it.
lagergren added a commit that referenced this pull request Nov 27, 2026
…errors suite, and record it

squash-693.md places 652 with #802's other commits in P1's "Unused constructor arguments and defaults", as a review
round of the open PR, and names it where the plan lists #802's commits; the group's note had kept the numbers of
#802's review round from before the rebase onto ede5667 (502 and 524, now 499 and 521). The roadmap follows.

Validated: on errs with the commit, CompilerErrorsTest, 5 tests, and ConstructorArgumentsTest, 4 tests, 0 failures,
0 skipped; the appendix runs 1-652 with #693's hashes, all 849 number-hash references agree with it, and the topic and
pull request counts match it.
lagergren added a commit that referenced this pull request Nov 28, 2026
…ich fails on an unbound occurrence

The census that sorted the rename facts' unprovable bindings on 2026-11-24 was a temporary test. It is now
SemanticModelCensusTest, a heavy test (-PlspTests=heavy or all): it compiles the 22 modules of the
repository's 21 libraries from source in build order, each against the ones before it, as a workspace that
holds the repository does, and sorts every binding that a proof cannot prove by the construct that wrote it:
an occurrence without a symbol (unbound), or one bound through an identity that no declaration or artifact
proves (unproven), as XdkRename's comparison judges them. No compiling construct is known to leave a name
unbound since #802, so an unbound occurrence fails the test with its examples; the unproven bindings are
counted, by construct and by library with examples, in lang/lsp-server/build/semantic-model-census.txt, and
summarized in the output's lines that start with census.

On errs at 4a9709c: 0 unbound, 138 unproven (80 occurrences, 58 calls), the count remaining.md gives.
By construct: a formal type's child, as Element in CompileType.Element, 42 (Element 23, Key 8, Value 7,
OuterType 3, ParentInput 1); the call of an anonymous class's constructor, new Iterator() {...}, 39; a call
whose site keeps its receiver's route (a union receiver's or a recursive one), 19 sites, each a name and a
call (appendTo 15, estimateStringLength 3, toString 1); this in an anonymous class 17; this.Map naming an
anonymous class 1; httpMethod of a union receiver 1. By library: ecstasy 76, json 29, xml 11, net 8, jsondb 7,
collections 6, xenia 1.

Validated: the census itself, run alone with -PlspTests=heavy, --rerun --no-build-cache, 1 test, 0 skipped,
0 failures, from fresh JUnit XML.
lagergren added a commit that referenced this pull request Nov 28, 2026
…tion's arguments

With neither a shorthand declaration nor any constructor, the compiler generates a default constructor, which passes
the contribution's arguments, so #802 doesn't report them; the review asked whether it should. The new case shows
both halves: class Implicit extends Base(1) {} compiles without a diagnostic, and with Base(noSuchName) the name is
unresolvable (COMPILER-38) and the implicit super constructor call that it is in fails (COMPILER-103), not "unused"
(COMPILER-188), so the arguments are compiled.

Validated: ConstructorArgumentsTest, 9 tests, 0 failures; spotlessCheck passes.
lagergren added a commit that referenced this pull request Nov 28, 2026
lagergren added a commit that referenced this pull request Nov 28, 2026
doc/errs/errs-693-pr-map-2026-11-25.tsv gives every commit of #693
(49b5f8a, 468 commits on master 535e80f) its position, subject,
the layers its paths touch, a proposed PR and notes. pr-roadmap.md's new
top section, "#693 commit -> PR map - 2026-11-25", gives the units in
merge order with their commits, files, lines, test share, dependencies
and status, what each holds and what review should watch, the 51
commits that need splitting, the steps to squash or leave out, and what
is not for master. Nothing after 2026-10-16 had been mapped before.

How the units were decided: what master's own code must accept comes
first, the javatools compiler, runtime, debugger and embedding API (units
1-9; 2-4 are the earlier #685-successor, semantic facts and partial
analysis units, the breaking API of 0.5.0), then the Gradle plugin's
pieces as small PRs (10-14), the lang build (15), and the product last
(16-29): commit 8, the whole product in one commit, split by component,
later commits by feature area, tours and docs at the end. A commit's
files go to units by path; one whose files fall in several units is a
split, proposed for the unit of its main part.

Counts: 29 units plus "not for master" (41, 68, 118, 405). Already on
master: 405 (#800). Open: 460 (#802) and 468 (#804), each its own unit.

doc/errs/errs-693-sync-2026-11-25.tsv records tonight's mirror,
positions 462-468, and the errs-only records 93c065e, db87170 and
60c4dcc that stayed on errs.

The header line, "Current review branches and merge order" and "Existing
PRs" now give the 2026-11-25 state: the 2026-10-09 branches are stale,
#685's contracts come first, and the PRs from gh.

Checked by script: the map has 468 rows in #693's order, each commit
once, its hashes and subjects equal to git log's; every commit has
exactly one proposed PR, and the units' commit lists cover all 468;
files and lines per unit are summed from git log --numstat; supersede
notes come from deleted files traced to the commits that added them;
the sync record's positions and subjects match #693 and its errs commits
exist. Limits: no unit was built or tested on its own, and the line
counts are churn over each unit's commits, not its net diff.
lagergren added a commit that referenced this pull request Nov 28, 2026
…he 29-unit map it replaces

squash-693.md planned #693's first 397 commits (2026-11-23); the 2026-11-25 rebase gave them new hashes and 77
commits came after. A second plan, the 29-unit map in pr-roadmap.md with its per-commit table, was made that day
without it. squash-693.md is now the plan:
- commits 1-397 keep their numbers, topics, groups and PRs, with the rebase's hashes;
- 398-474 are placed by the plan's rules: each in a topic and a group (17 new groups, the rest join existing
  ones), divided at lang/ into its topic's xvm and lang PR, 28 of them listed as mixed commits to divide by path;
  459 (#802) and 467, 471, 473, 474 (#804) are already open on master and leave #693 when those merge;
- the PR and topic tables, each topic's counts and added lines, and the appendix include them;
- the 29-unit map's review notes that the plan lacked (0.5.0 as the boundary of X1-X3's breaking API, X1 as one
  PR, the stale compiler snapshot branches, X4's debugger assembled by path, X5's maintainer go-ahead, L6 on
  0.30.1 with tagged workarounds) are its new Notes for review.

pr-roadmap.md's map section now points to squash-693.md, and errs-693-pr-map-2026-11-25.tsv is gone; the
rebase's old and new positions stay in errs-693-rebase-2026-11-25.tsv. The roadmap's open-PR line names the
current positions: #802 is commit 459, #804 commits 467, 471, 473 and 474.

Checked: the appendix lists exactly #693's 474 commits at ab5521d, in order, each with an xvm or lang PR;
every commit is in exactly one topic group but the 60 the plan keeps alone, as before; no pre-rebase hash is
left; every table row has its table's column count; nothing else linked the removed table.
lagergren added a commit that referenced this pull request Nov 28, 2026
… its four commits, and place commit 480

#804 merged to master as 2e26663. #693 was rebased onto it without #804's four commits (467, 471, 473 and 474
then), which gave every commit a new hash and moved the sixteen after 467 up. The plan follows:
- every commit's number and hash, in the groups, the findings, the mixed commits and the appendix;
- #804's group and its four rows are gone, and P9's counts and lines no longer hold them (328 lines);
- the notes that name commits after 467 (the model export, the Javadoc fix) take their new numbers;
- the header and the PR note say that #804 merged and #802 is still open;
- commit 480, the user guide's boxed screenshots, joins the user guide group.
pr-roadmap.md names the new head and master and says #804 merged.

Checked: the appendix lists exactly #693's 480 commits on 2e26663, in order, each with a PR; every commit is in
one group but the plan's stand-alone ones; no hash from before the rebase is left; every table row has its table's
column count.
lagergren added a commit that referenced this pull request Nov 28, 2026
…ich fails on an unbound occurrence

The census that sorted the rename facts' unprovable bindings on 2026-11-24 was a temporary test. It is now
SemanticModelCensusTest, a heavy test (-PlspTests=heavy or all): it compiles the 22 modules of the
repository's 21 libraries from source in build order, each against the ones before it, as a workspace that
holds the repository does, and sorts every binding that a proof cannot prove by the construct that wrote it:
an occurrence without a symbol (unbound), or one bound through an identity that no declaration or artifact
proves (unproven), as XdkRename's comparison judges them. No compiling construct is known to leave a name
unbound since #802, so an unbound occurrence fails the test with its examples; the unproven bindings are
counted, by construct and by library with examples, in lang/lsp-server/build/semantic-model-census.txt, and
summarized in the output's lines that start with census.

On errs at 4a9709c: 0 unbound, 138 unproven (80 occurrences, 58 calls), the count remaining.md gives.
By construct: a formal type's child, as Element in CompileType.Element, 42 (Element 23, Key 8, Value 7,
OuterType 3, ParentInput 1); the call of an anonymous class's constructor, new Iterator() {...}, 39; a call
whose site keeps its receiver's route (a union receiver's or a recursive one), 19 sites, each a name and a
call (appendTo 15, estimateStringLength 3, toString 1); this in an anonymous class 17; this.Map naming an
anonymous class 1; httpMethod of a union receiver 1. By library: ecstasy 76, json 29, xml 11, net 8, jsondb 7,
collections 6, xenia 1.

Validated: the census itself, run alone with -PlspTests=heavy, --rerun --no-build-cache, 1 test, 0 skipped,
0 failures, from fresh JUnit XML.
lagergren added a commit that referenced this pull request Nov 28, 2026
…ee commits out, 501 and 502 placed

#808 merged as fb7ba82 on 2026-11-26, after Gene's #809, and #693 was rebased onto it without its commits 481-483,
whose net change #808 is; the #802 review round came on top. squash-693.md now covers #693's 502 commits at
4a746eb:
- 481-483 are gone from the appendix, the mixed commits and P13's groups; 484-503 are 481-500, every hash is #693's
  new one, matched by position with the subjects checked.
- 501, lang's opt-in detekt and CPD, is a P13 group of its own; its version pins go to X5, its tasks to L10.
- 502, #802's review round, joins 459 in P1's #802 group, and is a mixed commit (it touches the XDK's libraries).
- P1, P13, X5, L10 and the totals are counted again; the header and the open-PR line say #808 is merged.
The roadmap's GitHub line says the same, and errs-693-rebase-2026-11-26.tsv maps every old commit to its new one: 501
replayed, 3 dropped, 1 added.

Validated: the appendix runs 1-502 in order with #693's hashes, all 636 number-hash references agree with it, and the
topics' counts sum to 502.
lagergren added a commit that referenced this pull request Nov 28, 2026
…tion's arguments

With neither a shorthand declaration nor any constructor, the compiler generates a default constructor, which passes
the contribution's arguments, so #802 doesn't report them; the review asked whether it should. The new case shows
both halves: class Implicit extends Base(1) {} compiles without a diagnostic, and with Base(noSuchName) the name is
unresolvable (COMPILER-38) and the implicit super constructor call that it is in fails (COMPILER-103), not "unused"
(COMPILER-188), so the arguments are compiled.

Validated: ConstructorArgumentsTest, 9 tests, 0 failures; spotlessCheck passes.
lagergren added a commit that referenced this pull request Nov 28, 2026
… in its #802 group in squash-693.md

524 adds ConstructorArgumentsTest's case that a class with no constructor compiles and uses its contribution's
arguments, which answered the review's question on #802 (b94ab8f there). It joins 459 and 502 in P1's #802 group;
the header, the open-PR line and the roadmap say so, with #693's new head.

Validated: the appendix runs 1-524 in order with #693's hashes, and all 667 number-hash references agree with it.
lagergren added a commit that referenced this pull request Nov 28, 2026
…rged: 643 commits, #813's four dropped

#813 (the Gradle model's build-tree paths and run settings, and its reports written whole) merged to master as
ede5667, and errs and #693 were rebased onto it without its four commits, 407, 465, 470 and 613 (errs' 1fc3e5e,
1a19ceb, 298026b and d4cfbb8), whose combined change is ede5667's byte for byte. The plan follows: the
appendix runs 1-643 with #693's new hashes, every number-hash reference is renumbered and rehashed, the group "The
Gradle model: each source set's project path, xtcRun's and xtcTest's settings" (only those four) is gone, P9 and X4
lose four commits, one group and their 166 main and 186 test lines added, #802's commits are now 458, 499 and 521, and
#813 joins the merged PRs in the header and the note on open ones. The roadmap names the new head and master.

Validated: the four commits applied to the old base 4350e40 give exactly ede5667's five files; after the rebase,
#693's tree (5029fdc) and errs' tree are identical to their backed-up tips (backup/20261127-1930/...); the appendix
runs 1-643 in #693's order with its hashes, all 836 number-hash references agree with it, and the topic and pull request
counts match it.
lagergren added a commit that referenced this pull request Nov 28, 2026
…, with #802's commits

squash-693.md places 644 (COMPILER-188 and COMPILER-210 say plainly what is unused and what to do) in P1's "Unused
constructor arguments and defaults (open PR #802)", whose commits leave #693 when #802 merges, and names it with #802's
458, 499 and 521 in the header and the note on open PRs; the roadmap follows.

Validated: the appendix runs 1-644 with #693's hashes, all 837 number-hash references agree with it, and the topic and
pull request counts match it.
lagergren added a commit that referenced this pull request Nov 28, 2026
…errors suite, and record it

squash-693.md places 652 with #802's other commits in P1's "Unused constructor arguments and defaults", as a review
round of the open PR, and names it where the plan lists #802's commits; the group's note had kept the numbers of
#802's review round from before the rebase onto ede5667 (502 and 524, now 499 and 521). The roadmap follows.

Validated: on errs with the commit, CompilerErrorsTest, 5 tests, and ConstructorArgumentsTest, 4 tests, 0 failures,
0 skipped; the appendix runs 1-652 with #693's hashes, all 849 number-hash references agree with it, and the topic and
pull request counts match it.
@cpurdy

cpurdy commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator

Finished a review with Gene this morning. It took a while, but we dramatically simplified the fix, and improved the error messages. He's just wrapping up the work this morning.

lagergren and others added 7 commits November 30, 2026 13:05
A class's extends and incorporates arguments, and the default values in its shorthand constructor declaration,
reach the compiled class only through the synthetic constructor that the declaration implies. Where explicit
constructors take its place, the compiler ignored them, unchecked:
class C extends Base(noSuchName) { construct(Int n) { construct Base(n); } } compiled without an error.

- COMPILER-188 reported unused contribution arguments only beside an explicit default or shorthand constructor.
  It now reports them whenever no synthetic constructor passes them: beside an explicit shorthand constructor, or
  beside the explicit constructors of a class without a shorthand declaration.
- New COMPILER-210 reports a shorthand parameter's default value when an explicit constructor replaces the
  shorthand one and the class declares the property itself, so that neither takes the value. Where the class does
  not declare the property, the default still initializes the property that the declaration implies.

Removes the code that the checks find in the XDK, none of which ran: the extends arguments of OrderedMapSet,
JsonLogStoreBase, JsonProcessorStore, KeyCredential and the native OSFileChannel, whose constructors construct
their super classes themselves, and the shorthand defaults of ConsoleAppender, Instruction and PseudoRandom, whose
explicit constructors declare the same defaults. No behavior changes.

The language server's semantic model found them: it left the names in such arguments without a binding, and
refused a rename that they spelled, such as of OrderedMapSet.contents.

Validated: ConstructorArgumentsTest (unused extends arguments beside an explicit constructor, a shorthand default
that an explicit constructor replaces, and the arguments and defaults that a synthetic constructor or a property
uses, which still compile); its first two cases fail without the compiler change. ./gradlew build: the XDK,
javatools_bridge and manualTests compile, javatools' tests (387, 0 failures, 42 skipped, all disabled or
platform-specific) and the XDK's testXtc tasks pass; spotlessCheck passes and leaves the tree as committed.
…plicit constructor

Gene and Cam's review: redundant information that matches is allowed. COMPILER-188 and COMPILER-210 now report only
what differs from the explicit constructor that takes the synthetic constructor's place, and the shorthand defaults
of ConsoleAppender, PseudoRandom and xml's Instruction, which match their constructors' defaults, are back.

- A shorthand default matches when the explicit shorthand constructor's parameter at the same position has a default
  value and both compile to the same constant, so 0x10 matches 16. The check moves to generateCode, where the
  explicit constructor's default values are compiled. COMPILER-210's constant is now
  CONSTRUCTOR_PARAM_DEFAULT_MISMATCH, and both messages say that the value or arguments differ.
- Contribution arguments match when the explicit shorthand constructor, or without a shorthand declaration the
  explicit default constructor, has exactly one construct statement for the contribution's type among the statements
  of its body, with as many arguments, and each pair is the same parameter (the shorthand parameter and the
  constructor parameter at the same position), the same literal, or the same name that is a parameter in neither,
  such as a constant. A class with neither constructor has nothing to match, so the extends arguments removed from
  JsonLogStoreBase, JsonProcessorStore, KeyCredential, OrderedMapSet and OSFileChannel stay removed: their names look
  like constructor parameters, but name none.
- fExplicitDefault, which after the first version only the ambiguity check used, becomes constructorExplicit: the
  explicit shorthand or default constructor, which the argument check compares with.
- Cam asked whether the argument check should report even with no constructors. It should not: a class with neither
  a shorthand declaration nor a constructor gets a synthetic default constructor, which passes the arguments, as in
  class Implicit extends Base(1) {}, so reporting them would reject working code. The comment says so now.
- The check failed with a NullPointerException on an enum value with an explicit constructor, as an enum value has
  no compositions. Master fails so on one with an explicit default constructor, and the first version widened it to
  any explicit constructor. Enum values are now skipped.

Validated: ConstructorArgumentsTest, 8 cases. On the first version's logic, with only the constant renamed, the two
matching cases fail with 4 COMPILER-210 and 4 COMPILER-188 reports; with checks that allow everything, the four
reporting cases fail; without the enum value guard, the enum case fails with the internal error. xdk:installDist
--rerun-tasks compiles the libraries with the restored sites and logs no warning; :javatools:test, from fresh XML,
392 tests, 0 failures, 42 skipped, all disabled or platform-specific; :javatools:javadoc and spotlessCheck pass.

Limits: arguments are compared as written, so an assignment to a parameter before the construct statement is not
considered, and an expression such as x + 1 never matches, even where the constructor passes the same one.
…tion's arguments

With neither a shorthand declaration nor any constructor, the compiler generates a default constructor, which passes
the contribution's arguments, so #802 doesn't report them; the review asked whether it should. The new case shows
both halves: class Implicit extends Base(1) {} compiles without a diagnostic, and with Base(noSuchName) the name is
unresolvable (COMPILER-38) and the implicit super constructor call that it is in fails (COMPILER-103), not "unused"
(COMPILER-188), so the arguments are compiled.

Validated: ConstructorArgumentsTest, 9 tests, 0 failures; spotlessCheck passes.
…R-210

The two messages explained the compiler's reasoning ("unused because an explicit constructor is present, and they
differ from the arguments that it passes"; "unused because an explicit constructor replaces the shorthand one, and the
class declares the property itself; it differs from ...") and left the developer to work out the fix. As Cam said in
the review, they confused more than they helped. Each now says what is never used, why in one clause, and the two ways
to fix it: COMPILER-188 that the contribution's arguments are never used because an explicit constructor constructs the
contribution itself with other arguments, so remove them or pass the same ones there; COMPILER-210 that the parameter's
default is never used because an explicit constructor replaces the shorthand one with another default, so remove it or
give the parameter the same one there. The conditions under which each is reported do not change.

Validated: ConstructorArgumentsTest, 9 tests, 0 failures (they check the codes, not the text); spotlessCheck passes.
…rors suite

Gene's review: the cases that must not compile belong with the other negative compiler tests. They are now two
modules in xdk/src/test/resources/compiler-errors, which CompilerErrorsTest checks for exactly the marked errors by
line and code. The suite compiles each file as one module, and the compiler stops after a stage that reported errors,
so the cases are split by the stage that reports them:

- contributionArguments.x, reported while names are resolved: the six COMPILER-188 cases (arguments that name
  nothing, the shape of jsondb's JsonLogStoreBase, another parameter, another literal, a parameter only of the
  explicit constructor, an expression) and the enum value with explicit constructors, whose only error is COMPILER-62.
- constructorDefaults.x, reported while code is generated: the two COMPILER-210 cases (another default value, none)
  and the class without constructors whose argument names nothing (COMPILER-38 and COMPILER-103, not COMPILER-188).

ConstructorArgumentsTest keeps the four cases that must compile without a diagnostic, and its Javadoc points to the
two files.

Validated: CompilerErrorsTest, 5 tests (the four files and the valid module), 0 failures, 0 skipped;
ConstructorArgumentsTest, 4 tests, 0 failures; spotlessCheck passes.
@ggleyzer

Copy link
Copy Markdown
Collaborator

I took a liberty of pushing my changes (after review w/ Cam) on top of the original

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants