New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalAccessError with swapInit and clinit in jacoco 0.8.2 #911

Open
henrik242 opened this Issue Sep 17, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@henrik242
Contributor

henrik242 commented Sep 17, 2018

We get this Error seemingly random places in our Spock tests after upgrading to Jacoco 0.8.2 in my build:

Caused by: java.lang.IllegalAccessError: Update to static final field me.SomeTest.$const$0 attempted from a different method (__$swapInit) than the initializer method <clinit>
    at me.SomeTest.__$swapInit(SomeTest.groovy)
    at me.SomeTest.<clinit>(SomeTest.groovy)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
    at java.base/java.lang.Class.newInstance(Class.java:560)
    at org.spockframework.runtime.BaseSpecRunner.createSpecInstance(BaseSpecRunner.java:104)

I'm using RC3.

I've also created an issue @ jacoco: jacoco/jacoco#757

@MartyIX

This comment has been minimized.

Show comment
Hide comment
@MartyIX

MartyIX Sep 17, 2018

Contributor

(I was getting this error with 2.5.3-SNAPSHOT (#900 (comment)). It seems to disappear after the latest snapshot got downloaded.)

Contributor

MartyIX commented Sep 17, 2018

(I was getting this error with 2.5.3-SNAPSHOT (#900 (comment)). It seems to disappear after the latest snapshot got downloaded.)

@leonard84

This comment has been minimized.

Show comment
Hide comment
@leonard84

leonard84 Sep 17, 2018

Member

@henrik242 please always post your build env, e.g. Java version, Spock Version, Groovy version

Member

leonard84 commented Sep 17, 2018

@henrik242 please always post your build env, e.g. Java version, Spock Version, Groovy version

@henrik242

This comment has been minimized.

Show comment
Hide comment
@henrik242

henrik242 Sep 18, 2018

Contributor

@leonard84 Groovy 2.5.3-SNAPSHOT and jdk 10.0.2 (I am also testing the latest jdk 11).

@MartyIX You might be correct with the groovy snapshot assumption, one team member got this error with jdk 10, while I could only reproduce it with 11. Maybe we're both good later today when we cash check a later snapshot.

Contributor

henrik242 commented Sep 18, 2018

@leonard84 Groovy 2.5.3-SNAPSHOT and jdk 10.0.2 (I am also testing the latest jdk 11).

@MartyIX You might be correct with the groovy snapshot assumption, one team member got this error with jdk 10, while I could only reproduce it with 11. Maybe we're both good later today when we cash check a later snapshot.

@Catuna

This comment has been minimized.

Show comment
Hide comment
@Catuna

Catuna Oct 10, 2018

We had similar problems when switching to JDK 11: Random tests failed with this error message.

We found a that in our case we could fix the failing test by changing all long and float primitives to ints.
For example the following line would cause the test to fail:
Id.of(1234L)
By changing it to the following the test would succeed:
Id.of(1234)

Similarly this fails:
1 * rs.getBigDecimal("id") >> 1.0
This does not:
1 * rs.getBigDecimal("id") >> 1

Obviously this is only a quick fix, but maybe someone has some insight into why this works?

Catuna commented Oct 10, 2018

We had similar problems when switching to JDK 11: Random tests failed with this error message.

We found a that in our case we could fix the failing test by changing all long and float primitives to ints.
For example the following line would cause the test to fail:
Id.of(1234L)
By changing it to the following the test would succeed:
Id.of(1234)

Similarly this fails:
1 * rs.getBigDecimal("id") >> 1.0
This does not:
1 * rs.getBigDecimal("id") >> 1

Obviously this is only a quick fix, but maybe someone has some insight into why this works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment