You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2019/02/25 22:11:27 UTC
[tapestry-5] branch 5.4.x updated: Revert "TAP5-2560: Error in
GenericsUtils affecting property access"
This is an automated email from the ASF dual-hosted git repository.
thiagohp pushed a commit to branch 5.4.x
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git
The following commit(s) were added to refs/heads/5.4.x by this push:
new 81c2780 Revert "TAP5-2560: Error in GenericsUtils affecting property access"
81c2780 is described below
commit 81c27804358d922e60446d6641a1f855c45eaa6f
Author: Thiago H. de Paula Figueiredo <th...@arsmachina.com.br>
AuthorDate: Mon Feb 25 19:11:10 2019 -0300
Revert "TAP5-2560: Error in GenericsUtils affecting property access"
This reverts commit 32fde0f8c38f89d596d78b7f2292b4a26958f484.
---
.../tapestry5/ioc/internal/util/GenericsUtils.java | 50 +++++-----------------
1 file changed, 10 insertions(+), 40 deletions(-)
diff --git a/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java b/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
index 5839a51..bd834a5 100644
--- a/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
+++ b/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
@@ -12,18 +12,8 @@
package org.apache.tapestry5.ioc.internal.util;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.GenericDeclaration;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.ArrayList;
+import java.lang.reflect.*;
import java.util.LinkedList;
-import java.util.List;
/**
* Static methods related to the use of JDK 1.5 generics.
@@ -377,7 +367,15 @@ public class GenericsUtils
}
Class theClass = asClass(containingType);
- addGenericSuperclasses(theClass, typeVariableOwner, stack);
+ Type genericSuperclass = theClass.getGenericSuperclass();
+ while (genericSuperclass != null && // true for interfaces with no superclass
+ !theClass.equals(Object.class) &&
+ !theClass.equals(typeVariableOwner))
+ {
+ stack.addFirst(genericSuperclass);
+ theClass = asClass(genericSuperclass);
+ genericSuperclass = theClass.getGenericSuperclass();
+ }
int i = getTypeVariableIndex(typeVariable);
Type resolved = typeVariable;
@@ -402,34 +400,6 @@ public class GenericsUtils
return ((TypeVariable) resolved).getBounds()[0];
}
-
- private static void addGenericSuperclasses(Class theClass, final Class typeVariableOwner, final LinkedList<Type> stack) {
- Type genericSuperclass = theClass.getGenericSuperclass();
- while (genericSuperclass != null && // true for interfaces with no superclass
- !theClass.equals(Object.class) &&
- !theClass.equals(typeVariableOwner))
- {
- stack.addFirst(genericSuperclass);
- theClass = asClass(genericSuperclass);
- genericSuperclass = theClass.getGenericSuperclass();
- }
- for (Type type : theClass.getGenericInterfaces()) {
- stack.add(type);
- }
- for (Class implementedInterface : getAllImplementedInterfaces(theClass)) {
- addGenericSuperclasses(implementedInterface, typeVariableOwner, stack);
- }
- }
-
- private static List<Class> getAllImplementedInterfaces(Class theClass) {
- List<Class> list = new ArrayList<Class>();
- for (Class implementedInterface : theClass.getInterfaces()) {
- list.add(implementedInterface);
- list.addAll(getAllImplementedInterfaces(implementedInterface));
- }
- return list;
- }
-
/**
* @param type - something like List<T>[] or List<? extends T>[] or T[]
* @param containingType - the shallowest type in the hierarchy where type is defined.