From b42f69812c9f649973aaa0f3a9ab25c49478a281 Mon Sep 17 00:00:00 2001 From: Nikolai Amelichev Date: Mon, 26 Feb 2024 17:06:37 +0100 Subject: [PATCH] Revert FieldValueType.registerStringValueType() to old version --- .../java/tech/ydb/yoj/databind/FieldValueType.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/databind/src/main/java/tech/ydb/yoj/databind/FieldValueType.java b/databind/src/main/java/tech/ydb/yoj/databind/FieldValueType.java index a37fa535..9fd513b2 100644 --- a/databind/src/main/java/tech/ydb/yoj/databind/FieldValueType.java +++ b/databind/src/main/java/tech/ydb/yoj/databind/FieldValueType.java @@ -121,21 +121,14 @@ public enum FieldValueType { @Deprecated(forRemoval = true) @ExperimentalApi(issue = "https://github.com/ydb-platform/yoj-project/issues/24") public static void registerStringValueType(@NonNull Class clazz) { - ensureValidStringValueType(clazz); - STRING_VALUE_TYPES.add(clazz); - if (clazz.isSealed()) { - STRING_VALUE_TYPES.addAll(Arrays.asList(clazz.getPermittedSubclasses())); - } - } - - private static void ensureValidStringValueType(@NotNull Class clazz) { boolean isFinal = isFinal(clazz.getModifiers()); boolean isSealed = clazz.isSealed(); Preconditions.checkArgument(isFinal || isSealed, "String-value type must either be final or sealed, but got: %s", clazz); + STRING_VALUE_TYPES.add(clazz); if (isSealed) { - Arrays.stream(clazz.getPermittedSubclasses()).forEach(FieldValueType::ensureValidStringValueType); + Arrays.stream(clazz.getPermittedSubclasses()).forEach(FieldValueType::registerStringValueType); } }