Return-Path: Delivered-To: apmail-db-jdo-dev-archive@www.apache.org Received: (qmail 47772 invoked from network); 11 Aug 2005 16:01:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Aug 2005 16:01:28 -0000 Received: (qmail 67345 invoked by uid 500); 11 Aug 2005 16:01:28 -0000 Mailing-List: contact jdo-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-dev@db.apache.org Received: (qmail 67332 invoked by uid 99); 11 Aug 2005 16:01:28 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Aug 2005 09:01:28 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.98.34] (HELO brmea-mail-3.sun.com) (192.18.98.34) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Aug 2005 09:01:48 -0700 Received: from fe3.sun.com (fe3.Sun.COM [192.18.108.80] (may be forged)) by brmea-mail-3.sun.com (8.12.10/8.12.9) with ESMTP id j7BG1PvU007906 for ; Thu, 11 Aug 2005 10:01:25 -0600 (MDT) Received: from conversion-daemon.fe3.sun.com by fe3.sun.com (Sun Java System Messaging Server 6.1 HotFix 0.02 (built Aug 25 2004)) id <0IL200E01DQT5B00@fe3.sun.com> (original mail from Craig.Russell@Sun.COM) for jdo-dev@db.apache.org; Thu, 11 Aug 2005 10:01:25 -0600 (MDT) Received: from [129.146.30.210] by fe3.sun.com (Sun Java System Messaging Server 6.1 HotFix 0.02 (built Aug 25 2004)) with ESMTPSA id <0IL200MD4F6CBN42@fe3.sun.com> for jdo-dev@db.apache.org; Thu, 11 Aug 2005 10:01:25 -0600 (MDT) Date: Thu, 11 Aug 2005 09:01:28 -0700 From: Craig Russell Subject: Re: Patch for review: fix for JDO-81 In-reply-to: <42FB6E54.600@spree.de> To: jdo-dev@db.apache.org Message-id: <5959D712-CB6F-423B-A4F8-4BD74C6D17DC@Sun.COM> MIME-version: 1.0 X-Mailer: Apple Mail (2.733) Content-type: multipart/alternative; boundary="Boundary_(ID_4hcBEXBO/UMNprrV1cIY+g)" References: <42FB6E54.600@spree.de> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --Boundary_(ID_4hcBEXBO/UMNprrV1cIY+g) Content-type: text/plain; format=flowed; delsp=yes; charset=US-ASCII Content-transfer-encoding: 7BIT Hi Michael, Great. I didn't see any issues. Thanks, Craig On Aug 11, 2005, at 8:27 AM, Michael Bouschen wrote: > Hi Martin, hi Craig, > > today one test in fostore20 fails: Test_EmpDeptAppId. The enhancer > from the enhancer20 project generates a method > jdoNewObjectIdInstance(Object) throwing an > UnsupportedOperationException. I changed the enhancer to generate > the old code as it was generated for the JDO1 method > jdoNewObjectIdInstance(String). I just added a cast expression for > the Object argument before it is passed to the ObjectId constructor. > > This change is a workaround allowing the test to pass. It is not a > full implementation of jdoNewObjectIdInstance, because it lacks > support for single field identity. Attached you find a patch. > > Regards Michael > > -- > Michael Bouschen Tech@Spree Engineering GmbH > mailto:mbo.tech@spree.de http://www.tech.spree.de/ > Tel.:++49/30/235 520-33 Buelowstr. 66 > Fax.:++49/30/2175 2012 D-10783 Berlin > > Index: src/java/org/apache/jdo/impl/enhancer/generator/ImplHelper.java > =================================================================== > --- src/java/org/apache/jdo/impl/enhancer/generator/ > ImplHelper.java (revision 231450) > +++ src/java/org/apache/jdo/impl/enhancer/generator/ > ImplHelper.java (working copy) > @@ -392,9 +392,12 @@ > String o) > { > final List impl = new ArrayList(5); > - // TODO: generate real method body > - String msg = "Method jdoNewObjectIdInstance not yet > supported"; > - impl.add("throw new UnsupportedOperationException(\"" + > msg + "\");"); > + if (oidclassname == null) { > + impl.add("return null;"); > + } else { > + // TODO: support for single field identity > + impl.add("return new " + oidclassname + "((String)" + > o + ");"); > + } > return impl; > } > > Index: src/java/org/apache/jdo/impl/enhancer/core/Builder.java > =================================================================== > --- src/java/org/apache/jdo/impl/enhancer/core/Builder.java > (revision 231450) > +++ src/java/org/apache/jdo/impl/enhancer/core/Builder.java > (working copy) > @@ -3040,8 +3040,61 @@ > final String methodName = > JDO_PC_jdoNewObjectIdInstance_Object_Name; > final String methodSig = > JDO_PC_jdoNewObjectIdInstance_Object_Sig; > final int accessFlags = > JDO_PC_jdoNewObjectIdInstance_Object_Mods; > - // TODO: generate real method body > - addNotYetImplementedMethod(methodName, methodSig, > accessFlags); > + final ExceptionsAttribute exceptAttr = null; > + > + // begin of method body > + final InsnTarget begin = new InsnTarget(); > + Insn insn = begin; > + > + // generate empty method in case of datastore identity > + final String keyClassName = analyzer.getKeyClassName(); > + if (keyClassName == null){ > + // end of method body > + insn = insn.append(Insn.create(opc_aconst_null)); > + insn = insn.append(Insn.create(opc_areturn)); > + > + final CodeAttribute codeAttr > + = new CodeAttribute(getCodeAttributeUtf8(), > + 1, // maxStack > + 2, // maxLocals > + begin, > + new ExceptionTable(), > + new AttributeVector()); > + augmenter.addMethod(methodName, methodSig, accessFlags, > + codeAttr, exceptAttr); > + return; > + } > + affirm(keyClassName != null); > + > + // TODO: support for single field identity > + > + // push a newly created an instance of this class > + insn = insn.append( > + Insn.create(opc_new, > + pool.addClass(keyClassName))); > + insn = insn.append(Insn.create(opc_dup)); > + insn = insn.append(Insn.create(opc_aload_1)); > + insn = insn.append(Insn.create(opc_checkcast, > + pool.addClass > (JAVA_String_Path))); > + insn = insn.append( > + Insn.create(opc_invokespecial, > + pool.addMethodRef( > + keyClassName, > + NameHelper.constructorName(), > + NameHelper.constructorSig > (JAVA_String_Sig)))); > + > + // end of method body > + insn = insn.append(Insn.create(opc_areturn)); > + > + final CodeAttribute codeAttr > + = new CodeAttribute(getCodeAttributeUtf8(), > + 3, // maxStack > + 2, // maxLocals > + begin, > + new ExceptionTable(), > + new AttributeVector()); > + augmenter.addMethod(methodName, methodSig, accessFlags, > + codeAttr, exceptAttr); > } > > // > ---------------------------------------------------------------------- > Craig Russell Architect, Sun Java Enterprise System http://java.sun.com/products/jdo 408 276-5638 mailto:Craig.Russell@sun.com P.S. A good JDO? O, Gasp! --Boundary_(ID_4hcBEXBO/UMNprrV1cIY+g)--