@Override
	public void transform(@Nonnull JvmTransformerContext context, @Nonnull Workspace workspace,
	                      @Nonnull WorkspaceResource resource, @Nonnull JvmClassBundle bundle,
	                      @Nonnull JvmClassInfo initialClassState) throws TransformationException {
		// Skip non-enum classes.
		if (!initialClassState.hasEnumModifier()) return;

		// Record mappings for enum constants where the static initializer
		// leaks their original names (assuming the code is name obfuscated).
		ClassNode node = context.getNode(bundle, initialClassState);
		String constDesc = 'L' + node.name + ";";
		String valuesDesc = '[' + constDesc;
		for (MethodNode method : node.methods) {
			// Skip abstract methods.
			InsnList instructions = method.instructions;
			if (instructions == null)
				continue;

			// Skip any method that is not the static initializer.
			if (!method.name.equals("<clinit>") || !method.desc.equals("()V"))
				continue;

			// Pattern to match for constants:
			//   new ENUM_TYPE
			//   dup
			//   ldc "NAME_OF_CONSTANT"
			//   iconst_0
			//   invokespecial ENUM_TYPE.<init> (Ljava/lang/String;I)V   (may have additional arguments, but first two should be consistent)
			//   astore v0                                               (optional)
			//   aload v0                                                (optional)
			//   putstatic ENUM_TYPE.OBF_NAME_OF_CONSTANT LENUM_TYPE;
			// Pattern to match for $values array
			//   invokestatic ENUM_TYPE.$values ()[LENUM_TYPE;
			//   putstatic Example.OBF_NAME_OF_ARRAY [LENUM_TYPE;
			for (AbstractInsnNode instruction : instructions) {
				int op = instruction.getOpcode();
				if (op == LDC)
					handleEnumConst(context, initialClassState, (LdcInsnNode) instruction, constDesc);
				else if (op == INVOKESTATIC)
					handleValuesArray(context, initialClassState, (MethodInsnNode) instruction, valuesDesc);
			}
		}
	}
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