1
mirror of https://github.com/CarmJos/EasyConfiguration.git synced 2026-06-04 18:48:20 +08:00
huanmeng-qwq
2025-09-27 02:59:34 +08:00
committed by Carm
parent 4a0e6b0676
commit 6a03d446a3
@@ -88,8 +88,9 @@ public class ValueAdapterRegistry {
@SuppressWarnings("unchecked")
public <T> @Nullable ValueAdapter<T> adapterOf(@NotNull ValueType<T> type) {
ValueAdapter<?> cached = adapterCache.get(type);
if (cached != null) return (ValueAdapter<T>) cached;
if (adapterCache.containsKey(type)) {
return (ValueAdapter<T>) adapterCache.get(type);
}
for (ValueAdapter<?> adapter : adapters) {
if (adapter.type().equals(type)) {
@@ -154,11 +155,14 @@ public class ValueAdapterRegistry {
private <T> T deserializeArray(@NotNull ConfigurationHolder<?> holder, @NotNull ValueType<T> 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));