Skip to content

Commit

Permalink
Tune logging to prevent illegal reflective operation warnings
Browse files Browse the repository at this point in the history
On newer Java versions the following log statement triggers illegal reflective operation warnings:

    log.debug("  Plugin Artifacts to be added -> ${pluginArtifacts.toString()}")

Since this is debug logging, the illegal operation can be prevented most of the time by only executing the operation when debug logging is enabled.

Related to: #132

Signed-off-by: Wouter Born <[email protected]>
  • Loading branch information
wborn committed Jan 22, 2020
1 parent 0bba18b commit 249a908
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -636,15 +636,14 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {

if (!skip && canGenerateReport()) {

log.debug("Locale is ${locale.getLanguage()}")

log.debug("****** SpotBugsMojo executeReport *******")

log.debug("report Output Directory is " + getReportOutputDirectory())
log.debug("Output Directory is " + outputDirectory)
log.debug("Classes Directory is " + classFilesDirectory)

log.debug(" Plugin Artifacts to be added ->" + pluginArtifacts.toString())
if (log.isDebugEnabled()) {
log.debug("Locale is ${locale.getLanguage()}")
log.debug("****** SpotBugsMojo executeReport *******")
log.debug("report Output Directory is " + getReportOutputDirectory())
log.debug("Output Directory is " + outputDirectory)
log.debug("Classes Directory is " + classFilesDirectory)
log.debug(" Plugin Artifacts to be added ->" + pluginArtifacts.toString())
}

generateXDoc(locale)

Expand Down Expand Up @@ -1020,15 +1019,13 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {

resourceManager.setOutputDirectory(new File(project.getBuild().getDirectory()))

log.debug("resourceManager outputDirectory is ${resourceManager.outputDirectory}")


log.debug(" Plugin Artifacts to be added -> ${pluginArtifacts.toString()}")

log.debug("outputFile is " + outputFile.getCanonicalPath())
log.debug("output Directory is " + spotbugsXmlOutputDirectory.getAbsolutePath())

log.debug("Temp File is " + tempFile.getCanonicalPath())
if (log.isDebugEnabled()) {
log.debug("resourceManager outputDirectory is ${resourceManager.outputDirectory}")
log.debug(" Plugin Artifacts to be added -> ${pluginArtifacts.toString()}")
log.debug("outputFile is " + outputFile.getCanonicalPath())
log.debug("output Directory is " + spotbugsXmlOutputDirectory.getAbsolutePath())
log.debug("Temp File is " + tempFile.getCanonicalPath())
}

def ant = new AntBuilder()

Expand Down

0 comments on commit 249a908

Please sign in to comment.