private static void handleEnumConst(@Nonnull JvmTransformerContext context,
	                                    @Nonnull JvmClassInfo initialClassState,
	                                    @Nonnull LdcInsnNode nameInsn,
	                                    @Nonnull String constDesc) {
		if (!(nameInsn.cst instanceof String nameString) || !nameString.matches("\\w+"))
			return;

		AbstractInsnNode indexInsn = getNextFollowGoto(nameInsn);
		if (indexInsn == null || !isConstIntValue(indexInsn))
			return;

		Set<AbstractInsnNode> visited = Collections.newSetFromMap(new IdentityHashMap<>());
		AbstractInsnNode next = getNextFollowGoto(indexInsn);
		while (next != null && next.getOpcode() != PUTSTATIC && visited.add(next))
			next = getNextFollowGoto(next);
		if (next != null && next.getOpcode() == PUTSTATIC) {
			FieldInsnNode assignmentInsn = (FieldInsnNode) next;
			String fieldName = assignmentInsn.name;
			String fieldDesc = assignmentInsn.desc;
			if (fieldDesc.equals(constDesc) && !fieldName.equals(nameString)) {
				FieldMember field = initialClassState.getDeclaredField(fieldName, fieldDesc);
				if (field != null && field.hasEnumModifier())
					context.getMappings().addField(initialClassState.getName(), constDesc, fieldName, nameString);
			}
		}
	}
A transformer that creates mappings to rename obfuscated enum constants that have been not properly obfuscated.

@author Matt Coley
recaf-core/src/main/java/software/coley/recaf/services/deobfuscation/transform/generic/EnumNameRestorationTransformer.java