Skip to content

Commit e0d03a1

Browse files
Treiblesschorlegselzer
authored andcommitted
WIP: Fix satisfies method for types missing type parameters
1 parent f2d8a3b commit e0d03a1

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
@@ -862,16 +862,13 @@ private static boolean satisfiesParameterizedTypes(final Type arg,
862862
final Type[] destTypes = param.getActualTypeArguments();
863863

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

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

0 commit comments

Comments
 (0)