diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2006-09-12 21:55:11 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2006-09-12 21:55:11 +0000 |
commit | 2b6eaf1ba86117afea79e2416d97b0ed12f30795 (patch) | |
tree | 96e8f6d5522003e7700700745478671206cfe9e2 | |
parent | b845f7f86bfb7150924d968335535ce26c592b82 (diff) |
Join short-circuit if external property cannot be null.
-rw-r--r-- | src/main/java/com/amazon/carbonado/spi/StorableGenerator.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/main/java/com/amazon/carbonado/spi/StorableGenerator.java b/src/main/java/com/amazon/carbonado/spi/StorableGenerator.java index 4972bfa..f63a260 100644 --- a/src/main/java/com/amazon/carbonado/spi/StorableGenerator.java +++ b/src/main/java/com/amazon/carbonado/spi/StorableGenerator.java @@ -645,10 +645,10 @@ public final class StorableGenerator<S extends Storable> { // Store loaded join result here.
LocalVariable join = b.createLocalVariable(name, type);
- // Check if any internal properties may be null, but
- // the matching external property is primitive. If so,
- // load each of these special internal values and check
- // if null. If so, short-circuit the load and use null
+ // Check if any internal properties are nullable, but
+ // the matching external property is not. If so, load
+ // each of these special internal values and check if
+ // null. If null, short-circuit the load and use null
// as the join result.
Label shortCircuit = b.createLabel();
@@ -658,8 +658,7 @@ public final class StorableGenerator<S extends Storable> { for (int i=0; i<count; i++) {
StorableProperty internal = property.getInternalJoinElement(i);
StorableProperty external = property.getExternalJoinElement(i);
- if (!internal.getType().isPrimitive() &&
- external.getType().isPrimitive()) {
+ if (internal.isNullable() && !external.isNullable()) {
break nullPossible;
}
}
@@ -669,9 +668,7 @@ public final class StorableGenerator<S extends Storable> { for (int i=0; i<count; i++) {
StorableProperty internal = property.getInternalJoinElement(i);
StorableProperty external = property.getExternalJoinElement(i);
- if (!internal.getType().isPrimitive() &&
- external.getType().isPrimitive()) {
-
+ if (internal.isNullable() && !external.isNullable()) {
if (mGenMode == GEN_ABSTRACT) {
b.loadThis();
b.loadField(internal.getName(),
|