Skip to content

Commit

Permalink
Fix ErrorProne warnings in :file-collections and :input-tracking (#28887
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mlopatkin committed May 4, 2024
2 parents e966489 + f3fd5ab commit 73b46a8
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 22 deletions.
Expand Up @@ -4,13 +4,6 @@ plugins {

description = "Implementation of types that represent containers of files"

errorprone {
disabledChecks.addAll(
"HidingField", // 2 occurrences
"InlineMeSuggester", // 1 occurrences
)
}

dependencies {
api(projects.javaLanguageExtensions)
api(project(":base-services"))
Expand Down
Expand Up @@ -67,7 +67,6 @@ protected AbstractFileCollection(TaskDependencyFactory taskDependencyFactory) {
this(taskDependencyFactory, PatternSets.getNonCachingPatternSetFactory());
}

@SuppressWarnings("deprecation")
public AbstractFileCollection() {
this(DefaultTaskDependencyFactory.withNoAssociatedProject());
}
Expand Down
Expand Up @@ -36,11 +36,9 @@

public class FileCollectionBackedFileTree extends AbstractFileTree {
private final AbstractFileCollection collection;
private final TaskDependencyFactory taskDependencyFactory;

public FileCollectionBackedFileTree(TaskDependencyFactory taskDependencyFactory, Factory<PatternSet> patternSetFactory, AbstractFileCollection collection) {
super(taskDependencyFactory, patternSetFactory);
this.taskDependencyFactory = taskDependencyFactory;
this.collection = collection;
}

Expand Down
Expand Up @@ -35,6 +35,7 @@ public abstract class LazilyInitializedFileCollection extends CompositeFileColle
* @deprecated Use the overload accepting the TaskDependencyFactory
*/
@Deprecated
@SuppressWarnings("InlineMeSuggester")
public LazilyInitializedFileCollection() {
this(DefaultTaskDependencyFactory.withNoAssociatedProject());
}
Expand Down
Expand Up @@ -78,7 +78,7 @@ public void add(@Nullable Object element) {
return;
}
if (includeBuildable && (element instanceof Buildable || element instanceof TaskDependencyContainer)) {
visitor.accept(new BuildableElementFileCollection(element, resolver, patternSetFactory));
visitor.accept(new BuildableElementFileCollection(element, resolver, taskDependencyFactory, patternSetFactory));
return;
}

Expand Down Expand Up @@ -143,12 +143,11 @@ protected Set<File> getIntrinsicFiles() {
private static class BuildableElementFileCollection extends CompositeFileCollection {
private final Object element;
private final PathToFileResolver resolver;
private final Factory<PatternSet> patternSetFactory;

public BuildableElementFileCollection(Object element, PathToFileResolver resolver, Factory<PatternSet> patternSetFactory) {
public BuildableElementFileCollection(Object element, PathToFileResolver resolver, TaskDependencyFactory taskDependencyFactory, Factory<PatternSet> patternSetFactory) {
super(taskDependencyFactory, patternSetFactory);
this.element = element;
this.resolver = resolver;
this.patternSetFactory = patternSetFactory;
}

@Override
Expand Down
7 changes: 0 additions & 7 deletions platforms/core-configuration/input-tracking/build.gradle.kts
Expand Up @@ -4,13 +4,6 @@ plugins {

description = "Configuration input discovery code"

errorprone {
disabledChecks.addAll(
"HashtableContains",
"UnsynchronizedOverridesSynchronized", // 29 occurrences
)
}

dependencies {
api(libs.jsr305)
api(libs.guava)
Expand Down
Expand Up @@ -39,6 +39,8 @@
/**
* A wrapper for {@link Properties} that notifies a listener about accesses.
*/
@SuppressWarnings("UnsynchronizedOverridesSynchronized")
// TODO(mlopatkin) we need a better synchronization guarantees here. Just sprinkling synchronized won't help.
public class AccessTrackingProperties extends Properties {
/**
* A listener that is notified about reads and modifications of the Properties instance.
Expand Down Expand Up @@ -334,7 +336,7 @@ public Object merge(Object key, Object value, BiFunction<? super Object, ? super

@Override
public boolean contains(Object value) {
return delegate.contains(value);
return delegate.containsValue(value);
}

@Override
Expand Down

0 comments on commit 73b46a8

Please sign in to comment.