Open spring-projects-issues opened 12 years ago
Luke Taylor said:
This was requested in SEC-1550, to cater for classes which use custom GrantedAuthority implementations.
Mikhail Mazursky said:
From the mentioned issue i still can't see any benefit to return bounded wildcad types.
When i use ??void test(List<? super T> arg)?? method signature that allows me to safely pass lists of child types (U extends T) to method. What's the point to return bounded wildcard types? As you said in those issue ??You can still only read the upper bound of the wildcard from the collection??.
Wildcard only helps to avoid in-method cast from ??List
Mikhail Mazursky (Migrated from SEC-1908) said:
I was updating spring 3.0.x to 3.1.0 and one of my tests (with Mockito) showed a compilation error. The problem i encountered was the same as described here 1:
This is not type safe but that problem can be worked around by:
The question is should the LdapAuthoritiesPopulator interface's method getGrantedAuthorities have a bounded wildcard return type or not? I think it's better to remove wildcard as it gives nothing to the calling code.
Spring 3.0.x have it as:
The same problem with GrantedAuthoritiesMapper, GrantedAuthoritiesContainer, Attributes2GrantedAuthoritiesMapper, WebSpherePreAuthenticatedWebAuthenticationDetailsSource and possibly some other classes/ifaces.
Interesting reading on the topic 2.
Methods with bounded wildcard return types
PUBLIC
PROTECTED
DEFAULT
PRIVATE