From cc1bae06359c36bb78f66a0b55cd00edd90400b6 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 5 Sep 2025 14:35:45 -0700 Subject: [PATCH] Be extra thorough in checking types. Someone migrating from the old List> to the new List can get bitten at runtime without this check. --- .../java/com/samskivert/depot/impl/DepotMarshaller.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/samskivert/depot/impl/DepotMarshaller.java b/src/main/java/com/samskivert/depot/impl/DepotMarshaller.java index 0119840..690ca33 100644 --- a/src/main/java/com/samskivert/depot/impl/DepotMarshaller.java +++ b/src/main/java/com/samskivert/depot/impl/DepotMarshaller.java @@ -951,6 +951,15 @@ public class DepotMarshaller implements QueryMarshal definition.add((IndexDesc)config); } else if (config instanceof List) { @SuppressWarnings("unchecked") List defs = (List)config; + // double check that their list contains objects of the correct type + if (defs.size() > 0) { + Object def = defs.get(0); + if (!(def instanceof IndexDesc)) { + throw new IllegalArgumentException( + "Method '" + name + "' must return ColumnExp[], SQLExpression or " + + "List"); + } + } definition.addAll(defs); } else { throw new IllegalArgumentException(