Repository navigation
Conversation
Introduce source sites, collecting listeners, named budgets and silence reasons while preserving branch and merge behavior. Keep null and ambient ownership policy for later slices; document the planned 0.5.0 source and binary break.
Reject missing diagnostic destinations at compiler, parser, launcher, embedding and ModuleCompiler boundaries. Replace implicit blackholes with named probe, cascade and discard policies, and migrate reporting sites to source-aware severity helpers. Keep current ModuleCompiler stage-error handling and compiler behavior while applying the listener contract. Preserve ambient file/pool ownership for the later ownership slice. Document the 0.5.0 compatibility boundary and cover listener rejection before compilation or file access.
|
I don't think we can start looking into this until #680 is resolved |
This is stacked on top of 680, because I wanted to show why it is there. Hence it will not go in until 680 is in place. |
|
Agreed about the landing order. This PR shows how the contract is used throughout the compiler; it is not intended to bypass the discussion on #680. The essential requirement is that an IDE compilation keeps its diagnostic destination and abort policy through nested validation and speculative work. Suppressing speculative diagnostics must not accidentally disconnect the host's cancellation request, and callbacks must not retain a listener from a completed request. Those requirements remain whichever return type we settle on for |
|
Superseded by #685. The explicit-listener migration, named suppression, documentation and follow-up corrections are retained there alongside the host APIs and direct compiler-consumer tests that demonstrate their use. Please continue review on #685; its description links the detailed README and explains the later AST, partial-analysis and LSP work. Closing this split review without deleting its branch or review history. #683 and #684 remain separate prerequisites. |
Summary
This is the one large change to the existing javatools compiler, that is required for LSP support. It is shallow and horizontal, and not that complicated even though it touches a few files. This disentangles diagnostics from other error listener usages, and makes sure that a single error listener can be threaded through all the way through the code pipeline from an API consumer.
Why?
Please start with the README's compiler diagnostics and error-listener guide. It explains the original failure modes, the design and alternatives, a tour through the changed code, concrete usage examples, migration requirements and reproducible regression evidence. In particular, see why this is a prerequisite, ordinary-compilation compatibility, and the executable regressions.
The overall error-listener redesign represents roughly a person-month of careful development, investigation, API design and regression testing. This PR extracts the listener-ownership migration from that work; it is not a new experiment in reporting syntax. The implementation has already been exercised by the working compiler-backed adapter, and this standalone branch is also tested independently of that adapter.
Dependency: #680; merge that foundation first. This PR targets protected
masterso required reviews and CI checks apply. Until #680 lands, the Files changed tab includes its prerequisite changes. Review the ownership migration separately in this incremental comparison. After #680 lands, refresh this branch to remove the inherited foundation from the PR diff.How?
Why named silence and stable ownership matter
silent(PROBE)means that the work is a speculative fit check whose reports are intentionally unwanted.CASCADEidentifies follow-on reports suppressed after an incomplete result;DISCARDidentifies an explicitly unwanted output stream. The oldBLACKHOLEname did not explain which policy the caller intended or whether its parent's stop request had to survive. Deriving silence from the operation listener preserves that stop policy. Standalone stateless sinks are shared and reused locally where that improves readability; stateful buffers and operation-specific wrappers remain separate.Likewise, a final, required listener at an active boundary gives the operation a stable destination. An omitted listener now fails immediately instead of silently becoming a successful-looking choice to discard diagnostics. Deliberate silence remains supported by passing it explicitly. This is a contract for the active boundaries migrated here, not a claim that every listener-valued field everywhere is non-null: the README identifies the remaining ambient file/pool and parser/resolver paths handled by later changes.
The two same-source lexer regressions in the README demonstrate why the underlying contract matters: an ordinary host branch previously imposed an unsolicited one-error limit, and an existing branch could ignore its parent's later abort request. Those behavioral repairs originate in #680; this PR carries their executable evidence and migrates the callers and ownership boundaries that build on the contract. The required-listener tests additionally verify deliberate API decisions rather than pretending every signature change is itself a reproduced old bug.
Why this needs to land
Reliable report delivery, stable ownership and preserved abort policy are necessary for the compiler-backed LSP. A callback added only at the outer embedding entry point cannot repair reports discarded deeper in the compiler. Landing this migration allows the scoped-reporting, structure-reporting and richer compilation-result work to follow without layering more compensating behavior into the adapter.
Please prioritize review of diagnostic correctness, suppression semantics, stopping policy and compatibility. Substantive defects should block merging. Equivalent helper naming, presentation preferences and optional refactorings can be addressed afterward without holding up the required ownership foundation. The exact names are design choices; the delivery and lifetime guarantees are the part the adapter requires.
Implications
BLACKHOLE/BlackholeErrorListener, requires listeners at the migrated boundaries, removes the silentResolutionCollectordefault and removes the unnecessaryExpression.testFitAsTypelistener parameter. [LSP] Separate diagnostic reporting from listener abort policy (C1) #680 changeslogtovoidand replaces severity-triggered runtime-listener exceptions with abort state. These deliberate API changes also affect non-LSP Java consumers using those entry points; they cannot honestly be called 100% source/binary compatible.Changes
javatools/README.md: comprehensive rationale, practical code tour, ownership rules, migration table, regression evidence and precise boundaries of this PR.javatools/src/main/java/org/xvm/asm/ErrorListener.java: complete the named-suppression migration, remove legacy blackhole symbols, document nullability, and provide a standalone silence constructor while retaining an optional parent policy where meaningful.javatools/src/main/java/org/xvm/asm/ErrorList.java: document retention, branching and budgets; use the one authoritative default limit and preserve explicit caller budgets.javatools/src/main/java/org/xvm/asm/constants/TypeConstant.java: derive local cascade suppression without overwriting the operation's original reporting destination.javatools/src/main/java/org/xvm/compiler/Lexer.java: retain reporting/abort checkpoints while migrating source spans and enforcing the listener boundary.ErrorListenerBoundaryTest,ErrorListenerHostRegressionTest, migration/silence/budget tests and launcher regressions: exercise missing-listener rejection, destination retention, parent aborts, source attribution and CLI behavior.The incremental diff against #680 is 78 files, +1,711/−704 lines. The current full diff against
master, including the unmerged foundation, is 82 files, +2,599/−561 lines. The breadth follows the existing compiler reporting call graph; documentation, tests and listener API documentation account for a substantial portion of the additions. The production LSP and editor implementations are not included.Known follow-ups
Reporting.javais not introduced here.Verification
On this refreshed branch, with tests forced using
--rerun-tasks --no-build-cache:CompilerConsumerTest: one executed and passed, zero skips.git diff --check: passed.Counts were read from JUnit XML. The README separately records the earlier 24-module normalized-output comparison and the fail-before/pass-after host reproductions; that historical comparison is not presented as a new comparison of every rebuilt byte in this run.
Commands used for the refreshed branch
The test-name filter applies to the LSP test task; the Java test task ran its complete suite. Results are in
javatools/build/test-results/test/TEST-*.xmlandlang/lsp-server/build/test-results/test/TEST-*.xml.