From b956b6fde3a1a3e485956f1075412fa8a52e8fe9 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Tue, 14 Aug 2007 17:09:20 +0000 Subject: Removed support for Storable definition to accept Repository in constructor. --- .../amazon/carbonado/gen/StorableGenerator.java | 46 ++-------------------- 1 file changed, 4 insertions(+), 42 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/gen') diff --git a/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java b/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java index 41ba8b9..388b52a 100644 --- a/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java +++ b/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java @@ -21,9 +21,7 @@ package com.amazon.carbonado.gen; import java.lang.annotation.Annotation; import java.lang.ref.Reference; import java.lang.ref.SoftReference; -import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; @@ -451,8 +449,8 @@ public final class StorableGenerator { final int supportParam = 0; MethodInfo mi = mClassFile.addConstructor(Modifiers.PROTECTED, params); CodeBuilder b = new CodeBuilder(mi); - - addInvokeSuperConstructor(b, supportParam); + b.loadThis(); + b.invokeSuperConstructor(null); //// this.support = support b.loadThis(); @@ -468,8 +466,8 @@ public final class StorableGenerator { final int wrappedStorableParam = 1; MethodInfo mi = mClassFile.addConstructor(Modifiers.PUBLIC, params); CodeBuilder b = new CodeBuilder(mi); - - addInvokeSuperConstructor(b, wrappedSupportParam); + b.loadThis(); + b.invokeSuperConstructor(null); //// this.wrappedSupport = wrappedSupport b.loadThis(); @@ -1961,42 +1959,6 @@ public final class StorableGenerator { } } - /** - * Generates code to invoke super class constructor with no arguments or a - * Repository. - */ - private void addInvokeSuperConstructor(CodeBuilder b, final int supportParam) { - // Look for constructor that accepts a Repository. - - boolean passRepo = false; - { - for (Constructor c : mStorableType.getDeclaredConstructors()) { - int modifiers = c.getModifiers(); - if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) { - continue; - } - if (c.getParameterTypes().length == 1) { - if (c.getParameterTypes()[0] == Repository.class) { - passRepo = true; - break; - } - } - } - } - - b.loadThis(); - - if (passRepo) { - b.loadLocal(b.getParameter(supportParam)); - b.invokeInterface(StorableSupport.class.getName(), "getRootRepository", - TypeDesc.forClass(Repository.class), null); - b.invokeSuperConstructor(new TypeDesc[] {TypeDesc.forClass(Repository.class)}); - } else { - // Assume no-arg constructor. - b.invokeSuperConstructor(null); - } - } - /** * If GEN_WRAPPED, generates a method implementation which delgates to the * WrappedSupport. Also clears join property state if called method -- cgit v1.2.3