|
39 | 39 | import com.google.common.collect.Sets; |
40 | 40 | import com.google.common.collect.Sets.SetView; |
41 | 41 | import com.google.errorprone.BugPattern; |
42 | | -import com.google.errorprone.ErrorProneFlags; |
43 | 42 | import com.google.errorprone.VisitorState; |
44 | 43 | import com.google.errorprone.annotations.Immutable; |
45 | 44 | import com.google.errorprone.bugpatterns.BugChecker; |
@@ -102,40 +101,20 @@ public class ImmutableChecker extends BugChecker |
102 | 101 | private final ImmutableAnalysis.Factory immutableAnalysisFactory; |
103 | 102 | private final WellKnownMutability wellKnownMutability; |
104 | 103 | private final ImmutableSet<String> immutableAnnotations; |
105 | | - private final boolean markerAnnotationInherited; |
106 | 104 |
|
107 | 105 | @Inject |
108 | 106 | ImmutableChecker( |
109 | | - ImmutableAnalysis.Factory immutableAnalysisFactory, |
110 | | - WellKnownMutability wellKnownMutability, |
111 | | - ErrorProneFlags flags) { |
112 | | - this( |
113 | | - immutableAnalysisFactory, |
114 | | - wellKnownMutability, |
115 | | - ImmutableSet.of(Immutable.class.getName()), |
116 | | - flags.getBoolean("Immutable:MarkerAnnotationInherited").orElse(true)); |
| 107 | + ImmutableAnalysis.Factory immutableAnalysisFactory, WellKnownMutability wellKnownMutability) { |
| 108 | + this(immutableAnalysisFactory, wellKnownMutability, ImmutableSet.of(Immutable.class.getName())); |
117 | 109 | } |
118 | 110 |
|
119 | 111 | ImmutableChecker( |
120 | 112 | ImmutableAnalysis.Factory immutableAnalysisFactory, |
121 | 113 | WellKnownMutability wellKnownMutability, |
122 | 114 | ImmutableSet<String> immutableAnnotations) { |
123 | | - this( |
124 | | - immutableAnalysisFactory, |
125 | | - wellKnownMutability, |
126 | | - immutableAnnotations, |
127 | | - /* markerAnnotationInherited= */ true); |
128 | | - } |
129 | | - |
130 | | - ImmutableChecker( |
131 | | - ImmutableAnalysis.Factory immutableAnalysisFactory, |
132 | | - WellKnownMutability wellKnownMutability, |
133 | | - ImmutableSet<String> immutableAnnotations, |
134 | | - boolean markerAnnotationInherited) { |
135 | 115 | this.immutableAnalysisFactory = immutableAnalysisFactory; |
136 | 116 | this.wellKnownMutability = wellKnownMutability; |
137 | 117 | this.immutableAnnotations = immutableAnnotations; |
138 | | - this.markerAnnotationInherited = markerAnnotationInherited; |
139 | 118 | } |
140 | 119 |
|
141 | 120 | @Override |
@@ -604,9 +583,6 @@ private boolean hasImmutableAnnotation(TypeSymbol tsym, VisitorState state) { |
604 | 583 | } |
605 | 584 |
|
606 | 585 | private boolean typeOrSuperHasImmutableAnnotation(TypeSymbol tsym, VisitorState state) { |
607 | | - if (!markerAnnotationInherited) { |
608 | | - return hasImmutableAnnotation(tsym, state); |
609 | | - } |
610 | 586 | return hasImmutableAnnotation(tsym, state) || immutableSupertype(tsym, state) != null; |
611 | 587 | } |
612 | 588 |
|
|
0 commit comments