Details
-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
2.4.0
-
None
Description
A few methods define a generic Set as the return, without defining what type of object it's returning. For example
public Set edu.internet2.middleware.grouper.Stem#getChildGroups()
|
|
//vs.
|
|
public Set<Group> edu.internet2.middleware.grouper.Stem#getChildGroups(Scope scope)
|
This means that callers can't write something like ```for (Group g: stem.getChildGroups())``` because the IDE complains "incompatible types: Object cannot be converted to Group".
Of course you can change it to Object and then cast it to Group inside the loop, but it's messy. Or, you can call stem.getChildGroups(Stem.Scope.ONE) which does set the payload to Group (and which getChildGroups() calls but then strips out the payload type).
Best would a simple change to define the payload for methods returning collections. I addition to the above, it may also uncover hidden bugs where the wrong class was being assumed in a method call.