1<FindBugsFilter>
2  <Match>
3    <!-- Reason: Null has a different meaning than a zero-length array in this case. -->
4    <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
5    <Class name="io.opencensus.stats.MutableDistribution"/>
6    <Method name="getInternalBucketCountsArray"/>
7  </Match>
8  <Match>
9    <!-- Reason: Equal is implemented in the AutoValue generated class. -->
10    <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
11    <Class name="io.opencensus.common.Timestamp"/>
12    <Method name="compareTo"/>
13  </Match>
14  <Match>
15    <!-- Reason: Equal is implemented in the AutoValue generated class. -->
16    <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
17    <Class name="io.opencensus.common.Duration"/>
18    <Method name="compareTo"/>
19  </Match>
20  <Match>
21    <!-- Reason: BaseMessageEvent only has two visible subclasses. -->
22    <Bug pattern="BC_UNCONFIRMED_CAST"/>
23    <Class name="io.opencensus.trace.internal.BaseMessageEventUtils"/>
24  </Match>
25  <Match>
26    <!-- Reason: This test is testing for a NPE. -->
27    <Bug pattern="NP_NONNULL_PARAM_VIOLATION"/>
28    <Class name="io.opencensus.internal.UtilsTest"/>
29    <Method name="checkNotNull"/>
30  </Match>
31  <Match>
32    <!-- Reason: This test is testing for a NPE. -->
33    <Bug pattern="NP_NONNULL_PARAM_VIOLATION"/>
34    <Class name="io.opencensus.internal.UtilsTest"/>
35    <Method name="checkNotNull_NullErrorMessage"/>
36  </Match>
37  <Match>
38    <!-- Reason: It seems like FindBugs incorrectly assumes that all -->
39    <!-- Throwables are subclasses of Error or Exception. -->
40    <Bug pattern="BC_VACUOUS_INSTANCEOF"/>
41    <Class name="io.opencensus.trace.CurrentSpanUtils$CallableInSpan"/>
42    <Method name="call"/>
43  </Match>
44  <Match>
45    <!-- Reason: Protobuf auto-generated code. -->
46    <Bug pattern="UCF_USELESS_CONTROL_FLOW"/>
47    <Class name="io.opencensus.contrib.appengine.standard.util.TraceIdProto$Builder"/>
48    <Method name="maybeForceBuilderInitialization"/>
49  </Match>
50  <Match>
51    <!-- Reason: The synchronization in the setState is for the side effects not for the state. -->
52    <Bug pattern="UG_SYNC_SET_UNSYNC_GET"/>
53    <Class name="io.opencensus.implcore.stats.StatsComponentImplBase"/>
54  </Match>
55
56  <!-- Suppress some FindBugs warnings related to performance or robustness -->
57  <!-- in test classes, where those issues are less important. -->
58  <Match>
59    <!-- Reason: Only needed for performance. -->
60    <Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON"/>
61    <Source name="~.*Test\.java"/>
62  </Match>
63  <Match>
64    <!-- Reason: Only needed for performance. -->
65    <Bug pattern="WMI_WRONG_MAP_ITERATOR"/>
66    <Source name="~.*Test\.java"/>
67  </Match>
68  <Match>
69    <!-- Reason: Only needed for performance. -->
70    <Bug pattern="UM_UNNECESSARY_MATH"/>
71    <Source name="~.*Test\.java"/>
72  </Match>
73  <Match>
74    <!-- Reason: This is less important in a test environment. -->
75    <Bug pattern="DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED"/>
76    <Source name="~.*Test\.java"/>
77  </Match>
78  <Match>
79    <!-- Reason: Many classes initialize fields in @Before methods. -->
80    <Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
81    <Source name="~.*Test\.java"/>
82  </Match>
83
84  <!-- Suppress all FindBugs warnings about NullPointerExceptions in -->
85  <!-- non-test code. They are redundant with the Checker Framework's -->
86  <!-- warnings, and they sometimes conflict. These warnings are still -->
87  <!-- useful in test code, where we don't use the Checker Framework. -->
88  <Match>
89    <Bug code="NP"/>
90    <Not>
91      <Source name="~.*Test\.java"/>
92    </Not>
93  </Match>
94  <Match>
95    <Bug pattern="UR_UNINIT_READ"/>
96    <Not>
97      <Source name="~.*Test\.java"/>
98    </Not>
99  </Match>
100  <Match>
101    <Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
102    <Not>
103      <Source name="~.*Test\.java"/>
104    </Not>
105  </Match>
106</FindBugsFilter>
107