melix / japicmp-gradle-plugin

A Gradle plugin for JApicmp
Apache License 2.0
137 stars 30 forks source link

HTML reporting fails with JDK17 and recent gradle versions #62

Closed paulk-asert closed 1 year ago

paulk-asert commented 1 year ago

See: https://ci.groovy-lang.org/buildConfiguration/Groovy_CheckMasterWithCoverageJdk17/15620?hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandBuildProblemsSection=true&expandBuildChangesSection=true

Stacktrace summary:

java.security.PrivilegedActionException: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)
03:45:35     at java.base/java.security.AccessController.doPrivileged(AccessController.java:573)
03:45:35     at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.<clinit>(Injector.java:197)
03:45:35     at com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.prepare(AccessorInjector.java:81)
03:45:35     at com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.get(OptimizedAccessorFactory.java:125)
...
03:45:35     at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:514)
...
03:45:35     at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:165)
...
03:45:35     at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
03:45:35     at japicmp.output.xml.XmlOutputGenerator.createXmlDocumentAndSchema(XmlOutputGenerator.java:119)

It appears that the current resolveJaxb processing isn't sufficient for all Java versions.

Potential fix (moves to a later JAXB implementation): https://github.com/Goooler/japicmp-gradle-plugin/pull/13/

melix commented 1 year ago

That is curious, we're using this plugin with JDK 17 and Gradle 8.2 in Micronaut without any problem :thinking:

thc202 commented 1 year ago

That only happens when not using the rich report.

paulk-asert commented 1 year ago

That is also where I went to look when it wasn't working and indeed that seemed to be the case. I couldn't see any attempt to customise the classpath with a newer JAXB implementation either. But I didn't try to debug both in parallel and work out why - this was just to fix things. We are using the HTML reporting which calls the XmlOutput method seen in the stacktrace. There is no error if only using the text output format.

paulk-asert commented 1 year ago

Yes, the rich reporting also seems to work but doesn't then honor the failOnModification property? I guess it requires a custom rule instead?

Goooler commented 1 year ago

@melix I believe this issue had been fixed in #63, can we release a new version?

Goooler commented 1 year ago

Verified 0.4.2 in https://github.com/apache/groovy/pull/1925, it works well!

paulk-asert commented 1 year ago

New version works, thanks!

melix commented 1 year ago

Thanks for the contributions folks!