@@ -242,7 +242,7 @@ private List<Object> resolveOpDependencies(OpCandidate op) throws OpMatchingExce
242242 + "method inputs and outputs of Op dependency field: " + dependency .getKey ());
243243 }
244244 try {
245- resolvedDependencies .add (findOpInstance (dependencyName , inferredRef ));
245+ resolvedDependencies .add (findOpInstance (dependencyName , inferredRef , dependency . isAdaptable () ));
246246 } catch (final Exception e ) {
247247 throw new OpMatchingException ("Could not find Op that matches requested Op dependency:" + "\n Op class: "
248248 + op .opInfo ().implementationName () + //
@@ -258,10 +258,10 @@ public <T> T findOpInstance(final String opName, final Nil<T> specialType, final
258258 final Nil <?> outType ) {
259259 final OpRef ref = OpRef .fromTypes (opName , toTypes (specialType ), outType != null ? outType .getType () : null ,
260260 toTypes (inTypes ));
261- return (T ) findOpInstance (opName , ref );
261+ return (T ) findOpInstance (opName , ref , true );
262262 }
263263
264- public Object findOpInstance (final String opName , final OpRef ref ) {
264+ public Object findOpInstance (final String opName , final OpRef ref , boolean adaptable ) {
265265 Object op = null ;
266266 OpCandidate match = null ;
267267 OpTransformationCandidate transformation = null ;
@@ -272,6 +272,9 @@ public Object findOpInstance(final String opName, final OpRef ref) {
272272 op = match .createOp (dependencies );
273273 } catch (OpMatchingException e ) {
274274 log .debug ("No matching Op for request: " + ref + "\n " );
275+ if (adaptable == false ) {
276+ throw new IllegalArgumentException (opName + " cannot be adapted (adaptation is disabled)" );
277+ }
275278 log .debug ("Attempting Op transformation..." );
276279
277280 // If we can't find an op matching the original request, we try to find a
0 commit comments