-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for chance of class init deadlock with non-nested subclass #4429
Conversation
if (!isStatic(use)) { | ||
if (use.isEnclosedBy(classSymbol) && !isStatic(use)) { | ||
// Nested inner classes implicitly take the enclosing instance as a constructor parameter, | ||
// and can't be initialized without first initializing their containing class. | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the comment, it's clear the intention was to only match situations where the subclass is a non-static nested class of the superclass. But it's overly broad; any class that isn't a static inner class (since only inner classes can be marked static
) will be matched by the current conditional. First checking if the class is enclosed by the defining class makes the conditional true to the comment.
Thanks for catching this! |
This PR fixes a bug with the `ClassInitializationDeadlock` check to find chances for a class initialization deadlock when the subclass isn't nested within the superclass. This situation [can still produce a deadlock](https://gist.github.com/tkindy/a83ec86c95bb7d7119f6b208d239ea94). Fixes #4429 FUTURE_COPYBARA_INTEGRATE_REVIEW=#4429 from HubSpot:non-nested-class-init-deadlock c5cc883 PiperOrigin-RevId: 641925847
This MR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [com.google.errorprone:error_prone_core](https://errorprone.info) ([source](https://github.com/google/error-prone)) | | minor | `2.28.0` -> `2.29.2` | | [com.google.errorprone:error_prone_annotations](https://errorprone.info) ([source](https://github.com/google/error-prone)) | compile | minor | `2.28.0` -> `2.29.2` | --- ### Release Notes <details> <summary>google/error-prone</summary> ### [`v2.29.2`](https://github.com/google/error-prone/releases/tag/v2.29.2): Error Prone 2.29.2 [Compare Source](google/error-prone@v2.29.1...v2.29.2) This release contains all of the changes in [2.29.0](https://github.com/google/error-prone/releases/tag/v2.29.0) and [2.29.1](https://github.com/google/error-prone/releases/tag/v2.29.1), plus: - a bug fix for a crash in `TraditionalSwitchExpression` (google/error-prone#4479) - restores the `module-info` for the annotations jar, which was accidentally removed (google/error-prone#4480) Full Changelog: google/error-prone@v2.29.1...v2.29.2 ### [`v2.29.1`](https://github.com/google/error-prone/releases/tag/v2.29.1): Error Prone 2.29.1 [Compare Source](google/error-prone@v2.29.0...v2.29.1) This release contains all of the changes in [2.29.0](https://github.com/google/error-prone/releases/tag/v2.29.0), plus: - a bug fix to `UnusedVariable` to handle unnamed `_` variables (google/error-prone#4451) - a bug fix for a crash in `SetUnrecognized` (google/error-prone#4475) Full Changelog: google/error-prone@v2.29.0...v2.29.1 ### [`v2.29.0`](https://github.com/google/error-prone/releases/tag/v2.29.0): Error Prone 2.29.0 [Compare Source](google/error-prone@v2.28.0...v2.29.0) New checks: - [`MissingRuntimeRetention`](https://errorprone.info/bugpattern/MissingRuntimeRetention) - [`SetUnrecognized`](https://errorprone.info/bugpattern/SetUnrecognized) - [`StatementSwitchToExpressionSwitch`](https://errorprone.info/bugpattern/StatementSwitchToExpressionSwitch) Closed issues: [#​4318](google/error-prone#4318), [#​4429](google/error-prone#4429), [#​4467](google/error-prone#4467) Full Changelog: google/error-prone@v2.28.0...v2.29.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->
This PR fixes a bug with the
ClassInitializationDeadlock
check to find chances for a class initialization deadlock when the subclass isn't nested within the superclass. This situation can still produce a deadlock.