Skip to content

NoOpImplementation improvements [2/3] Guard NoOp generation against restricted-visibility#3469

Merged
satween merged 1 commit into
developfrom
tvaleev/feature/guard-noop-generation-against-restricted
May 26, 2026
Merged

NoOpImplementation improvements [2/3] Guard NoOp generation against restricted-visibility#3469
satween merged 1 commit into
developfrom
tvaleev/feature/guard-noop-generation-against-restricted

Conversation

@satween
Copy link
Copy Markdown
Contributor

@satween satween commented May 22, 2026

What does this PR do?

Adds an isPrivateOrHasPrivateEnclosing() check that walks the enclosing-class
chain and skips NoOp generation when any class in the chain has private or
protected visibility, preventing the emission of uncompilable code.

Motivation

Without this guard, the NoOp generator introduced in the previous PR would
attempt to implement nested interfaces that are not accessible from outside the
enclosing type, causing compilation errors.

Additional Notes

Extends the test matrix with all 12 outer × inner visibility combinations:
public/internal outer × public/internal inner → generation expected;
public/internal outer × private/protected inner → generation skipped;
private outer × any inner visibility → generation skipped.

Stacked on "Add NoOp generation support for nested interfaces".

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

Copy link
Copy Markdown
Contributor Author

satween commented May 22, 2026

@datadog-datadog-prod-us1

This comment has been minimized.

@satween satween changed the title Guard NoOp generation against restricted-visibility nested interfaces NoOpImplementation improvements [2/2] Guard NoOp generation against restricted-visibility May 22, 2026
@satween satween force-pushed the tvaleev/feature/guard-noop-generation-against-restricted branch 3 times, most recently from f61ae7b to aa3d9ad Compare May 22, 2026 19:41
@satween satween marked this pull request as ready for review May 22, 2026 19:41
@satween satween requested review from a team as code owners May 22, 2026 19:41
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.24%. Comparing base (69dcbcd) to head (9309cd7).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3469      +/-   ##
===========================================
+ Coverage    72.16%   72.24%   +0.08%     
===========================================
  Files          964      964              
  Lines        35554    35554              
  Branches      5922     5922              
===========================================
+ Hits         25654    25684      +30     
+ Misses        8282     8262      -20     
+ Partials      1618     1608      -10     

see 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

kikoveiga
kikoveiga previously approved these changes May 25, 2026
hamorillo
hamorillo previously approved these changes May 25, 2026
Copy link
Copy Markdown
Contributor

@hamorillo hamorillo left a comment

Choose a reason for hiding this comment

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

🚀

Base automatically changed from tvaleev/feature/add-noop-generation-support-for-nested to develop May 25, 2026 12:52
@satween satween dismissed stale reviews from hamorillo and kikoveiga May 25, 2026 12:52

The base branch was changed.

Adds an `isPrivateOrHasPrivateEnclosing()` check that walks the enclosing-class
chain and skips NoOp generation when any class in the chain has private or
protected visibility, preventing the emission of uncompilable code.

Without this guard, the NoOp generator introduced in the previous PR would
attempt to implement nested interfaces that are not accessible from outside the
enclosing type, causing compilation errors.

Extends the test matrix with all 12 outer × inner visibility combinations:
`public`/`internal` outer × `public`/`internal` inner → generation expected;
`public`/`internal` outer × `private`/`protected` inner → generation skipped;
`private` outer × any inner visibility → generation skipped.

Stacked on "Add NoOp generation support for nested interfaces".

- [ ] Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
- [ ] Make sure you discussed the feature or bugfix with the maintaining team in an Issue
- [ ] Make sure each commit and the PR mention the Issue number (cf the [CONTRIBUTING](../CONTRIBUTING.md) doc)
@satween satween force-pushed the tvaleev/feature/guard-noop-generation-against-restricted branch from aa3d9ad to 9309cd7 Compare May 25, 2026 15:20
@satween satween changed the title NoOpImplementation improvements [2/2] Guard NoOp generation against restricted-visibility NoOpImplementation improvements [2/3] Guard NoOp generation against restricted-visibility May 25, 2026
Comment thread .editorconfig
# NoOp test fixtures use compound filenames (OuterVisibilityOuterInnerVisibilityInner.kt)
# to distinguish visibility combinations; the top-level class name stays short on purpose.
[tools/noopfactory/src/test/resources/**/*.kt]
ktlint_standard_filename = disabled No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
ktlint_standard_filename = disabled
ktlint_standard_filename = disabled

@satween satween merged commit 00897b2 into develop May 26, 2026
28 checks passed
@satween satween deleted the tvaleev/feature/guard-noop-generation-against-restricted branch May 26, 2026 09:56
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.

5 participants