Skip to content
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

Illegal reflective access with Java 9/10 #183

Closed
don-vip opened this issue Jan 16, 2018 · 6 comments
Closed

Illegal reflective access with Java 9/10 #183

don-vip opened this issue Jan 16, 2018 · 6 comments
Labels

Comments

@don-vip
Copy link
Contributor

don-vip commented Jan 16, 2018

What steps will reproduce the problem?

  1. Like this tweet, because it's a major effort, congrats!
  2. Run JOSM unit test org.openstreetmap.josm.data.gpx.WayPointTest with jdk-10-ea+39
  3. Notice warning about illegal reflective access operation in logs

What is the code that triggers this problem?

package org.openstreetmap.josm.data.gpx;
import java.awt.color.ColorSpace;
public class WayPointTest {
    @Test
    public void testEqualsContract() {
        EqualsVerifier.forClass(WayPoint.class).usingGetClass()
            .suppress(Warning.NONFINAL_FIELDS)
            .withIgnoredFields("customColoring", "dir", "drawLine", "east", "north", "eastNorthCacheKey")
            .withPrefabValues(ColorSpace.class, ColorSpace.getInstance(ColorSpace.CS_sRGB), ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB))
            .verify();
    }
}

What error message or stack trace does EqualsVerifier give?

    [junit] WARNING: An illegal reflective access operation has occurred
    [junit] WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/var/lib/jenkins/jobs/Java-EarlyAccess-JOSM/workspace/jdk/JDK10/test/lib/equalsverifier-2.4.1.jar) to field java.awt.color.ICC_ColorSpace.thisProfile
    [junit] WARNING: Please consider reporting this to the maintainers of nl.jqno.equalsverifier.internal.reflection.FieldAccessor
    [junit] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    [junit] WARNING: All illegal access operations will be denied in a future release

What did you expect?

No warning

Which version of EqualsVerifier are you using?

2.4.1

Please provide any additional information below.

Same issue with Java 9.0.1.

@don-vip don-vip changed the title Illegal reflective access with Java 10-ea+39 Illegal reflective access with Java 9/10 Jan 16, 2018
@jqno
Copy link
Owner

jqno commented Jan 16, 2018

Hi,

Thanks for liking the tweet ;).

I can reproduce your issue with the following classes:
https://github.com/jqno/equalsverifier-issuerepro/blob/issue-183/src/test/java/nl/jqno/equalsverifier/MyClass.java
https://github.com/jqno/equalsverifier-issuerepro/blob/issue-183/src/test/java/nl/jqno/equalsverifier/EqualsTest.java

Would you say that's a fair representation of your own code? Because I'm also getting some recursive data structure issues.

@jqno jqno added the accepted label Jan 16, 2018
@don-vip
Copy link
Contributor Author

don-vip commented Jan 16, 2018

@jqno
Copy link
Owner

jqno commented Jan 16, 2018

OK, thanks. This will be easy enough to fix.
I wonder how many more classes there are that I've overlooked :).
I'm not sure when I'll be able to release that fix though. Hopefully during the weekend.

@jqno
Copy link
Owner

jqno commented Jan 19, 2018

I've made a fix for this. I hope to release it tomorrow.

@jqno
Copy link
Owner

jqno commented Jan 20, 2018

It's released!

@jqno jqno closed this as completed Jan 20, 2018
@jqno
Copy link
Owner

jqno commented Jan 20, 2018

Note that you probably have to remove the withPrefabValues line to make it work. I'm sure you won't mind doing that, though ;)

simon04 pushed a commit to JOSM/josm that referenced this issue Jan 20, 2018
floscher pushed a commit to floscher/josm that referenced this issue Jan 20, 2018
akhalikov pushed a commit to akhalikov/equalsverifier that referenced this issue Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants