summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java3
-rw-r--r--src/main/java/com/amazon/carbonado/gen/StorableGenerator.java4
2 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java b/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java
index 3362ad0..f35024e 100644
--- a/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java
+++ b/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java
@@ -311,6 +311,9 @@ public class CodeBuilderUtil {
try {
Method existing = clazz.getMethod(name, paramClasses);
if (Modifier.isFinal(existing.getModifiers())) {
+ if (retType == null) {
+ retType = TypeDesc.forClass(void.class);
+ }
if (TypeDesc.forClass(existing.getReturnType()) == retType) {
// Method is already implemented and is final.
return true;
diff --git a/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java b/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java
index 4ea40e2..f6a41ca 100644
--- a/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java
+++ b/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java
@@ -2866,6 +2866,8 @@ public final class StorableGenerator<S extends Storable> {
try {
encodedVar = encoder.buildSerialEncoding(b, null);
} catch (SupportException e) {
+ // Wipe out any code generated so far.
+ b = new CodeBuilder(mi);
CodeBuilderUtil.throwException(b, SupportException.class, e.getMessage());
return;
}
@@ -2914,6 +2916,8 @@ public final class StorableGenerator<S extends Storable> {
try {
encoder.buildSerialDecoding(b, null, encodedVar);
} catch (SupportException e) {
+ // Wipe out any code generated so far.
+ b = new CodeBuilder(mi);
CodeBuilderUtil.throwException(b, SupportException.class, e.getMessage());
return;
}