Revert from getParameterCount() to getParameterTypes().length to be Java 1.7 compatible.
This reverts commit bc27c7c464
.
Closes #10840
This commit is contained in:
parent
c71aa8b711
commit
fb92b95c33
6 changed files with 10 additions and 10 deletions
|
@ -163,7 +163,7 @@ public class JBossWebPrincipalFactory implements PrincipalFactory {
|
||||||
|
|
||||||
static Constructor findJBossGenericPrincipalConstructor() {
|
static Constructor findJBossGenericPrincipalConstructor() {
|
||||||
for (Constructor<?> c : JBossGenericPrincipal.class.getConstructors()) {
|
for (Constructor<?> c : JBossGenericPrincipal.class.getConstructors()) {
|
||||||
if (c.getParameterCount() == 9 &&
|
if (c.getParameterTypes().length == 9 &&
|
||||||
c.getParameterTypes()[0].equals(Realm.class) &&
|
c.getParameterTypes()[0].equals(Realm.class) &&
|
||||||
c.getParameterTypes()[1].equals(String.class) &&
|
c.getParameterTypes()[1].equals(String.class) &&
|
||||||
c.getParameterTypes()[3].equals(List.class) &&
|
c.getParameterTypes()[3].equals(List.class) &&
|
||||||
|
|
|
@ -163,9 +163,9 @@ public class Types {
|
||||||
if (method == intfMethod) return true;
|
if (method == intfMethod) return true;
|
||||||
|
|
||||||
if (!method.getName().equals(intfMethod.getName())) return false;
|
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 rootParam = method.getParameterTypes()[i];
|
||||||
Class intfParam = intfMethod.getParameterTypes()[i];
|
Class intfParam = intfMethod.getParameterTypes()[i];
|
||||||
|
|
|
@ -323,7 +323,7 @@ public class LDAPUtils {
|
||||||
@Override
|
@Override
|
||||||
public boolean methodMatches(Method m) {
|
public boolean methodMatches(Method m) {
|
||||||
if ((m.getName().startsWith("get") || m.getName().startsWith("is"))
|
if ((m.getName().startsWith("get") || m.getName().startsWith("is"))
|
||||||
&& m.getParameterCount() > 0) {
|
&& m.getParameterTypes().length > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class MethodPropertyImpl<V> implements MethodProperty<V> {
|
||||||
if (method.getReturnType() == Void.TYPE) {
|
if (method.getReturnType() == Void.TYPE) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Invalid accessor method, must have return value if starts with 'get'. Method: " + method);
|
"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(
|
throw new IllegalArgumentException(
|
||||||
"Invalid accessor method, must have zero arguments if starts with 'get'. Method: " + method);
|
"Invalid accessor method, must have zero arguments if starts with 'get'. Method: " + method);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ class MethodPropertyImpl<V> implements MethodProperty<V> {
|
||||||
if (method.getReturnType() != Void.TYPE) {
|
if (method.getReturnType() != Void.TYPE) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Invalid accessor method, must not have return value if starts with 'set'. Method: " + method);
|
"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(
|
throw new IllegalArgumentException(
|
||||||
"Invalid accessor method, must have one argument if starts with 'set'. Method: " + method);
|
"Invalid accessor method, must have one argument if starts with 'set'. Method: " + method);
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ class MethodPropertyImpl<V> implements MethodProperty<V> {
|
||||||
Method[] methods = clazz.getMethods();
|
Method[] methods = clazz.getMethods();
|
||||||
for (Method method : methods) {
|
for (Method method : methods) {
|
||||||
String methodName = method.getName();
|
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)) {
|
if (Introspector.decapitalize(methodName.substring(SETTER_METHOD_PREFIX_LENGTH)).equals(name)) {
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ class MethodPropertyImpl<V> implements MethodProperty<V> {
|
||||||
private static Method getGetterMethod(Class<?> clazz, String name) {
|
private static Method getGetterMethod(Class<?> clazz, String name) {
|
||||||
for (Method method : clazz.getDeclaredMethods()) {
|
for (Method method : clazz.getDeclaredMethods()) {
|
||||||
String methodName = method.getName();
|
String methodName = method.getName();
|
||||||
if (method.getParameterCount() == 0) {
|
if (method.getParameterTypes().length == 0) {
|
||||||
if (methodName.startsWith(GETTER_METHOD_PREFIX)) {
|
if (methodName.startsWith(GETTER_METHOD_PREFIX)) {
|
||||||
if (Introspector.decapitalize(methodName.substring(GETTER_METHOD_PREFIX_LENGTH)).equals(name)) {
|
if (Introspector.decapitalize(methodName.substring(GETTER_METHOD_PREFIX_LENGTH)).equals(name)) {
|
||||||
return method;
|
return method;
|
||||||
|
|
|
@ -1973,7 +1973,7 @@ public class PermissionsTest extends AbstractKeycloakTest {
|
||||||
List<String> ignoreList = Arrays.asList(ignore);
|
List<String> ignoreList = Arrays.asList(ignore);
|
||||||
|
|
||||||
for (Method m : rep.getClass().getDeclaredMethods()) {
|
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 {
|
try {
|
||||||
Object o = m.invoke(rep);
|
Object o = m.invoke(rep);
|
||||||
assertNull("Expected " + m.getName() + " to be null", o);
|
assertNull("Expected " + m.getName() + " to be null", o);
|
||||||
|
|
|
@ -276,7 +276,7 @@ public class MultiVersionClusterTest extends AbstractClusterTest {
|
||||||
|
|
||||||
if (Arrays.asList(classForName.getDeclaredConstructors()).stream()
|
if (Arrays.asList(classForName.getDeclaredConstructors()).stream()
|
||||||
.filter(c -> !c.isSynthetic())
|
.filter(c -> !c.isSynthetic())
|
||||||
.anyMatch(c -> c.getParameterCount() == 0 )) {
|
.anyMatch(c -> c.getParameterTypes().length == 0 )) {
|
||||||
newInstance = Reflections.newInstance(classForName);
|
newInstance = Reflections.newInstance(classForName);
|
||||||
} else {
|
} else {
|
||||||
Constructor<?> constructor = Arrays.asList(classForName.getDeclaredConstructors()).stream()
|
Constructor<?> constructor = Arrays.asList(classForName.getDeclaredConstructors()).stream()
|
||||||
|
|
Loading…
Reference in a new issue