-
Notifications
You must be signed in to change notification settings - Fork 77
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
Blackbird module and MrBean module do not work together in JDK17 #170
Comments
This is probably more related to the usage of proxy considering it only impacts abstract classes, |
Hi @davidconnard, there's recently been a fix around Proxy access and Blackbird (#210) With this fix applied, and running Java 20, I re-ran your (slightly modified) test case and it seems to work now:
Could you please verify if this is still a problem with the fix applied? Currently it is only in the |
I am ok with retrofit for 2.15; if anyone wants to submit PR that'd be cleanest (happy to merge). |
Thanks for the fix!! I haven't had a chance to test your 2.16 branch, however, I'm confident that the example I supplied was a good replication for the problem we were seeing. A backport to 2.15 would be nice, but not totally necessary, we did find an alternate way of working around it. Thanks!! |
In that case let's not yet backport. 2.16 (rc1) may be out not later than the next 2.15.x patch anyway. |
We have a project that uses both Blackbird and MrBean modules. We are trying to upgrade this project to JDK17, but are hitting a number of problems. We seem to have encountered a problem where Blackbird module is incompatible with MrBean module, when abstract classes exist and when run under JDK17.
The following code works fine in JDK11:
With associated classes that look like:
When run under JDK11, it produces the following output:
However, when run under JDK17, it fails:
Note that: you can see in the above stacktrace that MrBean is engaged, and has created the generated class for the abstract
com.fasterxml.jackson.module.mrbean.generated.foo.Shape
. Under JDK17, Blackbird has failed to perform some operation on that generated class (which is not entirely unsurprising, as JDK17 is much stricter about class access). Also note that the BlackbirdCreatorOptimizer.createOptimized
method (from the above stacktrace) has the following code comment in it:Note the "reflective sins" part ... I don't really grok the entire comment, but I'd guess that it refers to something that has not really worked and is causing this to fail under JDK17.
In our specific case, we found a work-around, which was simply to drop the
abstract
from our super-class (ie. theShape
class in the above example) - ie. thereby avoiding MrBean from engaging for this specific class. While this seems to avoid the problem for this one class we found out about, and obviously leaves it lurking elsewhere in our system.Another possible approach we looked at was to avoid MrBean for all abstract types, eg:
but, this seems to de-value the MrBean module somewhat..?
MrBean documentation states that it is not compatible with polymorphic types, so, in one sense, this is not entirely surprising. However, I can't see anywhere where is parses classes for a
@JsonTypeInfo
annotation..?Note that #99 has some more commentary around the compatibility issues with polymorphic types
The text was updated successfully, but these errors were encountered: