Description
Generic type parameters with final type bounds are not generic at all since there is just one possibility for the type parameter. Such generics should be refactored to work with the specific final type instead.
Type
Code Smell
Snippet
public class GenericTypeParameterDeclaredWithAFinalTypeBound {
public static <T extends String> T getStringGeneric() { // Noncompliant
return null;
}
public static String getString() { // Compliant
return null;
}
}
Note
Also covered by Eclipse JDT.