summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2010-06-03 18:59:30 -0700
committerShawn O. Pearce <sop@google.com>2010-06-04 12:44:45 -0700
commit1201971bfed3566a3cdfc52c8796269bb9c24e47 (patch)
tree55aa76bd057a1d3583abcf039854cb96747df0a4
parent5f999f92aa74a7a77d439b057c1c802c7eb0e38c (diff)
downloadgwtorm-1201971bfed3566a3cdfc52c8796269bb9c24e47.tar.gz
Fix protobuf code generation for Timestamp
We forgot to push the field value onto the stack, so we couldn't invoke getTime() on the timestamp object. This resulted in a class verification error. We also failed to denote the constructor as taking a primitive long, causing a class verification error when a long was found where an uninitialized object was expected. Change-Id: I4c60fac33f2c1c8dea02d97ac6ad4522ffacf3b6 Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--src/main/java/com/google/gwtorm/protobuf/CodecGen.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/google/gwtorm/protobuf/CodecGen.java b/src/main/java/com/google/gwtorm/protobuf/CodecGen.java
index 05e5d6d..eb26460 100644
--- a/src/main/java/com/google/gwtorm/protobuf/CodecGen.java
+++ b/src/main/java/com/google/gwtorm/protobuf/CodecGen.java
@@ -272,6 +272,7 @@ class CodecGen<T> implements Opcodes {
|| f.getPrimitiveType() == java.util.Date.class
|| f.getPrimitiveType() == java.sql.Date.class) {
cgs.push(f.getColumnID());
+ cgs.pushFieldValue();
String tsType = Type.getType(f.getPrimitiveType()).getInternalName();
mv.visitMethodInsn(INVOKEVIRTUAL, tsType, "getTime", Type
.getMethodDescriptor(Type.LONG_TYPE, new Type[] {}));
@@ -649,8 +650,9 @@ class CodecGen<T> implements Opcodes {
mv.visitTypeInsn(NEW, tsType);
mv.visitInsn(DUP);
cgs.call("readFixed64", Type.LONG_TYPE);
- mv.visitMethodInsn(INVOKESPECIAL, tsType, "<init>", Type
- .getMethodDescriptor(Type.VOID_TYPE, new Type[] {}));
+ mv.visitMethodInsn(INVOKESPECIAL, tsType, "<init>", //
+ Type.getMethodDescriptor(Type.VOID_TYPE,
+ new Type[] {Type.LONG_TYPE}));
} else {
throw new OrmException("Type " + f.getPrimitiveType()