-
Notifications
You must be signed in to change notification settings - Fork 332
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
Fix Get Adapters in Proxy Class #995
Conversation
Type[] genericInterfaces = adapter.getClass().getGenericInterfaces(); | ||
ParameterizedType type = (ParameterizedType) genericInterfaces[0]; | ||
Type actualType = type.getActualTypeArguments()[0]; | ||
final Class<?> klazz; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using String comparison you should use CDIProxies.isCDIProxy
method to check if the class is a proxy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I didn't know CDIProxies.isCDIProxy is there.
I write a better test.
I don't understand if the proxy was created by Hibernate, Javassist, CDI, or another kind of proxy. Can you explain better to us? Thanks for your pr. |
Sorry about that, is a CDI proxy with Weld. |
public JsonElement serialize(Bean src, Type typeOfSrc, JsonSerializationContext context) { | ||
return element; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clairton this test fails without your changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes @Turini.
final Class<?> klazz = extractRawTypeIfPossible(adapter.getClass()); | ||
final Type[] genericInterfaces = klazz.getGenericInterfaces(); | ||
final ParameterizedType type = (ParameterizedType) genericInterfaces[0]; | ||
final Type actualType = type.getActualTypeArguments()[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, much better! ;)
for curiosity, is this an eclipse save action adding final
, or a personal habit?
no need for changing this, I'm ok with and without that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a personal habit.
I think it better to understand the code. But I can take off if necessary.
Thank's.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no worries, you can leave it as it is :)
@lucascs @garcia-jj any downvotes here? if not, I'll include this PR on RC3 release |
Sounds good for me. 🏇 Thanks to fix me about |
thank you @garcia-jj, and welcome back ;) |
Fix Get Adapters in Proxy Class
Possible create Serializers without producers, Before throw a expcetion: