NoOpImplementation improvements [3/3] RUM-7390 Add NoOp name collision detection and customName support#3470
Open
satween wants to merge 2 commits into
Open
Conversation
Merged
3 tasks
Contributor
Author
3 tasks
This comment has been minimized.
This comment has been minimized.
NoOpImplementation improvements [3/3] RUM-7390 Add NoOp name collision detection and customName support
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2943d3a56
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Base automatically changed from
tvaleev/feature/guard-noop-generation-against-restricted
to
develop
May 26, 2026 09:56
b2943d3 to
86ce9a9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3470 +/- ##
===========================================
- Coverage 72.20% 72.18% -0.02%
===========================================
Files 964 964
Lines 35554 35554
Branches 5922 5922
===========================================
- Hits 25669 25663 -6
- Misses 8269 8282 +13
+ Partials 1616 1609 -7 🚀 New features to boost your workflow:
|
- Detect when two interfaces would generate the same NoOp class name and report a KSP error instead of silently overwriting the file. - Add customName parameter to @NoOpImplementation to let users resolve collisions by overriding the generated class name. - Support NoOp generation for nested interfaces; guard against interfaces with restricted (private/protected) enclosing visibility. - Fix NoSuchElementException caused by KSP2 omitting default annotation args from KSAnnotation.arguments (workaround via safeAnnotationArg; see google/ksp#2356). - Fix return-type and property initializer paths to use the effective NoOp name (respecting customName) when referencing other annotated interfaces, preventing compilation failures. - Extract annotation utilities into NoOpAnnotationExt.kt. Ref: RUM-7390
b06a347 to
d98a5c1
Compare
Remove needless double blank line caught by ktlint. Ref: RUM-7390
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.

What does this PR do?
Adds collision detection to the NoOp KSP processor and a new
customNameparameter to@NoOpImplementation. When two interfaces would generate the sameNoOp*class name (e.g.Outer.InnerandOuterInnerboth produceNoOpOuterInner), the processor now emits a clear error and suggests usingcustomNameto resolve the conflict. ThecustomNameparameter lets callers override the generated class name entirely.Motivation
Without collision detection, two distinct interfaces silently clobber each other's generated file, producing broken or incomplete NoOp implementations at build time with no diagnostic. The new guard catches this at KSP processing time with actionable error messages.
Additional Notes
customNameagainst a Kotlin identifier regex and reports a clear error for names like"My.Invalid.Name".generatedNamesmap) and pre-existing file conflicts (viaFileAlreadyExistsException).ThrowingCodeGeneratorProvidertest helper retained because KSP 1.8.0 does not throwFileAlreadyExistsExceptionfor disk files from previous builds; two-pass compilation silently overwrites.generateNoOpImplementationrefactored intoresolveNoOpClassName,reportNameCollision, andwriteNoOpFilehelpers to satisfy detektLongMethod/ReturnCountlimits.Review checklist (to be filled by reviewers)
Ref: RUM-7390