Skip to content

Revert "Report error when @Initializer is used on a constructor (#1546)" - #1588

Merged
msridhar merged 1 commit into
masterfrom
undo-initializer-on-constructor-warning
Jun 3, 2026
Merged

msridhar merged 1 commit into
masterfrom
undo-initializer-on-constructor-warning

Conversation

@msridhar

@msridhar msridhar commented Jun 3, 2026 •

Copy link
Copy Markdown
Collaborator

This reverts commit 661f374.

It turns out there are valid scenarios for @Autowired to be written on a constructor (to disambiguate when multiple constructors are present). In general, we don't know what other purposes custom initializer annotations are being used for, beyond initialization semantics. So, let's not warn when they are used on constructors.

@msridhar

msridhar commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator Author

This change is part of the following stack:

Change managed by git-spice.

@coderabbitai

coderabbitai Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR removes a validation check in the matchMethod function that previously reported an ANNOTATION_VALUE_INVALID error when a constructor was annotated with a configured initializer annotation. With this validation deleted, initializer-annotated constructors now proceed through normal handler invocation and overriding-consistency logic. The corresponding test case that validated this error behavior was also removed.

Possibly related PRs

  • uber/NullAway#1546: Introduced the initializer annotation constructor validation that this PR removes, and would need to be reverted or reconciled if both PRs are active.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately describes the main change: reverting a specific commit that added error reporting for @Initializer on constructors.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch undo-initializer-on-constructor-warning

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@msridhar
msridhar requested review from seemantasaha and yuxincs June 3, 2026 00:54
@msridhar
msridhar enabled auto-merge (squash) June 3, 2026 00:54
@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.12%. Comparing base (ec978b9) to head (5a1362d).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1588      +/-   ##
============================================
- Coverage     88.12%   88.12%   -0.01%     
+ Complexity     3003     3001       -2     
============================================
  Files           105      105              
  Lines          9956     9952       -4     
  Branches       2022     2021       -1     
============================================
- Hits           8774     8770       -4     
  Misses          565      565              
  Partials        617      617              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@msridhar
msridhar merged commit d9d0392 into master Jun 3, 2026
12 of 14 checks passed
@msridhar
msridhar deleted the undo-initializer-on-constructor-warning branch June 3, 2026 01:06
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.

2 participants