Skip to content

Commit 0b76079

Browse files
Treiblesschorlectrueden
authored andcommitted
Fix satisfies method for types missing type parameters
1 parent fe8107b commit 0b76079

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

src/main/java/org/scijava/util/Types.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -864,16 +864,13 @@ private static boolean satisfiesParameterizedTypes(final Type arg,
864864
final Type[] destTypes = param.getActualTypeArguments();
865865

866866
// get an array of the source argument types
867-
// TODO: Verify that this is correct. getExactSuperType should always return a ParameterizedType here because
868-
// param is parameterized and we know (check done earlier) that arg is assignable to param. Hence, arg must have
869-
// type parameters for param?
867+
Type argType = arg;
868+
if (arg instanceof Class) {
869+
argType = parameterizeRaw((Class<?>) arg);
870+
}
870871
ParameterizedType parameterizedSuperType = (ParameterizedType) GenericTypeReflector
871-
.getExactSuperType(arg, Types.raw(param));
872+
.getExactSuperType(argType, Types.raw(param));
872873
final Type[] srcTypes = parameterizedSuperType.getActualTypeArguments();
873-
// final Type[] srcTypes = new Type[destTypes.length];
874-
// for (int i = 0; i < srcTypes.length; i++) {
875-
// srcTypes[i] = Types.param(arg, Types.raw(arg), i);
876-
// }
877874

878875
// check to see if any of the Types of this ParameterizedType are
879876
// TypeVariables, if so restrict them to the type parameter of the argument.

0 commit comments

Comments
 (0)