-
Notifications
You must be signed in to change notification settings - Fork 2
Javadoc Op definition behavior question and problem #153
Copy link
Copy link
Closed
Description
Looking at the divider op in BinaryRealTypeMath.
When implemented as a method:
/**
* Sets the real component of an output real number to the division of the
* real component of two input real numbers.
* @param input1
* @param input2
* @param dbzVal (required = false)
* @param output
* @implNote op names='math.div, math.divide'
*/
public void divider(I1 input1, I2 input2, Double dbzVal, O output) {
if (Objects.nonNull(dbzVal) && (input2.getRealDouble() == 0)) {
output.setReal(dbzVal);
}
else {
output.setReal(input1.getRealDouble() / input2.getRealDouble());
}
};it compiles fine. When implemented as a field:
/**
* Sets the real component of an output real number to the division of the
* real component of two input real numbers.
* @param input1
* @param input2
* @param dbzVal (required = false)
* @param output
* @implNote op names='math.div, math.divide'
*/
public final Computers.Arity3<I1, I2, Double, O> divider = (input1, input2, dbzVal, output) -> {
if (Objects.nonNull(dbzVal) && (input2.getRealDouble() == 0)) {
output.setReal(dbzVal);
}
else {
output.setReal(input1.getRealDouble() / input2.getRealDouble());
}
};I get the error:
[ERROR] error: javaField:/net.imagej.ops2.math.BinaryRealTypeMath%24divider has 0 @input/@container/@mutable tag(s) when it should have 4
Question: why is using @input and @container required for fields but not methods?
More importantly, regardless of whether implemented as a method or as a field (with proper @input and @container annotations), this test fails:
@Test
public void testDivF() {
for (String opName : MathOps.DIV.split(", ")) {
IntType c = ops.binary(opName).input(A, B).outType(IntType.class).apply();
assertEquals(A.get() / B.get(), c.get());
}
}Bug: why isn't my required = false on dbzVal being picked up?
Reactions are currently unavailable