Skip to content
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

Fix ErrorProne warnings in :file-collections and :input-tracking #28887

Merged
merged 4 commits into from May 4, 2024

Conversation

mlopatkin
Copy link
Member

Reviewing cheatsheet

Before merging the PR, comments starting with

  • ❌ ❓must be fixed
  • 🤔 💅 should be fixed
  • 💭 may be fixed
  • 🎉 celebrate happy things

@mlopatkin mlopatkin added the a:chore Minor issue without significant impact label Apr 19, 2024
@mlopatkin mlopatkin added this to the 8.9 RC1 milestone Apr 19, 2024
@mlopatkin mlopatkin self-assigned this Apr 19, 2024
@mlopatkin
Copy link
Member Author

@bot-gradle test QFL without PTS

@bot-gradle
Copy link
Collaborator

I've triggered the following builds with parameters: -DenablePredictiveTestSelection=false for you. Click here to see all build failures.

@mlopatkin mlopatkin marked this pull request as ready for review April 19, 2024 16:51
@mlopatkin mlopatkin requested a review from a team as a code owner April 19, 2024 16:51
@mlopatkin mlopatkin requested review from bamboo and abstratt and removed request for a team April 19, 2024 16:51
@@ -35,6 +35,7 @@ public abstract class LazilyInitializedFileCollection extends CompositeFileColle
* @deprecated Use the overload accepting the TaskDependencyFactory
*/
@Deprecated
@SuppressWarnings("InlineMeSuggester")
Copy link
Member Author

Choose a reason for hiding this comment

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

💭 The offending plugin has been fixed, so we can remove the usage in 9.0

@@ -185,7 +185,7 @@ public void replaceAll(BiFunction<? super Object, ? super Object, ?> function) {
}

@Override
public Object putIfAbsent(Object key, Object value) {
public synchronized Object putIfAbsent(Object key, Object value) {
Object oldValue;
synchronized (delegate) {
Copy link
Member

Choose a reason for hiding this comment

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

🤔 Since delegate is also a Properties instance (thus synchronized) and we're now synchronizing this Properties instance, what's the point of synchronized (delegate) here?

Copy link
Member Author

Choose a reason for hiding this comment

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

🤔 Since delegate is also a Properties instance (thus synchronized) and we're now synchronizing this Properties instance, what's the point of synchronized (delegate) here?

Well, making these methods synchronized doesn't change much in this regard. I guess, I was either over-defensive when writing these methods and didn't look if the method is synchronized or not, or this is a leftover of some earlier code state when there were some extra steps in the synchronized block.

TBH, the synchronization contract is still broken for system properties, because user code gets a new Properties instance every time. I'd rather replace this fix with a class-level suppression and address synchronizations concerns separately.

@mlopatkin
Copy link
Member Author

@bot-gradle test this

@bot-gradle
Copy link
Collaborator

I've triggered the following builds for you. Click here to see all build failures.

@mlopatkin mlopatkin added this pull request to the merge queue May 4, 2024
Merged via the queue into master with commit 73b46a8 May 4, 2024
54 of 56 checks passed
@mlopatkin mlopatkin deleted the ml/errorprone-file-collections-input-tracking branch May 4, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 min review a:chore Minor issue without significant impact build-script-change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants