diff --git a/commons-serialize-generator/src/main/java/io/gitlab/jfronny/commons/serialize/generator/SerializeGeneratorProcessor.java b/commons-serialize-generator/src/main/java/io/gitlab/jfronny/commons/serialize/generator/SerializeGeneratorProcessor.java index 83dfcfa..94e6903 100644 --- a/commons-serialize-generator/src/main/java/io/gitlab/jfronny/commons/serialize/generator/SerializeGeneratorProcessor.java +++ b/commons-serialize-generator/src/main/java/io/gitlab/jfronny/commons/serialize/generator/SerializeGeneratorProcessor.java @@ -114,7 +114,8 @@ public class SerializeGeneratorProcessor extends AbstractProcessor2 { switch (name) { case "adapter" -> { if (bld.adapter != null) throw new IllegalArgumentException("Duplicate annotation parameter: adapter"); - bld.adapter = (TypeMirror) value.getValue(); + if (value.getValue() instanceof TypeMirror tm) bld.adapter = tm; + else throw new IllegalArgumentException("Unexpected value type: " + value.getValue().getClass() + " (with value" + value.getValue() + ")"); } case "nullSafe" -> { if (bld.nullSafe != null) throw new IllegalArgumentException("Duplicate annotation parameter: nullSafe");