-
Notifications
You must be signed in to change notification settings - Fork 75
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
InaccessibleObjectException: Unable to make field protected boolean javax.swing.AbstractAction.enabled #206
Comments
Hi! This is kind of a confusing issue, since I can't simply copy and paste the code into my IDE and run it to see what's wrong. I see a mention of Swing in the stack trace. Where does that come from in the code? |
The |
Standalone example: public class A {
private B b;
@Override
public int hashCode() {
return 31 + ((b == null) ? 0 : b.hashCode());
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
return java.util.Objects.equals(b, ((A) obj).b);
}
}
public class B extends javax.swing.AbstractAction {
public B(String name) {
super(name);
}
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
}
}
public class Bug206 {
@org.junit.Test
public void testEqualsContract() {
nl.jqno.equalsverifier.EqualsVerifier.forClass(A.class).usingGetClass()
.suppress(
nl.jqno.equalsverifier.Warning.NONFINAL_FIELDS,
nl.jqno.equalsverifier.Warning.INHERITED_DIRECTLY_FROM_OBJECT)
.withPrefabValues(B.class, new B("foo"), new B("bar"))
.verify();
}
} |
Thanks for the update! I see the problem now, and I will look into it. |
Sorry for the radio silence. I've reproduced the issue (which was pretty easy with your update). (See also this repo.) I've been thinking about how to deal with this, but so far I can only conclude that I'm not sure yet 😅. Is this an urgent issue for you? |
Not urgent at all. Right now it is just a warning in our CI logs. I ran the test manually with |
OK, thanks! :) |
It's fixed in version 3.1. You'll still get the illegal reflective access warnings if you run without |
Thanks Santa! 🎅 :) |
What steps will reproduce the problem?
Running
org.openstreetmap.josm.data.osm.search.SearchCompilerTest
with JDK 11 and--illegal-access=deny
What is the code that triggers this problem?
Provide an example of a complete class (equals method, hashCode method, relevant fields) and a call to EqualsVerifier.
What error message or stack trace does EqualsVerifier give?
What did you expect?
No illegal access :)
Which version of EqualsVerifier are you using?
2.5.1
Please provide any additional information below.
The text was updated successfully, but these errors were encountered: