From fe028a1e42aea7a67e81f8e9d025533f74d54c7c Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 5 May 2011 18:56:39 +0000 Subject: [PATCH] Override toString in the enum we use for testing, to be sure we don't rely on it in our internals. We actually do use the toString value, but only in constructing the cache key for a query, which should generally not result in badness, unless you override your enums to not return unique strings for different enum values. It's looking like the Postgres4 driver calls createArray with an Object[] full of enums, and it calls toString on the values in the array. I have an idea for how to fix that, which is coming up next. --- src/test/java/com/samskivert/depot/EnumKeyRecord.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/samskivert/depot/EnumKeyRecord.java b/src/test/java/com/samskivert/depot/EnumKeyRecord.java index 4b74ab7..8062d36 100644 --- a/src/test/java/com/samskivert/depot/EnumKeyRecord.java +++ b/src/test/java/com/samskivert/depot/EnumKeyRecord.java @@ -20,7 +20,14 @@ public class EnumKeyRecord extends PersistentRecord public static final int SCHEMA_VERSION = 1; - public enum Type { A, B, C, D }; + public enum Type { + A, B, C, D; + + // override toString to be sure that we don't rely on it in our internals + public String toString () { + return "Type:" + name(); + } + }; /** The type is key. */ @Id public Type type;