Program: 149926
Project: 149926
Buggy source:
/** 
 * Read the element_value field of an annotation
 * @param constantPool the constant pool for the class being read
 * @param input stream to read from
 * @return object representing the value read
 */
static Object readValue(int[] constantPool,DataInputStream input,ClassLoader classLoader) throws IOException, ClassNotFoundException {
  byte elementValue_tag=input.readByte();
  Object value;
switch (elementValue_tag) {
case 'B':
{
      Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
      value=(byte)VM_Statics.getSlotContentsAsInt(offset);
      break;
    }
case 'C':
{
    Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
    value=(char)VM_Statics.getSlotContentsAsInt(offset);
    break;
  }
case 'D':
{
  Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
  long longValue=VM_Statics.getSlotContentsAsLong(offset);
  value=Double.longBitsToDouble(longValue);
  break;
}
case 'F':
{
Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
int intValue=VM_Statics.getSlotContentsAsInt(offset);
value=Float.intBitsToFloat(intValue);
break;
}
case 'I':
{
Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
value=VM_Statics.getSlotContentsAsInt(offset);
break;
}
case 'J':
{
Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
value=VM_Statics.getSlotContentsAsLong(offset);
break;
}
case 'S':
{
Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
value=(short)VM_Statics.getSlotContentsAsInt(offset);
break;
}
case 'Z':
{
Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
value=VM_Statics.getSlotContentsAsInt(offset) == 1;
break;
}
case 's':
{
value=VM_Class.getUtf(constantPool,input.readUnsignedShort()).toString();
break;
}
case 'e':
{
int typeNameIndex=input.readUnsignedShort();
@SuppressWarnings("String_Node_Str") Class enumType=VM_TypeReference.findOrCreate(classLoader,VM_Class.getUtf(constantPool,typeNameIndex)).resolve().getClassForType();
int constNameIndex=input.readUnsignedShort();
@SuppressWarnings("String_Node_Str") Enum tmp=Enum.valueOf(enumType,VM_Class.getUtf(constantPool,constNameIndex).toString());
value=tmp;
break;
}
case 'c':
{
int classInfoIndex=input.readUnsignedShort();
value=Class.forName(VM_Class.getUtf(constantPool,classInfoIndex).toString());
break;
}
case '@':
value=VM_Annotation.readAnnotation(constantPool,input,classLoader);
break;
case '[':
{
int numValues=input.readUnsignedShort();
Object[] array=new Object[numValues];
for (int i=0; i < numValues; i++) {
array[i]=readValue(constantPool,input,classLoader);
}
value=array;
break;
}
default :
value=null;
throw new ClassFormatError("String_Node_Str" + (char)elementValue_tag + "String_Node_Str");
}
return value;
}

Fixed version (ground truth):
/** 
 * Read the element_value field of an annotation
 * @param constantPool the constant pool for the class being read
 * @param input stream to read from
 * @return object representing the value read
 */
static Object readValue(int[] constantPool,DataInputStream input,ClassLoader classLoader) throws IOException, ClassNotFoundException {
  byte elementValue_tag=input.readByte();
  Object value;
switch (elementValue_tag) {
case 'B':
{
      Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
      value=(byte)VM_Statics.getSlotContentsAsInt(offset);
      break;
    }
case 'C':
{
    Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
    value=(char)VM_Statics.getSlotContentsAsInt(offset);
    break;
  }
case 'D':
{
  Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
  long longValue=VM_Statics.getSlotContentsAsLong(offset);
  value=Double.longBitsToDouble(longValue);
  break;
}
case 'F':
{
Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
int intValue=VM_Statics.getSlotContentsAsInt(offset);
value=Float.intBitsToFloat(intValue);
break;
}
case 'I':
{
Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
value=VM_Statics.getSlotContentsAsInt(offset);
break;
}
case 'J':
{
Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
value=VM_Statics.getSlotContentsAsLong(offset);
break;
}
case 'S':
{
Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
value=(short)VM_Statics.getSlotContentsAsInt(offset);
break;
}
case 'Z':
{
Offset offset=VM_Class.getLiteralOffset(constantPool,input.readUnsignedShort());
value=VM_Statics.getSlotContentsAsInt(offset) == 1;
break;
}
case 's':
{
value=VM_Class.getUtf(constantPool,input.readUnsignedShort()).toString();
break;
}
case 'e':
{
int typeNameIndex=input.readUnsignedShort();
@SuppressWarnings("String_Node_Str") Class enumType=VM_TypeReference.findOrCreate(classLoader,VM_Class.getUtf(constantPool,typeNameIndex)).resolve().getClassForType();
int constNameIndex=input.readUnsignedShort();
value=Enum.valueOf(enumType,VM_Class.getUtf(constantPool,constNameIndex).toString());
break;
}
case 'c':
{
int classInfoIndex=input.readUnsignedShort();
value=Class.forName(VM_Class.getUtf(constantPool,classInfoIndex).toString());
break;
}
case '@':
value=VM_Annotation.readAnnotation(constantPool,input,classLoader);
break;
case '[':
{
int numValues=input.readUnsignedShort();
Object[] array=new Object[numValues];
for (int i=0; i < numValues; i++) {
array[i]=readValue(constantPool,input,classLoader);
}
value=array;
break;
}
default :
throw new ClassFormatError("String_Node_Str" + (char)elementValue_tag + "String_Node_Str");
}
return value;
}