Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Spotless 6.0.4 fails with Object.hashCode exception #1024

@TimvdLippe

Description

@TimvdLippe

Today, I received a Dependabot update for Spotless on Mockito: mockito/mockito#2501 The build failed (https://github.com/mockito/mockito/runs/4450375421?check_suite_focus=true) with the following exception:

Execution failed for task ':compileJava'.
> Cannot invoke "Object.hashCode()" because "key" is null

Gradle version: 7.2
Spotless: 6.0.4 (works fine with 6.0.2)

Configuration:

spotless {
    // We run the check separately on CI, so don't run this by default
    enforceCheck = false

    java {
        licenseHeaderFile rootProject.file('config/spotless/spotless.header')

        custom 'google-java-format', { source ->
            com.google.googlejavaformat.java.JavaFormatterOptions options = new com.google.googlejavaformat.java.JavaFormatterOptions.Builder()
                    .style(com.google.googlejavaformat.java.JavaFormatterOptions.Style.AOSP)
                    .formatJavadoc(false)
                    .build()
            com.google.googlejavaformat.java.Formatter formatter = new com.google.googlejavaformat.java.Formatter(options)
            return formatter.formatSource(source)
        }

        // This test contains emulation of same-line stubbings. The formatter would put them on a separate line.
        targetExclude 'src/test/java/org/mockitousage/internal/junit/UnusedStubbingsFinderTest.java'
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions