From 680fef1a0f49d8706fd58093da63a2d9438d0641 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 7 Dec 2021 17:54:21 +0000 Subject: More minor fixes. --- src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/Java/gtPlusPlus/core/util') diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index e0634dfb14..1ef925f793 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -432,6 +432,18 @@ public class ReflectionUtils { t.printStackTrace(); } } + + /** + * Allows to change the state of an immutable instance. Huh?!? + */ + public static void setFinalFieldValue(Class clazz, Field field, Object newValue) { + try { + setFieldValue_Internal(clazz, field, newValue); + } + catch (Throwable t) { + t.printStackTrace(); + } + } @Deprecated public static void setFinalStatic(Field field, Object newValue) throws Exception { -- cgit