spotbugs / spotbugs-maven-plugin

Maven Mojo Plug-In to generate reports based on the SpotBugs Analyzer
https://spotbugs.github.io/spotbugs-maven-plugin/
Apache License 2.0
69 stars 51 forks source link

Illegal reflective access groovy 2.5.6 #103

Closed aaime closed 4 years ago

aaime commented 5 years ago

Running spotbugs:gui but also running spotbugs:check results in the following, on a JDK 11 build:

1278 [INFO] --- spotbugs-maven-plugin:3.1.10:gui (default-cli) @ gt-main ---
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/home/aaime/.m2/repository/org/codehaus/groovy/groovy/2.5.4/groovy-2.5.4.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Likely related to https://issues.apache.org/jira/browse/GROOVY-8339

hazendaz commented 5 years ago

@aaime That issue is with groovy and as indicated by its output the issue needs raised with the owner which is groovy project but the version is not their latest. Aside from that concern, we are using groovy 2.5.5. Are you defining groovy separately as 2.5.4?

aaime commented 5 years ago

I'm using the latest maven plugin, which depends on 2.5.4, no extra dep overrides: https://mvnrepository.com/artifact/com.github.spotbugs/spotbugs-maven-plugin/3.1.10

I see spotbugs is now at 3.1.11, but I don't see a corresponding maven plugin version on the repos: https://mvnrepository.com/artifact/com.github.spotbugs/spotbugs-maven-plugin

About the issue being in groovy, yep, I understand, you can keep this report as a reminder to upgrade, when groovy fixes the issue :-p

aaime commented 5 years ago

Ah, btw, I see this PR and associated ticket: https://github.com/apache/groovy/pull/811 https://issues.apache.org/jira/browse/GROOVY-8843

So I'm guessing that an upgrade to Groovy 3 will be required, once it's released.

hazendaz commented 5 years ago

@aaime While we did run a release once before using groovy 3.x alpha series, it is alpha and we were doing so to get around some other issues we encountered. While I could push back to 3.x alpha as it seems to cause no harm, i'm not sure at the moment that we need to since this is just noise that doesn't cause any particular issue right now. I am going to release 3.1.11 version of the plugin today which will at least be on groovy 2.5.5. Once groovy is onto beta for 3.x, I'll look at bumping. My concern is really what groovy wants to do with alpha as it apears they had a 2.6 alpha then dropped it recently. While I don't expect that with version 3.x, the entire 3.x is still subject for other changes which could cause stability issues. I was really pushing the envelope in prior releases due to jdk 11 support issues so the fact it works now in jdk 11, I'm ok even with the noise.

hazendaz commented 5 years ago

Updated issue name as the problem persists with 2.5.6 as well.

ctubbsii commented 4 years ago

This has been annoying me, now that my projects are building using Java 11 more and more. Hopefully, 3.0.0 will release soon, unless spotbugs is comfortable using the beta-1, which is now available.

hazendaz commented 4 years ago

@ctubbsii I don't have any problems switching back to 3. We used it in a couple of releases on earlier cuts. We only fell back as it didn't benefit any to be there. The stack works fine on it though so not a big deal to switch back if it indeed fixes the issues as indicated on GROOVY-8339.

hazendaz commented 4 years ago

@ctubbsii This is fixed on master now. If you could, pull the project and run a quick build and test to confirm it behaves as you would expect. I had been hanging on release so I could keep version strings in sync with spotbugs but most likely if this is ok now will release a 3.1.12.1 release. I could do that pretty much as soon as this is confirmed by others.

ctubbsii commented 4 years ago

@hazendaz Built bee21966a0d41d52bc4d97d137bb036a4e8fc776 as 3.1.13-SNAPSHOT and tested on a large project (Apache Accumulo) and it works as expected, without groovy warnings. 3.1.12.1 would be a nice release version.

hazendaz commented 4 years ago

@ctubbsii Thanks for confirming! I have pushed a release as 3.1.12.1. It should hit central in next couple of hours.

mcgin commented 4 years ago

Thanks for the new release, however I'm still seeing this with Java 12.0.1 + and the new version. Stack trace is below after running with --illegal-access=debug

[INFO] --- spotbugs-maven-plugin:3.1.12.1:spotbugs (spotbugs) @ application ---
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.ReflectionUtils (file:/Users/xxx/.m2/repository/org/codehaus/groovy/groovy/3.0.0-beta-2/groovy-3.0.0-beta-2-indy.jar) to method java.util.Collections$UnmodifiableCollection.toString()
    at org.codehaus.groovy.reflection.ReflectionUtils.makeAccessible(ReflectionUtils.java:204)
    at org.codehaus.groovy.reflection.ReflectionUtils.makeAccessible(ReflectionUtils.java:196)
    at org.codehaus.groovy.reflection.ReflectionUtils$1.run(ReflectionUtils.java:189)
    at org.codehaus.groovy.reflection.ReflectionUtils$1.run(ReflectionUtils.java:187)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:310)
    at org.codehaus.groovy.reflection.ReflectionUtils.makeAccessibleInPrivilegedAction(ReflectionUtils.java:187)
    at org.codehaus.groovy.reflection.CachedMethod.makeAccessibleIfNecessary(CachedMethod.java:380)
    at org.codehaus.groovy.reflection.CachedMethod.setAccessible(CachedMethod.java:155)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSite.<init>(PojoMetaMethodSite.java:182)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.<init>(PojoMetaMethodSite.java:207)
    at org.codehaus.groovy.reflection.CachedMethod.createPojoMetaMethodSite(CachedMethod.java:313)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.createCachedMethodSite(PojoMetaMethodSite.java:159)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.createPojoMetaMethodSite(PojoMetaMethodSite.java:148)
    at groovy.lang.MetaClassImpl.createPojoCallSite(MetaClassImpl.java:3525)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.createPojoSite(CallSiteArray.java:131)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:165)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
    at org.codehaus.mojo.spotbugs.SpotBugsMojo.executeSpotbugs(SpotBugsMojo.groovy:1022)
    at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:190)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:58)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:156)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:168)
    at org.codehaus.mojo.spotbugs.SpotBugsMojo.canGenerateReport(SpotBugsMojo.groovy:566)
    at org.codehaus.mojo.spotbugs.SpotBugsMojo.execute(SpotBugsMojo.groovy:701)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)

Environment:

Maven home: /Users/mcgin/dev/tools/apache-maven-3.6.1
Java version: 12.0.1, vendor: Oracle Corporation, runtime: /Users/mcgin/dev/tools/jdk-12.0.1.jdk/Contents/Home
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.5", arch: "x86_64", family: "mac"
hazendaz commented 4 years ago

@aaime I'll open up a new issue for tracking. This is a yet to be fixed item with groovy. They still have a tracking item related to illegal access issues. Our integration tests pick this one up (only this one). I'll link back to here and note the test in the new ticket.

VolodymyrHunko commented 4 years ago

updated groovy to 3.0.0-betta2 and finally have no more this issue with JDK12