Hi Haroon,

I indeed forgot the diff for the MethodTagsHandler class. Sorry for the
mistake. I am attaching a file with the proper diff and updating the
blog.


Regards,

Nicolas


On Wed, Dec 07, 2005 at 05:04:04PM -0500, Haroon Rafique wrote:
> On Monday at 7:47pm, NL=>Nicolas Leroux <[EMAIL PROTECTED]> wrote:
> 
> NL> 
> NL> I checkout the CVS head version of xdoclet and modified it.
> NL> 
> NL> Regards,
> NL> 
> NL> Nicolas
> 
> 
> Hi Nicolas,
> 
> A few issues:
> 
> * while building xjavadoc, I had a failure in the junit tests:
> 
>     [junit] Running xjavadoc.XJavaDocTest
>     [junit] Tests run: 10, Failures: 1, Errors: 0, Time elapsed: 0.649 sec
> 
> Looking at TEST-xjavadoc.XJavaDocTest.txt I find this at the bottom:
> 
> Testcase: testInnerClass took 0.013 sec
> Testcase: testIsA took 0.041 sec
>     FAILED
> Hello is Action
> junit.framework.AssertionFailedError: Hello is Action
>     at xjavadoc.XJavaDocTest.testIsA(XJavaDocTest.java:221)
> 
> I commented out, the junit tests and eventually got the xjavadoc jar file.
> 
> * while building xdoclet, I had a failure during compilation:
> 
>   [builder] compile:
>   [builder]     [javac] Compiling 32 source files to 
> /home/haroon/src/dist/cvs-src/xdoclet/modules/build/ejb/classes
>   [builder]     [javac] 
> /home/haroon/src/dist/cvs-src/xdoclet/modules/ejb/src/xdoclet/modules/ejb/dd/RelationTagsHandler.java:384:
>  
> cannot find symbol
>   [builder]     [javac] symbol  : method stripGenerics(java.lang.String)
>   [builder]     [javac] location: class 
> xdoclet.tagshandler.MethodTagsHandler
>   [builder]     [javac]         return 
> MethodTagsHandler.stripGenerics(MethodTagsHandler.getMethodTypeFor(currentRelation.getLeftMethod()));
> 
> It looks like you added a method to MethodTagsHandler but it does not show 
> up in the diff.
> 
> Any ideas?
> --
> Haroon Rafique
> <[EMAIL PROTECTED]>
Index: core/src/xdoclet/tagshandler/MethodTagsHandler.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/core/src/xdoclet/tagshandler/MethodTagsHandler.java,v
retrieving revision 1.34
diff -b -u -r1.34 MethodTagsHandler.java
--- core/src/xdoclet/tagshandler/MethodTagsHandler.java 9 Apr 2005 15:16:56 
-0000       1.34
+++ core/src/xdoclet/tagshandler/MethodTagsHandler.java 8 Dec 2005 08:27:20 
-0000
@@ -113,6 +113,11 @@
         return hasExecutableMember(clazz, methodName, parameters, 
setCurrentMethod, FOR_METHOD);
     }

+    public static String stripGenerics(String methodName)
+    {
+        return methodName.replaceAll("\\<(.*)\\>", "");
+    }
+
     /**
      * Returns 'get' or 'is' getter prefix part of the current method. Returns 
empty string if the method doesn't start
      * with either of the two getter prefixes.
Index: modules/ejb/src/xdoclet/modules/ejb/dd/RelationTagsHandler.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/dd/RelationTagsHandler.java,v
retrieving revision 1.12
diff -u -r1.12 RelationTagsHandler.java
--- modules/ejb/src/xdoclet/modules/ejb/dd/RelationTagsHandler.java     15 Jan 
2005 01:11:39 -0000      1.12
+++ modules/ejb/src/xdoclet/modules/ejb/dd/RelationTagsHandler.java     6 Dec 
2005 10:30:04 -0000
@@ -21,7 +21,7 @@
 import xdoclet.util.TypeConversionUtil;
 
 /**
- * @author               <a href="mailto:[EMAIL PROTECTED]">Aslak Helles�y</a>
+ * @author               <a href="mailto:[EMAIL PROTECTED]">Aslak Helles?y</a>
  * @author               Ara Abrahamian ([EMAIL PROTECTED])
  * @created              Oct 15, 2001
  * @xdoclet.taghandler   namespace="EjbRel"
@@ -379,6 +379,12 @@
         return 
MethodTagsHandler.getMethodTypeFor(currentRelation.getLeftMethod());
     }
 
+    public String leftFieldTypeWithoutGenerics() throws XDocletException
+    {
+        return 
MethodTagsHandler.stripGenerics(MethodTagsHandler.getMethodTypeFor(currentRelation.getLeftMethod()));
+    }
+
+
     /**
      * Describe what the method does
      *
@@ -390,6 +396,11 @@
         return 
MethodTagsHandler.getMethodTypeFor(currentRelation.getRightMethod());
     }
 
+    public String rightFieldTypeWithoutGenerics() throws XDocletException
+    {
+        return 
MethodTagsHandler.stripGenerics(MethodTagsHandler.getMethodTypeFor(currentRelation.getRightMethod()));
+    }
+
     /**
      * Evaluates the body block if current method's return type is not a 
java.util.Collection or java.util.Set. Used by
      * forAllRelationships.
@@ -620,7 +631,8 @@
      */
     public String leftMultiplicity() throws XDocletException
     {
-        return currentRelation.getLeftMultiplicity();
+        //Strip down the generics
+        return currentRelation.getLeftMultiplicity().replace("\\<(.*)\\>", "");
     }
 
     /**
@@ -631,7 +643,7 @@
      */
     public String rightMultiplicity() throws XDocletException
     {
-        return currentRelation.getRightMultiplicity();
+        return currentRelation.getRightMultiplicity().replace("\\<(.*)\\>", 
"");
     }
 
     /**
@@ -642,7 +654,8 @@
      */
     protected boolean isSetOrCollection(String type)
     {
-        return (type.equals("java.util.Collection") || 
type.equals("java.util.Set"));
+        return (type.startsWith("java.util.Collection") || 
type.startsWith("java.util.Set")
+            || type.startsWith("Collection") || type.startsWith("Set"));
     }
 
     protected boolean hasRelationships()
