COBCH1762 A parameter with open type cannot be passed by reference or output

An attempt has been made to declare a parameter with open type as either a reference or output parameter; a parameter with open type may only be passed by value.

An open type is a type based on a generic parameter, or an array of an open type, or a generic type where one of the generic arguments is itself an open type.

In the following example item1 and item2 are passed by reference. To fix the error, they must be passed by value.

$set ilusing(java.lang.Comparable)
 class-id GenericMath.
 method-id main static.
 01 n1 binary-double.
 01 n2 binary-double.
 
  set n1 to 999
  set n2 to 100
  display n1 space n2
  display self::Min[binary-double](n1 n2)
  display self::Max[binary-double](n1 n2)
  goback.
  end method.

 method-id Min using T static.
 constraints.
  constrain T implements type java.lang.Comparable.
 procedure division using by reference item1 as T item2 as T  *> generic params NOT passed by value
                      returning res as T.
  if item1::compareTo(item2) < 0
    set res to item1
  else
    set res to item2
  end-if
 end method.