mirror of https://github.com/apache/kafka.git
KAFKA-7389: Enable spotBugs with Java 11 and disable false positive warnings (#5943)
See https://github.com/spotbugs/spotbugs/issues/756 for details on the false positives affecting try with resources. An example is: > RCN | Nullcheck of fc at line 629 of value previously dereferenced in > org.apache.kafka.common.utils.Utils.readFileAsString(String, Charset) Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
This commit is contained in:
parent
de24d4a459
commit
0ee16350ac
|
@ -149,7 +149,6 @@ subprojects {
|
||||||
apply plugin: 'maven'
|
apply plugin: 'maven'
|
||||||
apply plugin: 'signing'
|
apply plugin: 'signing'
|
||||||
apply plugin: 'checkstyle'
|
apply plugin: 'checkstyle'
|
||||||
if (!JavaVersion.current().isJava11Compatible())
|
|
||||||
apply plugin: "com.github.spotbugs"
|
apply plugin: "com.github.spotbugs"
|
||||||
|
|
||||||
sourceCompatibility = minJavaVersion
|
sourceCompatibility = minJavaVersion
|
||||||
|
@ -372,7 +371,6 @@ subprojects {
|
||||||
}
|
}
|
||||||
test.dependsOn('checkstyleMain', 'checkstyleTest')
|
test.dependsOn('checkstyleMain', 'checkstyleTest')
|
||||||
|
|
||||||
if (!JavaVersion.current().isJava11Compatible()) {
|
|
||||||
spotbugs {
|
spotbugs {
|
||||||
toolVersion = '3.1.8'
|
toolVersion = '3.1.8'
|
||||||
excludeFilter = file("$rootDir/gradle/spotbugs-exclude.xml")
|
excludeFilter = file("$rootDir/gradle/spotbugs-exclude.xml")
|
||||||
|
@ -387,7 +385,6 @@ subprojects {
|
||||||
html.enabled(!project.hasProperty('xmlSpotBugsReport') && !project.hasProperty('xmlFindBugsReport'))
|
html.enabled(!project.hasProperty('xmlSpotBugsReport') && !project.hasProperty('xmlFindBugsReport'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Ignore core since its a scala project
|
// Ignore core since its a scala project
|
||||||
if (it.path != ':core') {
|
if (it.path != ':core') {
|
||||||
|
|
|
@ -23,6 +23,17 @@ This file dictates which categories of bugs and individual false positives that
|
||||||
For a detailed description of spotbugs bug categories, see https://spotbugs.readthedocs.io/en/latest/bugDescriptions.html
|
For a detailed description of spotbugs bug categories, see https://spotbugs.readthedocs.io/en/latest/bugDescriptions.html
|
||||||
-->
|
-->
|
||||||
<FindBugsFilter>
|
<FindBugsFilter>
|
||||||
|
|
||||||
|
<!-- false positive in Java 11, see https://github.com/spotbugs/spotbugs/issues/756 -->
|
||||||
|
<Match>
|
||||||
|
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
|
||||||
|
</Match>
|
||||||
|
|
||||||
|
<!-- false positive in Java 11, see https://github.com/spotbugs/spotbugs/issues/756 -->
|
||||||
|
<Match>
|
||||||
|
<Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
|
||||||
|
</Match>
|
||||||
|
|
||||||
<Match>
|
<Match>
|
||||||
<!-- Disable warnings about mutable objects and the use of public fields.
|
<!-- Disable warnings about mutable objects and the use of public fields.
|
||||||
EI_EXPOSE_REP: May expose internal representation by returning reference to mutable object
|
EI_EXPOSE_REP: May expose internal representation by returning reference to mutable object
|
||||||
|
|
Loading…
Reference in New Issue