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 on Java 9/10 #207

Closed
ssoloff opened this issue Sep 11, 2018 · 6 comments
Closed

Illegal reflective access on Java 9/10 #207

ssoloff opened this issue Sep 11, 2018 · 6 comments
Labels

Comments

@ssoloff
Copy link

ssoloff commented Sep 11, 2018

What steps will reproduce the problem?

Apply EV to the GUID class referenced below on Java 9/10.

What is the code that triggers this problem?

GUID.java
GuidTest.java

Tested with both Oracle jdk-9.0.4 and jdk-10.0.2.

What error message or stack trace does EqualsVerifier give?

Java compiler emits:

WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.server.UID.unique
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.server.UID.time
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.server.UID.count
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.server.UID.unique
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.server.UID.time
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.server.UID.count
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.server.UID.unique
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.server.UID.time
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.server.UID.count
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.server.UID.unique
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.server.UID.time
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.server.UID.count
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.dgc.VMID.addr
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.dgc.VMID.uid
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.dgc.VMID.addr
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.dgc.VMID.uid
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.dgc.VMID.addr
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.dgc.VMID.uid
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.dgc.VMID.addr
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.rmi.dgc.VMID.uid
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.util.concurrent.atomic.AtomicInteger.value
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.util.concurrent.atomic.AtomicInteger.value
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.util.concurrent.atomic.AtomicInteger.value
WARNING: Illegal reflective access by nl.jqno.equalsverifier.internal.reflection.FieldAccessor (file:/home/ssoloff/.gradle/caches/.../equalsverifier-2.5.2.jar) to field java.util.concurrent.atomic.AtomicInteger.value

What did you expect?

No illegal reflective access warnings.

Which version of EqualsVerifier are you using?

2.5.2

Please provide any additional information below.

I realize the GUID type above is somewhat pathological, but it's legacy code and not easily changeable at this time due to compatibility issues. 😞 So, I understand if supporting prefab values for these types is not desirable from EV's perspective, but we'd love to keep our EV tests! 👍

@jqno
Copy link
Owner

jqno commented Sep 13, 2018

I've reproduced this issue and I'll try to release a new version with prefab values soon, definitely for the Atomic* classes at least.

In the mean time, do you think there are other RMI related classes besides UID and VMID that could be affected by this? If I'm going to add prefab values for this, I'd like to do it well or not at all :). Unfortunately I don't have any experience with RMI so maybe we can help each other.

@ssoloff
Copy link
Author

ssoloff commented Sep 13, 2018

@jqno Thanks for offering to add the new prefab values!

In the mean time, do you think there are other RMI related classes besides UID and VMID that could be affected by this? If I'm going to add prefab values for this, I'd like to do it well or not at all :). Unfortunately I don't have any experience with RMI so maybe we can help each other.

This is going to sound strange, but the app in question doesn't really use RMI--it simply hijacks some RMI types for a custom networking protocol. I haven't used true RMI in almost 15 years. 😄

However, I took a quick look through the Java 8 RMI sources and identified the following value-like types as being candidates for an EV prefab value (beyond UID and VMID):

  • java.rmi.dgc.Lease
  • java.rmi.server.ObjID

Again, due to my lack of RMI experience, I don't have a good feel as to whether it would make sense to use the above types in an equals() implementation, but they definitely exhibit value-like semantics.

There were some other value-like types (e.g. java.rmi.activation.ActivationGroupID and java.rmi.activation.ActivationID), but they use a field of interface type as part of their equals() implementation, so I'm not sure they would be appropriate for an EV prefab value.

@jqno
Copy link
Owner

jqno commented Sep 16, 2018

Ah, I assumed you were actually using RMI :). In that case, I'll probably just add UID and VMID, and wait with adding the rest until the poor guy who actually uses RMI opens an issue :).

I'm currently working on a large release and I'll probably add them in there. I'll let you know when I release it.

@jqno
Copy link
Owner

jqno commented Sep 26, 2018

I just released version 3.0, which contains all the prefab values we discussed.

@jqno jqno closed this as completed Sep 26, 2018
@ssoloff
Copy link
Author

ssoloff commented Sep 26, 2018

Thanks, Jan. I confirmed the test referenced above now runs without warning after upgrading to EV 3.0. Cheers!

@jqno
Copy link
Owner

jqno commented Sep 27, 2018

Glad to hear that, thanks for letting me know!

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