-
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
Update from 2.4.4 to 2.4.7 broke Java11 compatibility (Could not find sun.misc.Unsafe) #197
Comments
Thanks for reporting this. In fact, I was already working on support for Java 11. (I hope to be able to finish and release that before I go on vacation: 🤞) I'm surprised, though, that 2.4.4 works on Java 11. I would have expected 2.4.4 to fail as well. |
Also, I guess you can now remove that suppress warning line 😉 |
I'm down to only 3 failing tests, which I can fix by relying on experimental features from ASM (specifically, |
(Also: did I see in your jenkins log that you're running JaCoCo on JDK11? If so, how? This is also still a loose end for me.) |
No rush, it can wait after your holidays if needed :) Technically we use jacoco but we have disabled coverage with JDK11 as it does not work yet, we're waiting for the new jacoco release to re-enable it. |
I've released what I have so far. As long as you don't use annotations, you should be good on Java 11. If you do, you might run into some issues, which you can suppress with I'll leave this issue open until I have a complete solution for Java 11 -- which is probably after a new version of ASM is released. |
…, see jqno/equalsverifier#197 git-svn-id: https://josm.openstreetmap.de/svn/trunk@14002 0c6e7542-c601-0410-84e7-c038aed88b3b
…, see jqno/equalsverifier#197 git-svn-id: https://josm.openstreetmap.de/svn/trunk@14002 0c6e7542-c601-0410-84e7-c038aed88b3b
git-svn-id: https://josm.openstreetmap.de/svn/trunk@14004 0c6e7542-c601-0410-84e7-c038aed88b3b
git-svn-id: https://josm.openstreetmap.de/svn/trunk@14004 0c6e7542-c601-0410-84e7-c038aed88b3b
I decided to release with ASM's experimental Java 11 support for now after all, since Java 11 is now officially out. I'll do a new release some time after ASM comes with an update. Check out version 3.0 :) |
PS I found a way to make the ANNOTATION warning obsolete, so I removed it from the API entirely. So, now you'll have to remove that suppression ;). |
What is it that the annotation cache is for? I wonder if you could do that easier with Byte Buddy's |
I use it to store annotations on the class that EqualsVerifier tests, and its fields, and also the class and fields of its fields, recursively. At least, the annotations that are relevant to how EV works. I used to just read them on demand, but reading the same class for the same annotations over and over using ASM got pretty slow. What does |
What stops you from using the reflection API for that?
|
Sometimes these annotations have a |
As simple as: TypeDescription desc = TypePool.Default.of(someClass.getClassLoader())
.describe(someClass.getName())
.resolve(); If several classes have the same class loader, it helps to reuse the type pool as it caches classes internally. You can probably use AnnotationDescription.Loadable<NonNull> annonDesc = desc.getDeclaredAnnotations()
.ofType(NonNull.class);
if (annonDesc != null) {
NonNull nn = annotationDesc.loadSilent();
} Byte Buddy also detects if the current VM supports type annotations and makes them available on demand. (Important difference: calling |
That's pretty cool! I'll open an issue to look into this later. Thanks for pointing this out to me, I had no idea :). |
There is nothing wrong with how you are doing it, I just thought that this might make it easier. I discovered hundrets of class file corner cases, especially with type annotations, I guess you might be able to benefit from that. Glad I could help! |
The ability to mooch off of your hard work is of course a very nice benefit ;) , but mainly I'm happy about the fact that adopting this will enable me to drop the dependency on ASM (this is the only thing I use it for directly) and hopefully simplify my code in the process. So thank you! |
Thanks a lot Rafael! It's very nice to see upstream developers helping downstream projects 👍 |
Plan for world domination:
|
Did you update? What Java version are you using? |
Indeed, as @raphw says, updating to 3.0 should fix the problem. Check out the migration guide here: http://jqno.nl/equalsverifier/migration2to3/ |
@raphw Thanks again for the suggestion: I was able to completely remove the (direct) dependency on ASM, the code is now easier to comprehend, and it's also about 60 lines shorter. A nice improvement! |
What steps will reproduce the problem?
We updated equalsverifier from 2.4.4 to 2.4.7.
What is the code that triggers this problem?
All our 54 unit tests calling equalsverifier.
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 error (as for 2.4.4)
Which version of EqualsVerifier are you using?
2.4.7
Please provide any additional information below.
Java 11 EA build 19. No problem with Java 8, 9, 10.
The text was updated successfully, but these errors were encountered: