SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye
Issue Details (XML | Word | Printable)

Key: CMP-914
Type: Improvement Improvement
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Shay Banon
Reporter: Kenny MacLeod
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Compass

AccessorUtils.getCollectionParameter too fragile

Created: 04/Jan/10 10:27 AM   Updated: 08/Jan/10 06:03 AM
Component/s: Compass::Core
Affects Version/s: 2.2.0 GA
Fix Version/s: 2.3.0 beta1


 Description  « Hide
When examining a class property which is a generic collection, AccessorUtils.getCollectionParameter is assuming that the type parameter of the collection is a java.lang.Class.

This is fine when the property is something like "Collection<String>", but fails when it's something like "Collection<?>".

I'm not suggesting that Compass should know how to handle properties of type "Collection<?>", but I do think it should check the type of the object returned by ParameterizedType.getActualTypeArguments(), and fail with a helpful exception if it's not java.lang.Class. As it stands, it fails with "java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class".



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Shay Banon added a comment - 08/Jan/10 05:57 AM
I have just committed a fix for this at CMP-912. Will that help for this issue?

Kenny MacLeod added a comment - 08/Jan/10 06:00 AM
Yup, that looks like it'll address the problem.

Shay Banon added a comment - 08/Jan/10 06:03 AM
Great, I will close this issue.