String (ObjectReference ref) { ReferenceType type = ref.referenceType(); if (!(type instanceof ClassType) || !((ClassType)type).isEnum()) return null; ClassType superclass = ((ClassType)type).superclass(); if (superclass == null) return null; if (!superclass.name().equals(CommonClassNames.JAVA_LANG_ENUM)) { superclass = superclass.superclass(); } if (superclass == null || !superclass.name().equals(CommonClassNames.JAVA_LANG_ENUM)) return null; Field nameField = superclass.fieldByName("name"); if (nameField == null) return null; Value nameValue = ref.getValue(nameField); return nameValue instanceof StringReference ? ((StringReference)nameValue).value() : null; }