diff --git a/core/src/main/java/org/keycloak/TokenVerifier.java b/core/src/main/java/org/keycloak/TokenVerifier.java index ab342e0b48..12435b314a 100755 --- a/core/src/main/java/org/keycloak/TokenVerifier.java +++ b/core/src/main/java/org/keycloak/TokenVerifier.java @@ -224,7 +224,7 @@ public class TokenVerifier { * @return */ public static TokenVerifier create(String tokenString, Class clazz) { - return new TokenVerifier(tokenString, clazz); + return new TokenVerifier<>(tokenString, clazz); } /** @@ -237,7 +237,7 @@ public class TokenVerifier { * @return */ public static TokenVerifier createWithoutSignature(T token) { - return new TokenVerifier(token); + return new TokenVerifier<>(token); } /** @@ -271,6 +271,7 @@ public class TokenVerifier { checks.remove(check); } + @SuppressWarnings("unchecked") private

> TokenVerifier replaceCheck(Class> checkClass, boolean active, P... predicate) { removeCheck(checkClass); if (active) { @@ -279,6 +280,7 @@ public class TokenVerifier { return this; } + @SuppressWarnings("unchecked") private

> TokenVerifier replaceCheck(Predicate check, boolean active, P... predicate) { removeCheck(check); if (active) { @@ -292,7 +294,8 @@ public class TokenVerifier { * @param checks * @return */ - public TokenVerifier withChecks(Predicate... checks) { + @SafeVarargs + public final TokenVerifier withChecks(Predicate... checks) { if (checks != null) { this.checks.addAll(Arrays.asList(checks)); } @@ -509,6 +512,7 @@ public class TokenVerifier { * @param predicates * @return */ + @SafeVarargs public static Predicate alternative(final Predicate... predicates) { return new Predicate() { @Override