diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ThreadSafety.java b/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ThreadSafety.java index 64783668c85..0bb655e5f08 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ThreadSafety.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ThreadSafety.java @@ -165,15 +165,9 @@ public Builder knownTypes(KnownTypes knownTypes) { * example, when testing a class for immutability, this should be @Immutable. */ @CanIgnoreReturnValue - public Builder markerAnnotations(Set markerAnnotations) { - return markerAnnotations(ImmutableSet.copyOf(markerAnnotations)); - } - - // TODO(ringwalt): Remove this constructor. We need it for binary compatibility. - @CanIgnoreReturnValue - public Builder markerAnnotations(ImmutableSet markerAnnotations) { + public Builder markerAnnotations(Iterable markerAnnotations) { checkNotNull(markerAnnotations); - this.markerAnnotations = markerAnnotations; + this.markerAnnotations = ImmutableSet.copyOf(markerAnnotations); return this; } @@ -184,15 +178,9 @@ public Builder markerAnnotations(ImmutableSet markerAnnotations) { * thread-safe. */ @CanIgnoreReturnValue - public Builder acceptedAnnotations(Set acceptedAnnotations) { - return acceptedAnnotations(ImmutableSet.copyOf(acceptedAnnotations)); - } - - // TODO(ringwalt): Remove this constructor. We need it for binary compatibility. - @CanIgnoreReturnValue - public Builder acceptedAnnotations(ImmutableSet acceptedAnnotations) { + public Builder acceptedAnnotations(Iterable acceptedAnnotations) { checkNotNull(acceptedAnnotations); - this.acceptedAnnotations = acceptedAnnotations; + this.acceptedAnnotations = ImmutableSet.copyOf(acceptedAnnotations); return this; } @@ -206,7 +194,7 @@ public Builder containerOfAnnotation(Class containerOfAnno /** An annotation which marks a generic parameter as a container type. */ @CanIgnoreReturnValue - public Builder containerOfAnnotation(Set containerOfAnnotation) { + public Builder containerOfAnnotation(Iterable containerOfAnnotation) { checkNotNull(containerOfAnnotation); this.containerOfAnnotation = ImmutableSet.copyOf(containerOfAnnotation); return this; @@ -222,7 +210,7 @@ public Builder suppressAnnotation(Class suppressAnnotation /** An annotation which, when found on a class, should suppress the test */ @CanIgnoreReturnValue - public Builder suppressAnnotation(Set suppressAnnotation) { + public Builder suppressAnnotation(Iterable suppressAnnotation) { checkNotNull(suppressAnnotation); this.suppressAnnotation = ImmutableSet.copyOf(suppressAnnotation); return this; @@ -248,7 +236,7 @@ public Builder typeParameterAnnotation(Class typeParameter * only be instantiated with thread-safe types. */ @CanIgnoreReturnValue - public Builder typeParameterAnnotation(Set typeParameterAnnotation) { + public Builder typeParameterAnnotation(Iterable typeParameterAnnotation) { checkNotNull(typeParameterAnnotation); this.typeParameterAnnotation = ImmutableSet.copyOf(typeParameterAnnotation); return this;