-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Closed
Closed
Copy link
Labels
Milestone
Description
I upgraded my custom plugin from gradle 7.4.2 to 7.5: the builds fails due to a NullPointerException.
Expected Behavior
It should not fail.
Current Behavior
The following exception occurred:
* What went wrong:
Execution failed for task ':checkstyleMain'.
> A failure occurred while executing org.gradle.api.plugins.quality.internal.CheckstyleAction
> Could not serialize unit of work.
> Cannot invoke "org.gradle.internal.hash.HashCode.toByteArray()" because the return value of "org.gradle.internal.snapshot.impl.IsolatedJavaSerializedValueSnapshot.getImplementationHash()" is null
It happens on IsolatedJavaSerializedValueSnapshotSerializer class (getImplementationHash() is nullable so value.getImplementationHash().toByteArray() may return a NPE)
Context
In my custom plugin which parameterize the Checkstyle Plugin I add a custom property whose value is a java.net.URL:
fun Project.configureCheckstyle() {
configure<CheckstyleExtension> {
toolVersion = "10.3.1"
// It fails when the value is an URL: it uses a JavaSerializedValueSnapshot
configProperties["suppressionFile"] = QualityPlugin::class.java.classLoader.getResource("suppressions.xml")
// It works when the value is a simple String: it uses a StringValueSnapshot
configProperties["suppressionFile2"] = "/tmp/suppressions.xml"
}Your Environment
------------------------------------------------------------
Gradle 7.5
------------------------------------------------------------
Build time: 2022-07-14 12:48:15 UTC
Revision: c7db7b958189ad2b0c1472b6fe663e6d654a5103
Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.13 (Eclipse Adoptium 11.0.13+8)
OS: Mac OS X 12.4 x86_64
clemstoquart