[tomcat] 02/02: Use generics and remove a couple of casts

2019-10-04 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit b8832f6707efde347d6227236f862c489d743b13
Author: Mark Thomas 
AuthorDate: Thu Oct 3 22:04:32 2019 +0100

Use generics and remove a couple of casts
---
 java/javax/el/Util.java | 54 -
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/java/javax/el/Util.java b/java/javax/el/Util.java
index 7302fe8..6053fea 100644
--- a/java/javax/el/Util.java
+++ b/java/javax/el/Util.java
@@ -214,11 +214,11 @@ class Util {
 
 Method[] methods = clazz.getMethods();
 
-List wrappers = Wrapper.wrap(methods, methodName);
+List> wrappers = Wrapper.wrap(methods, methodName);
 
-Wrapper result = findWrapper(clazz, wrappers, methodName, paramTypes, 
paramValues);
+Wrapper result = findWrapper(clazz, wrappers, methodName, 
paramTypes, paramValues);
 
-return getMethod(clazz, (Method) result.unWrap());
+return getMethod(clazz, result.unWrap());
 }
 
 /*
@@ -226,14 +226,14 @@ class Util {
  * making changes keep the code in sync.
  */
 @SuppressWarnings("null")
-private static Wrapper findWrapper(Class clazz, List wrappers,
+private static  Wrapper findWrapper(Class clazz, List> 
wrappers,
 String name, Class[] paramTypes, Object[] paramValues) {
 
-Map candidates = new 
HashMap();
+Map,MatchResult> candidates = new 
HashMap,MatchResult>();
 
 int paramCount = paramTypes.length;
 
-for (Wrapper w : wrappers) {
+for (Wrapper w : wrappers) {
 Class[] mParamTypes = w.getParameterTypes();
 int mParamCount;
 if (mParamTypes == null) {
@@ -338,9 +338,9 @@ class Util {
 // Look for the method that has the highest number of parameters where
 // the type matches exactly
 MatchResult bestMatch = new MatchResult(0, 0, 0, false);
-Wrapper match = null;
+Wrapper match = null;
 boolean multiple = false;
-for (Map.Entry entry : candidates.entrySet()) {
+for (Map.Entry, MatchResult> entry : candidates.entrySet()) 
{
 int cmp = entry.getValue().compareTo(bestMatch);
 if (cmp > 0 || match == null) {
 bestMatch = entry.getValue();
@@ -402,10 +402,10 @@ class Util {
  * This method duplicates code in org.apache.el.util.ReflectionUtil. When
  * making changes keep the code in sync.
  */
-private static Wrapper resolveAmbiguousWrapper(Set candidates,
+private static  Wrapper resolveAmbiguousWrapper(Set> 
candidates,
 Class[] paramTypes) {
 // Identify which parameter isn't an exact match
-Wrapper w = candidates.iterator().next();
+Wrapper w = candidates.iterator().next();
 
 int nonMatchIndex = 0;
 Class nonMatchClass = null;
@@ -423,7 +423,7 @@ class Util {
 return null;
 }
 
-for (Wrapper c : candidates) {
+for (Wrapper c : candidates) {
if (c.getParameterTypes()[nonMatchIndex] ==
paramTypes[nonMatchIndex]) {
// Methods have different non-matching parameters
@@ -435,7 +435,7 @@ class Util {
 // Can't be null
 Class superClass = nonMatchClass.getSuperclass();
 while (superClass != null) {
-for (Wrapper c : candidates) {
+for (Wrapper c : candidates) {
 if (c.getParameterTypes()[nonMatchIndex].equals(superClass)) {
 // Found a match
 return c;
@@ -445,9 +445,9 @@ class Util {
 }
 
 // Treat instances of Number as a special case
-Wrapper match = null;
+Wrapper match = null;
 if (Number.class.isAssignableFrom(nonMatchClass)) {
-for (Wrapper c : candidates) {
+for (Wrapper c : candidates) {
 Class candidateType = c.getParameterTypes()[nonMatchIndex];
 if (Number.class.isAssignableFrom(candidateType) ||
 candidateType.isPrimitive()) {
@@ -591,11 +591,11 @@ class Util {
 
 Constructor[] constructors = clazz.getConstructors();
 
-List wrappers = Wrapper.wrap(constructors);
+List>> wrappers = Wrapper.wrap(constructors);
 
-Wrapper wrapper = findWrapper(clazz, wrappers, methodName, paramTypes, 
paramValues);
+Wrapper> wrapper = findWrapper(clazz, wrappers, 
methodName, paramTypes, paramValues);
 
-Constructor constructor = getConstructor(clazz, (Constructor) 
wrapper.unWrap());
+Constructor constructor = getConstructor(clazz, wrapper.unWrap());
 if (constructor == null) {
 throw new MethodNotFoundException(message(
 null, "util.method.notfound", clazz, methodName,
@@ -667,10 +667,10 @@ 

[tomcat] 02/02: Use generics and remove a couple of casts

2019-10-04 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 7c4361e9710e38ef265f0f51e3896338669007fe
Author: Mark Thomas 
AuthorDate: Thu Oct 3 22:04:32 2019 +0100

Use generics and remove a couple of casts
---
 java/javax/el/Util.java | 54 -
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/java/javax/el/Util.java b/java/javax/el/Util.java
index 4e3880f..15ccb98 100644
--- a/java/javax/el/Util.java
+++ b/java/javax/el/Util.java
@@ -214,11 +214,11 @@ class Util {
 
 Method[] methods = clazz.getMethods();
 
-List wrappers = Wrapper.wrap(methods, methodName);
+List> wrappers = Wrapper.wrap(methods, methodName);
 
-Wrapper result = findWrapper(clazz, wrappers, methodName, paramTypes, 
paramValues);
+Wrapper result = findWrapper(clazz, wrappers, methodName, 
paramTypes, paramValues);
 
-return getMethod(clazz, (Method) result.unWrap());
+return getMethod(clazz, result.unWrap());
 }
 
 /*
@@ -226,14 +226,14 @@ class Util {
  * making changes keep the code in sync.
  */
 @SuppressWarnings("null")
-private static Wrapper findWrapper(Class clazz, List wrappers,
+private static  Wrapper findWrapper(Class clazz, List> 
wrappers,
 String name, Class[] paramTypes, Object[] paramValues) {
 
-Map candidates = new HashMap<>();
+Map,MatchResult> candidates = new HashMap<>();
 
 int paramCount = paramTypes.length;
 
-for (Wrapper w : wrappers) {
+for (Wrapper w : wrappers) {
 Class[] mParamTypes = w.getParameterTypes();
 int mParamCount;
 if (mParamTypes == null) {
@@ -338,9 +338,9 @@ class Util {
 // Look for the method that has the highest number of parameters where
 // the type matches exactly
 MatchResult bestMatch = new MatchResult(0, 0, 0, false);
-Wrapper match = null;
+Wrapper match = null;
 boolean multiple = false;
-for (Map.Entry entry : candidates.entrySet()) {
+for (Map.Entry, MatchResult> entry : candidates.entrySet()) 
{
 int cmp = entry.getValue().compareTo(bestMatch);
 if (cmp > 0 || match == null) {
 bestMatch = entry.getValue();
@@ -402,10 +402,10 @@ class Util {
  * This method duplicates code in org.apache.el.util.ReflectionUtil. When
  * making changes keep the code in sync.
  */
-private static Wrapper resolveAmbiguousWrapper(Set candidates,
+private static  Wrapper resolveAmbiguousWrapper(Set> 
candidates,
 Class[] paramTypes) {
 // Identify which parameter isn't an exact match
-Wrapper w = candidates.iterator().next();
+Wrapper w = candidates.iterator().next();
 
 int nonMatchIndex = 0;
 Class nonMatchClass = null;
@@ -423,7 +423,7 @@ class Util {
 return null;
 }
 
-for (Wrapper c : candidates) {
+for (Wrapper c : candidates) {
if (c.getParameterTypes()[nonMatchIndex] ==
paramTypes[nonMatchIndex]) {
// Methods have different non-matching parameters
@@ -435,7 +435,7 @@ class Util {
 // Can't be null
 Class superClass = nonMatchClass.getSuperclass();
 while (superClass != null) {
-for (Wrapper c : candidates) {
+for (Wrapper c : candidates) {
 if (c.getParameterTypes()[nonMatchIndex].equals(superClass)) {
 // Found a match
 return c;
@@ -445,9 +445,9 @@ class Util {
 }
 
 // Treat instances of Number as a special case
-Wrapper match = null;
+Wrapper match = null;
 if (Number.class.isAssignableFrom(nonMatchClass)) {
-for (Wrapper c : candidates) {
+for (Wrapper c : candidates) {
 Class candidateType = c.getParameterTypes()[nonMatchIndex];
 if (Number.class.isAssignableFrom(candidateType) ||
 candidateType.isPrimitive()) {
@@ -591,11 +591,11 @@ class Util {
 
 Constructor[] constructors = clazz.getConstructors();
 
-List wrappers = Wrapper.wrap(constructors);
+List>> wrappers = Wrapper.wrap(constructors);
 
-Wrapper wrapper = findWrapper(clazz, wrappers, methodName, paramTypes, 
paramValues);
+Wrapper> wrapper = findWrapper(clazz, wrappers, 
methodName, paramTypes, paramValues);
 
-Constructor constructor = getConstructor(clazz, (Constructor) 
wrapper.unWrap());
+Constructor constructor = getConstructor(clazz, wrapper.unWrap());
 if (constructor == null) {
 throw new MethodNotFoundException(message(
 null, "util.method.notfound", clazz, methodName,
@@ -667,10 +667,10 @@ class Util {
 

[tomcat] 02/02: Use generics and remove a couple of casts

2019-10-04 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit d2726474ab7832962d355174f070de347204b61b
Author: Mark Thomas 
AuthorDate: Thu Oct 3 22:04:32 2019 +0100

Use generics and remove a couple of casts
---
 java/javax/el/Util.java | 54 -
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/java/javax/el/Util.java b/java/javax/el/Util.java
index f0a9f6f..0bbf0c2 100644
--- a/java/javax/el/Util.java
+++ b/java/javax/el/Util.java
@@ -212,11 +212,11 @@ class Util {
 
 Method[] methods = clazz.getMethods();
 
-List wrappers = Wrapper.wrap(methods, methodName);
+List> wrappers = Wrapper.wrap(methods, methodName);
 
-Wrapper result = findWrapper(clazz, wrappers, methodName, paramTypes, 
paramValues);
+Wrapper result = findWrapper(clazz, wrappers, methodName, 
paramTypes, paramValues);
 
-return getMethod(clazz, (Method) result.unWrap());
+return getMethod(clazz, result.unWrap());
 }
 
 /*
@@ -224,14 +224,14 @@ class Util {
  * making changes keep the code in sync.
  */
 @SuppressWarnings("null")
-private static Wrapper findWrapper(Class clazz, List wrappers,
+private static  Wrapper findWrapper(Class clazz, List> 
wrappers,
 String name, Class[] paramTypes, Object[] paramValues) {
 
-Map candidates = new HashMap<>();
+Map,MatchResult> candidates = new HashMap<>();
 
 int paramCount = paramTypes.length;
 
-for (Wrapper w : wrappers) {
+for (Wrapper w : wrappers) {
 Class[] mParamTypes = w.getParameterTypes();
 int mParamCount;
 if (mParamTypes == null) {
@@ -336,9 +336,9 @@ class Util {
 // Look for the method that has the highest number of parameters where
 // the type matches exactly
 MatchResult bestMatch = new MatchResult(0, 0, 0, false);
-Wrapper match = null;
+Wrapper match = null;
 boolean multiple = false;
-for (Map.Entry entry : candidates.entrySet()) {
+for (Map.Entry, MatchResult> entry : candidates.entrySet()) 
{
 int cmp = entry.getValue().compareTo(bestMatch);
 if (cmp > 0 || match == null) {
 bestMatch = entry.getValue();
@@ -400,10 +400,10 @@ class Util {
  * This method duplicates code in org.apache.el.util.ReflectionUtil. When
  * making changes keep the code in sync.
  */
-private static Wrapper resolveAmbiguousWrapper(Set candidates,
+private static  Wrapper resolveAmbiguousWrapper(Set> 
candidates,
 Class[] paramTypes) {
 // Identify which parameter isn't an exact match
-Wrapper w = candidates.iterator().next();
+Wrapper w = candidates.iterator().next();
 
 int nonMatchIndex = 0;
 Class nonMatchClass = null;
@@ -421,7 +421,7 @@ class Util {
 return null;
 }
 
-for (Wrapper c : candidates) {
+for (Wrapper c : candidates) {
if (c.getParameterTypes()[nonMatchIndex] ==
paramTypes[nonMatchIndex]) {
// Methods have different non-matching parameters
@@ -433,7 +433,7 @@ class Util {
 // Can't be null
 Class superClass = nonMatchClass.getSuperclass();
 while (superClass != null) {
-for (Wrapper c : candidates) {
+for (Wrapper c : candidates) {
 if (c.getParameterTypes()[nonMatchIndex].equals(superClass)) {
 // Found a match
 return c;
@@ -443,9 +443,9 @@ class Util {
 }
 
 // Treat instances of Number as a special case
-Wrapper match = null;
+Wrapper match = null;
 if (Number.class.isAssignableFrom(nonMatchClass)) {
-for (Wrapper c : candidates) {
+for (Wrapper c : candidates) {
 Class candidateType = c.getParameterTypes()[nonMatchIndex];
 if (Number.class.isAssignableFrom(candidateType) ||
 candidateType.isPrimitive()) {
@@ -589,11 +589,11 @@ class Util {
 
 Constructor[] constructors = clazz.getConstructors();
 
-List wrappers = Wrapper.wrap(constructors);
+List>> wrappers = Wrapper.wrap(constructors);
 
-Wrapper wrapper = findWrapper(clazz, wrappers, methodName, paramTypes, 
paramValues);
+Wrapper> wrapper = findWrapper(clazz, wrappers, 
methodName, paramTypes, paramValues);
 
-Constructor constructor = getConstructor(clazz, (Constructor) 
wrapper.unWrap());
+Constructor constructor = getConstructor(clazz, wrapper.unWrap());
 if (constructor == null) {
 throw new MethodNotFoundException(message(
 null, "util.method.notfound", clazz, methodName,
@@ -665,10 +665,10 @@ class Util {