Spock: Groovy 2.5.5 + Spock 1.2 + JDK11 -> IllegalAccessError for final fields

Created on 15 Jan 2019  路  4Comments  路  Source: spockframework/spock

Environment:

  • Windows 10
  • JDK 11
  • Groovy 2.5.5
  • spock 1.2-groovy-2.5.
  • gradle 5.1.1

When I try to initialize field as FINAL either on a class level or in a method body a got the illegal access exception. How can i fix this??

Update to non-static final field ...SAMPLE_ID attempted from a different method ($spock_initializeFields) than the initializer method

Most helpful comment

Hello @leonard84 , I have the same issue, but I'm using:
Spock 1.3-groovy-2.5
Groovy 2.5.7
JDK 11
Gradle 5.4.1
Tested under MacOS and Ubuntu linux.
Do you have any ideas why it could happen? Based on the discussion above that issue should be resolved. Thanks

All 4 comments

@wites342 Please add complete stacktrace and/or some code that demonstrates the issue.

Support for JDK 11 was added with https://github.com/spockframework/spock/commit/78b3a4bc88563a947b030f45e73b45cd94fc4b62 so use the 13-SNAPSHOT for now, or wait a bit for Spock 1.3-RC1

Hello @leonard84 , I have the same issue, but I'm using:
Spock 1.3-groovy-2.5
Groovy 2.5.7
JDK 11
Gradle 5.4.1
Tested under MacOS and Ubuntu linux.
Do you have any ideas why it could happen? Based on the discussion above that issue should be resolved. Thanks

@nikita-mishchenko I am seeing this error with Spock 1.3-groovy-2.5 (and 1.2-groovy-2.5) and Groovy 2.5.7 with Java 8 as well.

Was this page helpful?
0 / 5 - 0 ratings