-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
scijava/incubator
#73Description
Declaring parameters @Optional outside of the scijava-ops-engine component leads to IllegalAccessError.
For example, DefaultMeanFilter should have an optional OutOfBoundsFactory parameter:
public void compute(final RandomAccessibleInterval<T> input, final Shape inputNeighborhoodShape,
@Optional OutOfBoundsFactory<T, RandomAccessibleInterval<T>> outOfBoundsFactory,
final RandomAccessibleInterval<V> output) {
if (outOfBoundsFactory == null)
outOfBoundsFactory = new OutOfBoundsBorderFactory<>();
RandomAccessibleInterval<T> extended = Views.interval((Views.extend(input, outOfBoundsFactory)), input);
mapper.compute(extended, inputNeighborhoodShape, statsOp, output);
}But attempting to match this with:
ops.op("filter.mean").input(img, shape).output(output).compute();produces the following exception:
java.lang.IllegalAccessError: class org.scijava.ops.engine.reduce.DefaultMeanFilterReduction1RandomAccessibleInterval_Shape_RandomAccessibleInterval_RandomAccessibleInterval (in module org.scijava.ops.engine) cannot access class net.imagej.ops2.filter.mean.DefaultMeanFilter (in module net.imagej.ops2) because module org.scijava.ops.engine does not read module net.imagej.ops2
at org.scijava.ops.engine@0-SNAPSHOT/org.scijava.ops.engine.reduce.DefaultMeanFilterReduction1RandomAccessibleInterval_Shape_RandomAccessibleInterval_RandomAccessibleInterval.compute(DefaultMeanFilterReduction1RandomAccessibleInterval_Shape_RandomAccessibleInterval_RandomAccessibleInterval.java)
at org.scijava.ops.engine@0-SNAPSHOT/org.scijava.ops.engine.matcher.impl.OpWrappers$Computer2OpWrapper$1GenericTypedComputer2.compute(OpWrappers.java:844)
at org.scijava.ops.api@0-SNAPSHOT/org.scijava.ops.api.OpBuilder$Arity2_IV_OV.compute(OpBuilder.java:1020)
This means that scijava.ops.engine would need a requires xxxx on any package using @Optional in *its own module-info.java, which of course would be cyclic and also non-extensible.