Conversation
…final round Replace the whole-file AST diagnostic checker from PR google#3200 with query-time error tracking at the KSP model boundary. 1. Record unresolved type references during KSTypeReference.resolve() in both syntax-backed (KSTypeReferenceImpl) and Analysis API-backed (KSTypeReferenceResolvedImpl) type references. 2. In the final processing round, re-verify recorded errors against the final Analysis API session to allow cross-round resolution of types generated by processors. 3. Report remaining unresolved references via logger.error(...) in the final round and unwrap synthetic Java annotation placeholder types to their underlying reference names.
…iagnostics Update expectations in unit tests that deliberately construct unresolved types to expect 'KSP FAILED WITH EXIT CODE: PROCESSING_ERROR' now that unresolved queried types fail the build in the final round. Also override testLocalAnnotationClass in PsiConfiguredUnitTestSuite to reflect that the legacy PSI engine does not perform final-round diagnostic verification.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces whole-file AST type checking from #3200 with query-time error tracking on
KSTypeReference.resolve(). Unrecovered errors are reported vialogger.error(...)in the final round to fail the build (matchingjavacfailure semantics), and synthetic Java annotation error types (__KSP_unresolved_*) are unwrapped to their original reference names.Motivation
PR #3200 introduced whole-file diagnostic checks (
file.collectDiagnostics()) on every round, which caused regressions:Conversely, KSP's historical behavior of silently ignoring unresolved queried types and exiting
0when processors did not explicitly log errors allowed broken builds to pass or fail downstream with obscure errors.Implementation
KSTypeReference.resolve()(KSTypeReferenceImplandKSTypeReferenceResolvedImpl) to record unresolved types only when actively queried by a processor.isStillError()) against the final Analysis API session. Types generated in later rounds resolve cleanly and are discarded.logger.error(...)in the final round beforeonError()/finish(), failing the build if unresolvable references remain.__KSP_unresolved_Injectare resolved to the underlyingPsiJavaCodeReferenceElementto reportUnresolved reference 'Inject'.KSP FAILED WITH EXIT CODE: PROCESSING_ERROR.Testing
All 652 tests in
:kotlin-analysis-api:testpass cleanly.