Added code to check that objects have @Column annotations
If a class to be encoded has no @Column annotations the CodecGen
should throw an Exception, as a class with no @Column annotations
cannot be correctly represented on protobuf. I added a check to
scanFields to check for this, and throw an appropriate exception.
Change-Id: Ib6962d1b2e05e5b494ca0cee2091caa1f5daa731
diff --git a/src/main/java/com/google/gwtorm/protobuf/CodecGen.java b/src/main/java/com/google/gwtorm/protobuf/CodecGen.java
index 5a5342b..2aaf841 100644
--- a/src/main/java/com/google/gwtorm/protobuf/CodecGen.java
+++ b/src/main/java/com/google/gwtorm/protobuf/CodecGen.java
@@ -121,6 +121,10 @@
}
in = in.getSuperclass();
}
+ if (col.isEmpty()) {
+ throw new OrmException(
+ "Cannot create new encoder, no @Column fields found");
+ }
return sort(col);
}