Skip to content

Commit

Permalink
Rip out the ThreadSafeChecker:CheckElementUsage flag.
Browse files Browse the repository at this point in the history
Which is now enabled.

PiperOrigin-RevId: 584850701
  • Loading branch information
graememorgan authored and Error Prone Team committed Nov 23, 2023
1 parent 88a224c commit 83d2ed5
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.google.common.collect.Sets;
import com.google.common.collect.Sets.SetView;
import com.google.errorprone.BugPattern;
import com.google.errorprone.ErrorProneFlags;
import com.google.errorprone.VisitorState;
import com.google.errorprone.annotations.Immutable;
import com.google.errorprone.annotations.ThreadSafe;
Expand Down Expand Up @@ -76,12 +75,10 @@ public class ThreadSafeChecker extends BugChecker
MemberReferenceTreeMatcher {

private final WellKnownThreadSafety wellKnownThreadSafety;
private final boolean checkElementUsage;

@Inject
ThreadSafeChecker(WellKnownThreadSafety wellKnownThreadSafety, ErrorProneFlags flags) {
ThreadSafeChecker(WellKnownThreadSafety wellKnownThreadSafety) {
this.wellKnownThreadSafety = wellKnownThreadSafety;
this.checkElementUsage = flags.getBoolean("ThreadSafeChecker:CheckElementUsage").orElse(true);
}

// check instantiations of `@ThreadSafe`s in method references
Expand Down Expand Up @@ -145,7 +142,7 @@ public Description matchTypeParameter(TypeParameterTree tree, VisitorState state
.build();
}
}
if (checkElementUsage && analysis.hasThreadSafeElementAnnotation((TypeVariableSymbol) sym)) {
if (analysis.hasThreadSafeElementAnnotation((TypeVariableSymbol) sym)) {
if (analysis.getThreadSafeAnnotation(sym.owner, state) == null) {
return buildDescription(tree)
.setMessage("@ThreadSafe.Element is only supported on threadsafe classes")
Expand Down

0 comments on commit 83d2ed5

Please sign in to comment.