Make whitespace use around generic tokens consistent and add a checkstyle rule to enforce it.

This commit is contained in:
pascalschumacher 2018-11-19 22:03:58 +01:00
parent 07f537120f
commit 5cdac9cfd5
4 changed files with 4 additions and 3 deletions

View File

@ -55,6 +55,7 @@ limitations under the License.
<module name="LeftCurly"/> <module name="LeftCurly"/>
<module name="NeedBraces"/> <module name="NeedBraces"/>
<module name="RightCurly"/> <module name="RightCurly"/>
<module name="GenericWhitespace"/>
<module name="WhitespaceAfter"/> <module name="WhitespaceAfter"/>
<module name="NoWhitespaceBefore"/> <module name="NoWhitespaceBefore"/>
</module> </module>

View File

@ -1418,7 +1418,7 @@ public class ClassUtils {
final Iterator<Class<?>> wrapped = classes.iterator(); final Iterator<Class<?>> wrapped = classes.iterator();
return new Iterator<Class<?>>() { return new Iterator<Class<?>>() {
Iterator<Class<?>> interfaces = Collections.<Class<?>> emptySet().iterator(); Iterator<Class<?>> interfaces = Collections.<Class<?>>emptySet().iterator();
@Override @Override
public boolean hasNext() { public boolean hasNext() {

View File

@ -744,7 +744,7 @@ public class ExceptionUtils {
*/ */
public static <R> R rethrow(final Throwable throwable) { public static <R> R rethrow(final Throwable throwable) {
// claim that the typeErasure invocation throws a RuntimeException // claim that the typeErasure invocation throws a RuntimeException
return ExceptionUtils.<R, RuntimeException> typeErasure(throwable); return ExceptionUtils.<R, RuntimeException>typeErasure(throwable);
} }
/** /**

View File

@ -535,7 +535,7 @@ public class TypeUtilsTest<B> {
public void testTypesSatisfyVariables() throws SecurityException, public void testTypesSatisfyVariables() throws SecurityException,
NoSuchMethodException { NoSuchMethodException {
final Map<TypeVariable<?>, Type> typeVarAssigns = new HashMap<>(); final Map<TypeVariable<?>, Type> typeVarAssigns = new HashMap<>();
final Integer max = TypeUtilsTest.<Integer> stub(); final Integer max = TypeUtilsTest.<Integer>stub();
typeVarAssigns.put(getClass().getMethod("stub").getTypeParameters()[0], Integer.class); typeVarAssigns.put(getClass().getMethod("stub").getTypeParameters()[0], Integer.class);
assertTrue(TypeUtils.typesSatisfyVariables(typeVarAssigns)); assertTrue(TypeUtils.typesSatisfyVariables(typeVarAssigns));
typeVarAssigns.clear(); typeVarAssigns.clear();