diff --git a/adapters/oidc/as7-eap6/as7-adapter-spi/src/main/java/org/keycloak/adapters/jbossweb/JBossWebPrincipalFactory.java b/adapters/oidc/as7-eap6/as7-adapter-spi/src/main/java/org/keycloak/adapters/jbossweb/JBossWebPrincipalFactory.java index d95d21a1d4..b7916f20de 100755 --- a/adapters/oidc/as7-eap6/as7-adapter-spi/src/main/java/org/keycloak/adapters/jbossweb/JBossWebPrincipalFactory.java +++ b/adapters/oidc/as7-eap6/as7-adapter-spi/src/main/java/org/keycloak/adapters/jbossweb/JBossWebPrincipalFactory.java @@ -163,7 +163,7 @@ public class JBossWebPrincipalFactory implements PrincipalFactory { static Constructor findJBossGenericPrincipalConstructor() { for (Constructor c : JBossGenericPrincipal.class.getConstructors()) { - if (c.getParameterCount() == 9 && + if (c.getParameterTypes().length == 9 && c.getParameterTypes()[0].equals(Realm.class) && c.getParameterTypes()[1].equals(String.class) && c.getParameterTypes()[3].equals(List.class) && diff --git a/common/src/main/java/org/keycloak/common/util/reflections/Types.java b/common/src/main/java/org/keycloak/common/util/reflections/Types.java index 377f5102f4..adf8626ac3 100644 --- a/common/src/main/java/org/keycloak/common/util/reflections/Types.java +++ b/common/src/main/java/org/keycloak/common/util/reflections/Types.java @@ -163,9 +163,9 @@ public class Types { if (method == intfMethod) return true; if (!method.getName().equals(intfMethod.getName())) return false; - if (method.getParameterCount() != intfMethod.getParameterCount()) return false; + if (method.getParameterTypes().length != intfMethod.getParameterTypes().length) return false; - for (int i = 0; i < method.getParameterCount(); i++) + for (int i = 0; i < method.getParameterTypes().length; i++) { Class rootParam = method.getParameterTypes()[i]; Class intfParam = intfMethod.getParameterTypes()[i]; diff --git a/federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPUtils.java b/federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPUtils.java index 20335d1db9..9a1ce30aa6 100755 --- a/federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPUtils.java +++ b/federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPUtils.java @@ -323,7 +323,7 @@ public class LDAPUtils { @Override public boolean methodMatches(Method m) { if ((m.getName().startsWith("get") || m.getName().startsWith("is")) - && m.getParameterCount() > 0) { + && m.getParameterTypes().length > 0) { return false; } diff --git a/server-spi-private/src/main/java/org/keycloak/models/utils/reflection/MethodPropertyImpl.java b/server-spi-private/src/main/java/org/keycloak/models/utils/reflection/MethodPropertyImpl.java index 679035c78e..befd024788 100755 --- a/server-spi-private/src/main/java/org/keycloak/models/utils/reflection/MethodPropertyImpl.java +++ b/server-spi-private/src/main/java/org/keycloak/models/utils/reflection/MethodPropertyImpl.java @@ -49,7 +49,7 @@ class MethodPropertyImpl implements MethodProperty { if (method.getReturnType() == Void.TYPE) { throw new IllegalArgumentException( "Invalid accessor method, must have return value if starts with 'get'. Method: " + method); - } else if (method.getParameterCount() > 0) { + } else if (method.getParameterTypes().length > 0) { throw new IllegalArgumentException( "Invalid accessor method, must have zero arguments if starts with 'get'. Method: " + method); } @@ -59,7 +59,7 @@ class MethodPropertyImpl implements MethodProperty { if (method.getReturnType() != Void.TYPE) { throw new IllegalArgumentException( "Invalid accessor method, must not have return value if starts with 'set'. Method: " + method); - } else if (method.getParameterCount() != 1) { + } else if (method.getParameterTypes().length != 1) { throw new IllegalArgumentException( "Invalid accessor method, must have one argument if starts with 'set'. Method: " + method); } @@ -151,7 +151,7 @@ class MethodPropertyImpl implements MethodProperty { Method[] methods = clazz.getMethods(); for (Method method : methods) { String methodName = method.getName(); - if (methodName.startsWith(SETTER_METHOD_PREFIX) && method.getParameterCount() == 1) { + if (methodName.startsWith(SETTER_METHOD_PREFIX) && method.getParameterTypes().length == 1) { if (Introspector.decapitalize(methodName.substring(SETTER_METHOD_PREFIX_LENGTH)).equals(name)) { return method; } @@ -163,7 +163,7 @@ class MethodPropertyImpl implements MethodProperty { private static Method getGetterMethod(Class clazz, String name) { for (Method method : clazz.getDeclaredMethods()) { String methodName = method.getName(); - if (method.getParameterCount() == 0) { + if (method.getParameterTypes().length == 0) { if (methodName.startsWith(GETTER_METHOD_PREFIX)) { if (Introspector.decapitalize(methodName.substring(GETTER_METHOD_PREFIX_LENGTH)).equals(name)) { return method; diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/PermissionsTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/PermissionsTest.java index 9387b93962..71002a0888 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/PermissionsTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/PermissionsTest.java @@ -1973,7 +1973,7 @@ public class PermissionsTest extends AbstractKeycloakTest { List ignoreList = Arrays.asList(ignore); for (Method m : rep.getClass().getDeclaredMethods()) { - if (m.getParameterCount() == 0 && m.getName().startsWith("get") && !ignoreList.contains(m.getName())) { + if (m.getParameters().length == 0 && m.getName().startsWith("get") && !ignoreList.contains(m.getName())) { try { Object o = m.invoke(rep); assertNull("Expected " + m.getName() + " to be null", o); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/cluster/MultiVersionClusterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/cluster/MultiVersionClusterTest.java index f3610f2459..c728d16809 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/cluster/MultiVersionClusterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/cluster/MultiVersionClusterTest.java @@ -276,7 +276,7 @@ public class MultiVersionClusterTest extends AbstractClusterTest { if (Arrays.asList(classForName.getDeclaredConstructors()).stream() .filter(c -> !c.isSynthetic()) - .anyMatch(c -> c.getParameterCount() == 0 )) { + .anyMatch(c -> c.getParameterTypes().length == 0 )) { newInstance = Reflections.newInstance(classForName); } else { Constructor constructor = Arrays.asList(classForName.getDeclaredConstructors()).stream()