Skip to content

Commit 5cb3bef

Browse files
committed
Add comment why field Ops cannot have dependencies
1 parent fdc1dd4 commit 5cb3bef

File tree

1 file changed

+6
-0
lines changed
  • scijava-ops-engine/src/main/java/org/scijava/ops/engine/matcher/impl

1 file changed

+6
-0
lines changed

scijava-ops-engine/src/main/java/org/scijava/ops/engine/matcher/impl/OpFieldInfo.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ public String implementationName() {
167167

168168
@Override
169169
public StructInstance<?> createOpInstance(List<?> dependencies) {
170+
// NB: dependencies are not allowed on field Ops, since field Ops can only
171+
// point to a single instance, which allows successive matching calls to
172+
// overwrite the dependencies used on earlier matching calls.
173+
// This can happen if (a) a single Field is matched multiple times, using
174+
// different dependencies, or if (b) multiple fields point to the same
175+
// object.
170176
if (dependencies != null && !dependencies.isEmpty())
171177
throw new IllegalArgumentException(
172178
"Op fields are not allowed to have any Op dependencies.");

0 commit comments

Comments
 (0)