Program: 111895
Project: 111895
Buggy source:
private static ExpressionWriter write(ExpressionWriter writer,final Object value,Type type){
  if (value == null) {
    return writer.append("String_Node_Str");
  }
  if (value instanceof String) {
    escapeString(writer.getBuf(),(String)value);
    return writer;
  }
  final Primitive primitive=Primitive.of(type);
  if (primitive != null) {
switch (primitive) {
case FLOAT:
      return writer.append(value).append("String_Node_Str");
case DOUBLE:
    return writer.append(value).append("String_Node_Str");
case LONG:
  return writer.append(value).append("String_Node_Str");
default :
return writer.append(value);
}
}
final Primitive primitive2=Primitive.ofBox(type);
if (primitive2 != null) {
writer.append(primitive2.boxClass.getSimpleName() + "String_Node_Str");
write(writer,value,primitive2.primitiveClass);
return writer.append("String_Node_Str");
}
if (value instanceof BigDecimal) {
BigDecimal bigDecimal=((BigDecimal)value).stripTrailingZeros();
try {
final int scale=bigDecimal.scale();
final long exact=bigDecimal.scaleByPowerOfTen(scale).longValueExact();
writer.append("String_Node_Str").append(exact).append("String_Node_Str");
if (scale != 0) {
writer.append("String_Node_Str").append(scale);
}
return writer.append("String_Node_Str");
}
 catch (ArithmeticException e) {
return writer.append("String_Node_Str").append(bigDecimal.toString()).append("String_Node_Str");
}
}
if (value instanceof BigInteger) {
BigInteger bigInteger=(BigInteger)value;
return writer.append("String_Node_Str").append(bigInteger.toString()).append("String_Node_Str");
}
if (value instanceof Class) {
Class clazz=(Class)value;
return writer.append(clazz.getCanonicalName()).append("String_Node_Str");
}
if (value instanceof Types.RecordType) {
final Types.RecordType recordType=(Types.RecordType)value;
return writer.append(recordType.getName()).append("String_Node_Str");
}
if (value.getClass().isArray()) {
writer.append("String_Node_Str").append(value.getClass().getComponentType());
list(writer,new AbstractList<Object>(){
public Object get(int index){
return Array.get(value,index);
}
public int size(){
return Array.getLength(value);
}
}
,"String_Node_Str","String_Node_Str","String_Node_Str");
return writer;
}
Constructor constructor=matchingConstructor(value);
if (constructor != null) {
final Field[] fields=value.getClass().getFields();
writer.append("String_Node_Str").append(value.getClass());
list(writer,new AbstractList<Object>(){
public Object get(int index){
try {
  return fields[index].get(value);
}
 catch (IllegalAccessException e) {
  throw new RuntimeException(e);
}
}
public int size(){
return fields.length;
}
}
,"String_Node_Str","String_Node_Str","String_Node_Str");
return writer;
}
return writer.append(value);
}

Fixed version (ground truth):
private static ExpressionWriter write(ExpressionWriter writer,final Object value,Type type){
  if (value == null) {
    return writer.append("String_Node_Str");
  }
  if (value instanceof String) {
    escapeString(writer.getBuf(),(String)value);
    return writer;
  }
  final Primitive primitive=Primitive.of(type);
  if (primitive != null) {
switch (primitive) {
case FLOAT:
      return writer.append(value).append("String_Node_Str");
case DOUBLE:
    return writer.append(value).append("String_Node_Str");
case LONG:
  return writer.append(value).append("String_Node_Str");
case SHORT:
return writer.append("String_Node_Str").append(value);
default :
return writer.append(value);
}
}
final Primitive primitive2=Primitive.ofBox(type);
if (primitive2 != null) {
writer.append(primitive2.boxClass.getSimpleName() + "String_Node_Str");
write(writer,value,primitive2.primitiveClass);
return writer.append("String_Node_Str");
}
if (value instanceof BigDecimal) {
BigDecimal bigDecimal=((BigDecimal)value).stripTrailingZeros();
try {
final int scale=bigDecimal.scale();
final long exact=bigDecimal.scaleByPowerOfTen(scale).longValueExact();
writer.append("String_Node_Str").append(exact).append("String_Node_Str");
if (scale != 0) {
writer.append("String_Node_Str").append(scale);
}
return writer.append("String_Node_Str");
}
 catch (ArithmeticException e) {
return writer.append("String_Node_Str").append(bigDecimal.toString()).append("String_Node_Str");
}
}
if (value instanceof BigInteger) {
BigInteger bigInteger=(BigInteger)value;
return writer.append("String_Node_Str").append(bigInteger.toString()).append("String_Node_Str");
}
if (value instanceof Class) {
Class clazz=(Class)value;
return writer.append(clazz.getCanonicalName()).append("String_Node_Str");
}
if (value instanceof Types.RecordType) {
final Types.RecordType recordType=(Types.RecordType)value;
return writer.append(recordType.getName()).append("String_Node_Str");
}
if (value.getClass().isArray()) {
writer.append("String_Node_Str").append(value.getClass().getComponentType());
list(writer,new AbstractList<Object>(){
public Object get(int index){
return Array.get(value,index);
}
public int size(){
return Array.getLength(value);
}
}
,"String_Node_Str","String_Node_Str","String_Node_Str");
return writer;
}
Constructor constructor=matchingConstructor(value);
if (constructor != null) {
final Field[] fields=value.getClass().getFields();
writer.append("String_Node_Str").append(value.getClass());
list(writer,new AbstractList<Object>(){
public Object get(int index){
try {
return fields[index].get(value);
}
 catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
public int size(){
return fields.length;
}
}
,"String_Node_Str","String_Node_Str","String_Node_Str");
return writer;
}
return writer.append(value);
}