Skip to content

java.lang.IllegalAccessError: Update to non-static final field #1011

@tmohme

Description

@tmohme

Issue description

After a general system (Java, Groovy, Gradle) upgrade I get this problem with otherwise unchanged code.

Full message:

java.lang.IllegalAccessError: Update to non-static final field org.mohme.gradle.BuildLogicFunctionalTest.testProjectDir attempted from a different method ($spock_initializeFields) than the initializer method
at org.mohme.gradle.BuildLogicFunctionalTest.$spock_initializeFields(BuildLogicFunctionalTest.groovy:13)

This looks similar to (same as?) issue #911, #963

How to reproduce

Java/JDK

java -version
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.4+11)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.4+11, mixed mode)

[edit] The issue does not occur with Oracle Java8 (1.8.0_202-b08)

Groovy version

groovy -version
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/usr/local/Cellar/groovy/2.5.8/libexec/lib/groovy-2.5.8.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
Groovy Version: 2.5.8 JVM: 11.0.4 Vendor: AdoptOpenJDK OS: Mac OS X

Attention: Although the system has Groovy 2.5.8 installed, the build (intentionally) uses the Groovy version (2.5.4) which comes with the used Gradle version (see below) => The problem occurs with Groovy 2.5.4!

Build tool version

Gradle

./gradlew -version


Gradle 5.6

Build time: 2019-08-14 21:05:25 UTC
Revision: f0b9d60906c7b8c42cd6c61a39ae7b74767bb012

Kotlin: 1.3.41
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM: 11.0.4 (AdoptOpenJDK 11.0.4+11)
OS: Mac OS X 10.14.2 x86_64

Operating System

Mac OS X 10.14.2 x86_64

Build-tool dependencies used

Gradle/Grails

testCompile("org.spockframework:spock-core:1.3-groovy-2.5") {
exclude(module = "groovy-all")
}

./gradlew dependencies --configuration testCompile
--- org.spockframework:spock-core:1.3-groovy-2.5
+--- org.codehaus.groovy:groovy:2.5.4
+--- org.codehaus.groovy:groovy-json:2.5.4
| --- org.codehaus.groovy:groovy:2.5.4
+--- org.codehaus.groovy:groovy-nio:2.5.4
| --- org.codehaus.groovy:groovy:2.5.4
+--- org.codehaus.groovy:groovy-macro:2.5.4
| --- org.codehaus.groovy:groovy:2.5.4
+--- org.codehaus.groovy:groovy-templates:2.5.4
| +--- org.codehaus.groovy:groovy:2.5.4
| --- org.codehaus.groovy:groovy-xml:2.5.4
| --- org.codehaus.groovy:groovy:2.5.4
+--- org.codehaus.groovy:groovy-test:2.5.4
| +--- org.codehaus.groovy:groovy:2.5.4
| --- junit:junit:4.12
| --- org.hamcrest:hamcrest-core:1.3
+--- org.codehaus.groovy:groovy-sql:2.5.4
| --- org.codehaus.groovy:groovy:2.5.4
+--- org.codehaus.groovy:groovy-xml:2.5.4 ()
--- junit:junit:4.12 (
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions