Skip to content

Commit a36168f

Browse files
committed
Clean up TODO in converted candidate creation
1 parent a1fe2cc commit a36168f

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

scijava-ops-engine/src/main/java/org/scijava/ops/engine/matcher/convert/ConversionMatchingRoutine.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.scijava.ops.engine.matcher.impl.RuntimeSafeMatchingRoutine;
4242
import org.scijava.ops.spi.Op;
4343
import org.scijava.priority.Priority;
44+
import org.scijava.types.inference.GenericAssignability;
4445

4546
import java.lang.reflect.Type;
4647
import java.lang.reflect.TypeVariable;
@@ -75,23 +76,19 @@ public OpCandidate findMatch(MatchingConditions conditions, OpMatcher matcher,
7576
for (final OpInfo info : env.infos(request.getName(), convertConditions
7677
.hints()))
7778
{
78-
Map<TypeVariable<?>, Type> typeVarAssigns = new HashMap<>();
7979
Conversions.tryConvert(env, info, request).ifPresent(converted -> {
80-
// TODO: This ConvertedOpInfo is built for the request - do we even
81-
// need to check assignability?
82-
boolean assignable = typesMatch( //
83-
converted.opType(), //
84-
convertConditions.request().getType(), //
85-
typeVarAssigns //
80+
Map<TypeVariable<?>, Type> map = new HashMap<>();
81+
GenericAssignability.inferTypeVariables( //
82+
new Type[] { converted.opType() }, //
83+
new Type[] { request.getType() }, //
84+
map //
8685
);
87-
if (assignable) {
88-
candidates.add(new OpCandidate( //
89-
env, //
90-
request, //
91-
converted, //
92-
typeVarAssigns //
93-
));
94-
}
86+
candidates.add(new OpCandidate( //
87+
env, //
88+
request, //
89+
converted, //
90+
map //
91+
));
9592
});
9693
}
9794
final List<OpCandidate> matches = filterMatches(candidates);

0 commit comments

Comments
 (0)