Hi guys,
Looking into this, the actual issue is that the method will fail whenever we have nested ParameterizedTypes. For example,
<pre>
List<List<String>> thisPropertyWillFail.
</pre>
This is due to the fact that we try to cast the first parameterized type to a Class (in the above case, this is the inner List<String> on line 333 of RequiredDataAdvice. Since List<String> is another ParameterizedType and not directly a class, this throws an Exception.
This has reared it's head in the Reporting module as Justin indicates because we have properties like this on our objects (i.e. List<Mapped<CohortDefinition>>)
Given the @should annotations on the method, I think we basically just need to account for such errors, and return false if they occur (a List<List<String>> is not a Collection of OpenmrsObjects after all.
See my attached patch as a proposed solution.
This should be put in 1.5 if at all possible, since it is a bug fix. I have no problem with RequiredDataAdvice not handling this type of property, but it should at least do those that it can without throwing an error so that we can create additional RequiredDataAdvice handlers in our module to account for the unhandled cases.
partial solution to prevent ClassCastException