[ 
https://issues.apache.org/jira/browse/MATH-1633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17428203#comment-17428203
 ] 

Alex Herbert commented on MATH-1633:
------------------------------------

Replacing SpotBugs 3.1.8 with 4.3.0 allows the spotbugs plugin to run in JDK 
17. The build then fails on bugs found by SpotBugs. These are not detected 
using JDK 8 with SpotBugs 3.1.8.

SpotBugs is skipped in the {{commons-math4-legacy}} module so this relates to 
updated code. I had to fix the legacy code to use the updated API from Commons 
Statistics.

The errors are related to exposing a reference to a private field through 
getter methods. I inspected a few and this seems intentional.

I added this to the spotbugs exclude filter:
{noformat}
  <!-- Disable checks for exposure of internal references.
       TODO: Revise this to use more targeted exclusions. -->
  <Match>
    <Or>
      <BugPattern name="EI_EXPOSE_REP"/>
      <BugPattern name="EI_EXPOSE_REP2"/>
    </Or>
  </Match>
{noformat}
 
 The code then almost builds on JDK 17. It fails for the legacy module as 
AccurateMath does not implement all java.util.Math methods.

I have pushed the update to master.
  

> Commons-Math does not build under java 17
> -----------------------------------------
>
>                 Key: MATH-1633
>                 URL: https://issues.apache.org/jira/browse/MATH-1633
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 4.0
>            Reporter: Erik Svensson
>            Priority: Major
>
> Building with java 17 fails with 
> {{[WARNING] Error injecting: org.codehaus.mojo.spotbugs.SpotBugsMojo}}
> {{com.google.inject.ProvisionException: Unable to provision, see the 
> following errors:}}
> {{1) Error injecting constructor, java.lang.NoClassDefFoundError: Could not 
> initialize class org.codehaus.groovy.vmplugin.v7.Java7}}
> {{ at org.codehaus.mojo.spotbugs.SpotBugsMojo.<init>(Unknown Source)}}
> {{ while locating org.codehaus.mojo.spotbugs.SpotBugsMojo}}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to