From 6a03d446a3389361cf14010ef19320e36ddf3699 Mon Sep 17 00:00:00 2001 From: huanmeng-qwq <1871735932@qq.com> Date: Sat, 27 Sep 2025 02:59:34 +0800 Subject: [PATCH] fix: https://github.com/CarmJos/configured/pull/185#pullrequestreview-3273500562 --- .../adapter/ValueAdapterRegistry.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/cc/carm/lib/configuration/adapter/ValueAdapterRegistry.java b/core/src/main/java/cc/carm/lib/configuration/adapter/ValueAdapterRegistry.java index c277552..c6d91f2 100644 --- a/core/src/main/java/cc/carm/lib/configuration/adapter/ValueAdapterRegistry.java +++ b/core/src/main/java/cc/carm/lib/configuration/adapter/ValueAdapterRegistry.java @@ -88,8 +88,9 @@ public class ValueAdapterRegistry { @SuppressWarnings("unchecked") public @Nullable ValueAdapter adapterOf(@NotNull ValueType type) { - ValueAdapter cached = adapterCache.get(type); - if (cached != null) return (ValueAdapter) cached; + if (adapterCache.containsKey(type)) { + return (ValueAdapter) adapterCache.get(type); + } for (ValueAdapter adapter : adapters) { if (adapter.type().equals(type)) { @@ -154,11 +155,14 @@ public class ValueAdapterRegistry { private T deserializeArray(@NotNull ConfigurationHolder holder, @NotNull ValueType type, @NotNull Object source, @NotNull Class rawType) throws Exception { - if (!(source instanceof List)) { - source = deserializeList(holder, type, source); + List list; + if (source instanceof List) { + list = (List) source; + } else { + // For non-list sources, treat as single element array + list = Collections.singletonList(source); } - List list = (List) source; int size = list.size(); if (size == 0) { return type.cast(Array.newInstance(rawType.getComponentType(), 0));