@@ -679,7 +692,7 @@
     /**
      * Holds class/method of the two end points of a relationship.
      *
-     * @author    Aslak Helles�y
+     * @author    Aslak Helles?y
      * @created   August 28, 2001
      */
     public class RelationHolder
Index: modules/ejb/src/xdoclet/modules/ejb/dd/resources/relationships.xdt
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/dd/resources/relationships.xdt,v
retrieving revision 1.3
diff -u -r1.3 relationships.xdt
--- modules/ejb/src/xdoclet/modules/ejb/dd/resources/relationships.xdt  16 Apr 
2004 16:37:56 -0000      1.3
+++ modules/ejb/src/xdoclet/modules/ejb/dd/resources/relationships.xdt  6 Dec 
2005 10:30:06 -0000
@@ -19,7 +19,7 @@
             <cmr-field <XDtId:prefixedId prefix="CMRField"/>>
                <cmr-field-name><XDtEjbRel:leftFieldName/></cmr-field-name>
               <XDtEjbRel:ifIsLeftMany>
-               <cmr-field-type><XDtEjbRel:leftFieldType/></cmr-field-type>
+               
<cmr-field-type><XDtEjbRel:leftFieldTypeWithoutGenerics/></cmr-field-type>
               </XDtEjbRel:ifIsLeftMany>
             </cmr-field>
            </XDtEjbRel:ifLeftNavigable>
@@ -40,7 +40,7 @@
             <cmr-field <XDtId:prefixedId prefix="CMRField"/>>
                <cmr-field-name><XDtEjbRel:rightFieldName/></cmr-field-name>
               <XDtEjbRel:ifIsRightMany>
-               <cmr-field-type><XDtEjbRel:rightFieldType/></cmr-field-type>
+               
<cmr-field-type><XDtEjbRel:rightFieldTypeWithoutGenerics/></cmr-field-type>
               </XDtEjbRel:ifIsRightMany>
             </cmr-field>
            </XDtEjbRel:ifRightNavigable>
@@ -70,4 +70,4 @@
       </relationships>
     </XDtMerge:ifMergeFileExists>
   </XDtEjbRel:ifNotHasRelationships>
-  
\ No newline at end of file
+  
Index: modules/ejb/src/xdoclet/modules/ejb/home/HomeTagsHandler.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/home/HomeTagsHandler.java,v
retrieving revision 1.39
diff -u -r1.39 HomeTagsHandler.java
--- modules/ejb/src/xdoclet/modules/ejb/home/HomeTagsHandler.java       14 Aug 
2005 08:27:43 -0000      1.39
+++ modules/ejb/src/xdoclet/modules/ejb/home/HomeTagsHandler.java       6 Dec 
2005 10:30:07 -0000
@@ -211,10 +211,11 @@
         if (tagType.equals("ejb:finder")) {
             String ejbReturn = 
method.getReturnType().getType().getQualifiedName();
 
-            if (ejbReturn.equals("java.util.Collection") ||
-                ejbReturn.equals("java.util.Enumeration") ||
-                ejbReturn.equals("java.util.Set")) {
-                homeMethodName.append(ejbReturn);
+            if (ejbReturn.startsWith("java.util.Collection") ||
+                ejbReturn.startsWith("java.util.Enumeration") ||
+                ejbReturn.startsWith("java.util.Set")) {
+                ejbReturn = ejbReturn.replaceAll("<(.*?)>", "");
+                homeMethodName.append(ejbReturn + "<" + 
InterfaceTagsHandler.getComponentInterface(type, clazz) + ">");
 
             }
             else {
@@ -377,13 +378,13 @@
         String sign = st.nextToken();
         StringBuffer ret = new StringBuffer();
 
-        if (sign.equals("Collection") || sign.equals("java.util.Collection")) {
+        if (sign.startsWith("Collection") || 
sign.startsWith("java.util.Collection")) {
             ret.append("java.util.Collection");
         }
-        else if (sign.equals("Enumeration") || 
sign.equals("java.util.Enumeration")) {
+        else if (sign.startsWith("Enumeration") || 
sign.startsWith("java.util.Enumeration")) {
             ret.append("java.util.Enumeration");
         }
-        else if (sign.equals("Set") || sign.equals("java.util.Set")) {
+        else if (sign.startsWith("Set") || sign.startsWith("java.util.Set")) {
             ret.append("java.util.Set");
         }
         else {
@@ -915,6 +916,7 @@
                 }
 
                 setCurrentClassTag(tag);
+
                 setCurrentSignature(signature);
 
                 if (tag.getAttributeValue("unchecked") != null) {
@@ -1065,10 +1067,10 @@
     {
         String currentType = currentType();
 
-        if ("Collection".equals(currentType) ||
-            "java.util.Collection".equals(currentType) ||
-            "Set".equals(currentType) ||
-            "java.util.Set".equals(currentType)) {
+        if (currentType.startsWith("Collection") ||
+            currentType.startsWith("java.util.Collection") ||
+            currentType.startsWith("Set") ||
+            currentType.startsWith("java.util.Set")) {
             generate(template);
         }
     }

Reply via email to