@Override
	@SuppressWarnings("OptionalGetWithoutIsPresent")
	public void transform(@Nonnull JvmTransformerContext context, @Nonnull Workspace workspace,
	                      @Nonnull WorkspaceResource resource, @Nonnull JvmClassBundle bundle,
	                      @Nonnull JvmClassInfo initialClassState) throws TransformationException {
		var staticValueCollector = context.getJvmTransformer(StaticValueCollectionTransformer.class);

		boolean dirty = false;
		ClassNode node = context.getNode(bundle, initialClassState);
		for (MethodNode method : node.methods) {
			// Skip static initializer and abstract methods
			if (method.name.contains("<clinit>") || method.instructions == null)
				continue;

			for (AbstractInsnNode instruction : method.instructions) {
				if (instruction instanceof FieldInsnNode fieldInsn) {
					// Get the known value of the static field
					ReValue value = staticValueCollector.getStaticValue(fieldInsn.owner, fieldInsn.name, fieldInsn.desc);
					if (value == null)
						continue;

					// Replace static get calls with their known values
					if (value.hasKnownValue()) {
						switch (value) {
							case IntValue intValue -> {
								method.instructions.set(instruction, AsmInsnUtil.intToInsn(intValue.value().getAsInt()));
								dirty = true;
							}
							case LongValue longValue -> {
								method.instructions.set(instruction, AsmInsnUtil.longToInsn(longValue.value().getAsLong()));
								dirty = true;
							}
							case DoubleValue doubleValue -> {
								method.instructions.set(instruction, AsmInsnUtil.doubleToInsn(doubleValue.value().getAsDouble()));
								dirty = true;
							}
							case FloatValue floatValue -> {
								method.instructions.set(instruction, AsmInsnUtil.floatToInsn((float) floatValue.value().getAsDouble()));
								dirty = true;
							}
							case StringValue stringValue -> {
								method.instructions.set(instruction, new LdcInsnNode(stringValue.getText().get()));
								dirty = true;
							}
							default -> {
								// no-op
							}
						}
					} else if (value == ObjectValue.VAL_OBJECT_NULL) {
						method.instructions.set(instruction, new InsnNode(Opcodes.ACONST_NULL));
						dirty = true;
					}
				}
			}
		}

		// Record transformed class if we made any changes
		if (dirty)
			context.setNode(bundle, initialClassState, node);
	}
A transformer that inlines values from {@link StaticValueCollectionTransformer}.

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