diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2009-05-16 18:01:50 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2009-05-16 18:01:50 +0000 |
commit | dea148de4ff5bf42ff73397888cd36b5be6a9d63 (patch) | |
tree | 215d67e29f92a4f328f850cd99d422e79c232191 /src/main/java/com/amazon/carbonado | |
parent | 6806b3a6fff3f236ae41ab741618b3ad51a64783 (diff) |
Fix bug when overriding final void method. Fix bug in generating writeTo/readFrom methods which throw SupportException.
Diffstat (limited to 'src/main/java/com/amazon/carbonado')
-rw-r--r-- | src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java | 3 | ||||
-rw-r--r-- | src/main/java/com/amazon/carbonado/gen/StorableGenerator.java | 4 |
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;
}
|