Open tedberg opened 10 years ago
I checked in a fix for this issue. Just out of curiosity, what is your use case for setting a wild card without an upper or lower bound? Saying List<?> is essentially the same as using List
In this case the method is dynamic and will return a list of objects that are asked for. I've never seen anyone use List<? extends Object> since that is obvious in Java. List<?> documents the code better telling someone that yes, this will return anything. If I read code and see a plain List, I first think that no one bothered to put in the generics or the code pre dates generics.
Do you think List<? extends Object> is a better expression to use?
Ted
On Apr 7, 2014, at 7:21 AM, Will Kennedy notifications@github.com wrote:
I checked in a fix for this issue. Just out of curiosity, what is your use case for setting a wild card without an upper or lower bound? Saying List<?> is essentially the same as using List (or just List).
— Reply to this email directly or view it on GitHub.
Thanks for the information @tedberg. I think List<?> is just as good as List<? extends Object>. I was just curious on how you were using the wildcard, so I could come up with better test cases and what not.
After the upgrade, went from everything working to getting this exception: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.WildcardTypeImpl cannot be cast to java.lang.Class
Did some troubleshooting and determined it now fails on two methods I have with a signature like:
@ResponseBody public List<?> foo(.....)
If I comment these out in the newer 0.3.2+ it again works. Failure is from this line:
ApiOperationParser:54 - documentationOperation.setResponseClass((Class<?>) type);
Breaking change was made in this commit: https://github.com/wkennedy/swagger4spring-web/commit/27dd93dbf020e981820b0ea92fc6ae406da93806
If I simply take out the generics on those methods, changing to: @ResponseBody public List foo(.....)
Then everything works again also.