From e4233780309bf2dbe56502112a6c78746138fb76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C4=81rlis=20=C4=8Cer=C5=86avskis?= Date: Thu, 4 Apr 2024 17:05:27 +0300 Subject: [PATCH] I am stupid: Not all types are generic --- build.properties | 2 +- .../infernalstudios/config/element/ListConfigElement.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index 69d938c..13bc947 100644 --- a/build.properties +++ b/build.properties @@ -1,3 +1,3 @@ -VERSION=4.0.2-SNAPSHOT +VERSION=4.0.3-SNAPSHOT GROUP=org.infernalstudios ARTIFACT=config diff --git a/src/main/java/org/infernalstudios/config/element/ListConfigElement.java b/src/main/java/org/infernalstudios/config/element/ListConfigElement.java index 00916dc..6e549ba 100644 --- a/src/main/java/org/infernalstudios/config/element/ListConfigElement.java +++ b/src/main/java/org/infernalstudios/config/element/ListConfigElement.java @@ -71,7 +71,10 @@ public ListConfigElement(Field field, IConfigElementHandler handler) { ParameterizedType parameterized = (ParameterizedType) field.getGenericType(); Type[] typeArgs = parameterized.getActualTypeArguments(); String genericTypeName = typeArgs[0].getTypeName(); - Class genericType = Class.forName(genericTypeName.substring(0, genericTypeName.indexOf("<"))); + String typeName = genericTypeName.indexOf("<") != -1 ? + genericTypeName.substring(0, genericTypeName.indexOf("<")) : + genericTypeName; + Class genericType = Class.forName(typeName); this.serializeHandler = serializeClass.getDeclaredMethod(serializeMethod, genericType); } catch (NoSuchMethodException e) { throw new IllegalStateException("Could not find method for serialization handler", e);