Program: 92105
Project: 92105
Buggy source:
/** 
 * Formats this descriptor as a pseudo-<cite>Well Known Text</cite> element. The WKT specification does not define any representation of parameter descriptors. Apache SIS fallback on a list of  {@linkplain DefaultParameterDescriptor#formatTo(Formatter) descriptors}. The text formatted by this method is   {@linkplain Formatter#setInvalidWKT flagged as invalid WKT}.
 * @param formatter The formatter where to format the inner content of this WKT element.
 * @return {@code "Parameter"} or {@code "ParameterGroup"}.
 */
@Override protected String formatTo(final Formatter formatter){
  super.formatTo(formatter);
  formatter.setInvalidWKT(this,null);
  if (this instanceof ParameterDescriptorGroup) {
    for (    GeneralParameterDescriptor parameter : ((ParameterDescriptorGroup)this).descriptors()) {
      if (!(parameter instanceof FormattableObject)) {
        if (parameter instanceof ParameterDescriptor<?>) {
          parameter=new DefaultParameterDescriptor<>((ParameterDescriptor<?>)parameter);
        }
 else         if (parameter instanceof ParameterDescriptorGroup) {
          parameter=new DefaultParameterDescriptorGroup((ParameterDescriptorGroup)parameter);
        }
 else {
          continue;
        }
      }
      formatter.newLine();
      formatter.append((FormattableObject)parameter);
    }
    return WKTKeywords.ParameterGroup;
  }
 else   if (this instanceof ParameterDescriptor<?>) {
    final Object defaultValue=((ParameterDescriptor<?>)this).getDefaultValue();
    if (defaultValue != null) {
      formatter.appendAny(defaultValue);
    }
    final Unit<?> unit=((ParameterDescriptor<?>)this).getUnit();
    if (unit != null) {
      if (!formatter.getConvention().isSimplified() || !unit.equals(formatter.toContextualUnit(unit))) {
        formatter.append(unit);
      }
    }
  }
  return WKTKeywords.Parameter;
}

Fixed version (ground truth):
/** 
 * Formats this descriptor as a pseudo-<cite>Well Known Text</cite> element. The WKT specification does not define any representation of parameter descriptors. Apache SIS fallback on a list of  {@linkplain DefaultParameterDescriptor#formatTo(Formatter) descriptors}. The text formatted by this method is   {@linkplain Formatter#setInvalidWKT flagged as invalid WKT}.
 * @param formatter The formatter where to format the inner content of this WKT element.
 * @return {@code "Parameter"} or {@code "ParameterGroup"}.
 */
@Override protected String formatTo(final Formatter formatter){
  super.formatTo(formatter);
  formatter.setInvalidWKT(this,null);
  if (this instanceof ParameterDescriptorGroup) {
    for (    GeneralParameterDescriptor parameter : ((ParameterDescriptorGroup)this).descriptors()) {
      if (!(parameter instanceof FormattableObject)) {
        if (parameter instanceof ParameterDescriptor<?>) {
          parameter=new DefaultParameterDescriptor<>((ParameterDescriptor<?>)parameter);
        }
 else         if (parameter instanceof ParameterDescriptorGroup) {
          parameter=new DefaultParameterDescriptorGroup((ParameterDescriptorGroup)parameter);
        }
 else {
          continue;
        }
      }
      formatter.newLine();
      formatter.append((FormattableObject)parameter);
    }
    return WKTKeywords.ParameterGroup;
  }
 else   if (this instanceof ParameterDescriptor<?>) {
    final Object defaultValue=((ParameterDescriptor<?>)this).getDefaultValue();
    if (defaultValue != null) {
      formatter.appendAny(defaultValue);
    }
    formatter.append(((ParameterDescriptor<?>)this).getUnit());
  }
  return WKTKeywords.Parameter;
}