From 8db740a9ebf715859a6487bbea9a3ec652999c96 Mon Sep 17 00:00:00 2001 From: JFronny Date: Wed, 24 Apr 2024 15:28:15 +0200 Subject: [PATCH] fix(serialize-generator): Additional explicit type check for debugging purposes --- .../serialize/generator/SerializeGeneratorProcessor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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");