Skip to content

Commit 85697f7

Browse files
graememorganError Prone Team
authored andcommitted
Remove the ThreadSafety:CheckImmutableTypeParameter flag.
PiperOrigin-RevId: 831375341
1 parent c0877ea commit 85697f7

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ThreadSafeAnalysis.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import com.google.common.collect.ImmutableList;
2323
import com.google.common.collect.ImmutableSet;
24-
import com.google.errorprone.ErrorProneFlags;
2524
import com.google.errorprone.VisitorState;
2625
import com.google.errorprone.bugpatterns.BugChecker;
2726
import com.google.errorprone.bugpatterns.threadsafety.ThreadSafety.Violation;
@@ -52,16 +51,14 @@ public final class ThreadSafeAnalysis {
5251
/** Factory for {@link ThreadSafeAnalysis}. */
5352
public static final class Factory {
5453
private final WellKnownThreadSafety wellKnownThreadSafety;
55-
private final ErrorProneFlags errorProneFlags;
5654

5755
@Inject
58-
Factory(WellKnownThreadSafety wellKnownThreadSafety, ErrorProneFlags errorProneFlags) {
56+
Factory(WellKnownThreadSafety wellKnownThreadSafety) {
5957
this.wellKnownThreadSafety = wellKnownThreadSafety;
60-
this.errorProneFlags = errorProneFlags;
6158
}
6259

6360
public ThreadSafeAnalysis create(BugChecker bugChecker, VisitorState state) {
64-
return new ThreadSafeAnalysis(bugChecker, state, wellKnownThreadSafety, errorProneFlags);
61+
return new ThreadSafeAnalysis(bugChecker, state, wellKnownThreadSafety);
6562
}
6663
}
6764

@@ -71,16 +68,12 @@ public ThreadSafeAnalysis create(BugChecker bugChecker, VisitorState state) {
7168
private final ThreadSafety threadSafety;
7269

7370
private ThreadSafeAnalysis(
74-
BugChecker bugChecker,
75-
VisitorState state,
76-
WellKnownThreadSafety wellKnownThreadSafety,
77-
ErrorProneFlags errorProneFlags) {
71+
BugChecker bugChecker, VisitorState state, WellKnownThreadSafety wellKnownThreadSafety) {
7872
this.bugChecker = bugChecker;
7973
this.state = state;
8074
this.wellKnownThreadSafety = wellKnownThreadSafety;
8175

82-
this.threadSafety =
83-
ThreadSafety.threadSafeBuilder(wellKnownThreadSafety, errorProneFlags).build(state);
76+
this.threadSafety = ThreadSafety.threadSafeBuilder(wellKnownThreadSafety).build(state);
8477
}
8578

8679
boolean hasThreadSafeTypeParameterAnnotation(TypeVariableSymbol sym) {

core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ThreadSafety.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import com.google.common.collect.Iterables;
3030
import com.google.common.collect.Sets;
3131
import com.google.common.collect.Streams;
32-
import com.google.errorprone.ErrorProneFlags;
3332
import com.google.errorprone.VisitorState;
3433
import com.google.errorprone.annotations.Immutable;
3534
import com.google.errorprone.annotations.ImmutableTypeParameter;
@@ -90,8 +89,7 @@ public static Builder builder() {
9089
.acceptedTypeParameterAnnotation(ImmutableSet.of());
9190
}
9291

93-
public static Builder threadSafeBuilder(
94-
WellKnownThreadSafety wellKnownThreadSafety, ErrorProneFlags flags) {
92+
public static Builder threadSafeBuilder(WellKnownThreadSafety wellKnownThreadSafety) {
9593
Builder builder =
9694
ThreadSafety.builder()
9795
.purpose(Purpose.FOR_THREAD_SAFE_CHECKER)
@@ -101,9 +99,7 @@ public static Builder threadSafeBuilder(
10199
.acceptedAnnotations(ImmutableSet.of(Immutable.class.getName()))
102100
.typeParameterAnnotation(ImmutableSet.of(ThreadSafeTypeParameter.class.getName()))
103101
.acceptedTypeParameterAnnotation(
104-
flags.getBoolean("ThreadSafety:CheckImmutableTypeParameter").orElse(true)
105-
? ImmutableSet.of(ImmutableTypeParameter.class.getName())
106-
: ImmutableSet.of());
102+
ImmutableSet.of(ImmutableTypeParameter.class.getName()));
107103
return builder;
108104
}
109105

0 commit comments

Comments
 (0)