[ http://jira.codehaus.org/browse/XDP-177?page=all ]

Diogo Bacelar Quintela updated XDP-177:
---------------------------------------

    Description: 
Tags marked as unique through the use of  @qtags.once don't work as expected.

The duplicate check is called at validateLocation inherited from XdocletTag 
that is called at constructor level. It checks for the context (the qdox-java 
element where the tag bellongs [class, method, field, etc]) for the existence 
of other tags with the same name. The problem is that qdox's ModelBuilder only 
add all the found tags after it processes them all, so the check at 
validateLocation allways finds 0 (zero) references to tags with same name.

-- start snip ---
private void addJavaDoc(AbstractJavaEntity entity) {
        if (lastComment == null) return;

        entity.setComment(lastComment);
        
        Iterator tagDefIterator = lastTagSet.iterator();
        List tagList = new ArrayList();
        while (tagDefIterator.hasNext()) {
            TagDef tagDef = (TagDef) tagDefIterator.next();
            tagList.add( 
                docletTagFactory.createDocletTag(
                    tagDef.name, tagDef.text, 
                    entity, tagDef.lineNumber
                )
            );
        }
        entity.setTags(tagList);
        
        lastComment = null;
    }
-- end snip ---

This patch is an interproject patch: xdoclet2 and xdoclet-plugins (qtags 
module);
at xdoclet2, in QDoxMetadataProvider at method getMetadata i've encapsulated 
the DocletTagFactory used with a simple
delegating factory that captures all XdocletTags.
In the end of  metadata gathering it envokes for each XdocletTag an method 
validateModel. At that time the context already has all the tags added, so the 
same check  described above will work.

In xdoclet-plugins (qtags module) we override that validateModel method, and we 
make there the condition check.

This patch could maybe be prepared at qdox level, but that is an almost a dead 
project atm :|, while  xdoclet2 and xdoclet-plugins are not.

So xdoclet2 devs, please take some minutes to give your opinion.
Regards
Diogo

Check XDOCLET-47 for xdoclet2 patch

  was:
Tags marked as unique through the use of  @qtags.once don't work as expected.

The duplicate check is called at validateLocation inherited from XdocletTag 
that is called at constructor level. It checks for the context (the qdox-java 
element where the tag bellongs [class, method, field, etc]) for the existence 
of other tags with the same name. The problem is that qdox's ModelBuilder only 
add all the found tags after it processes them all, so the check at 
validateLocation allways finds 0 (zero) references to tags with same name.

-- start snip ---
private void addJavaDoc(AbstractJavaEntity entity) {
        if (lastComment == null) return;

        entity.setComment(lastComment);
        
        Iterator tagDefIterator = lastTagSet.iterator();
        List tagList = new ArrayList();
        while (tagDefIterator.hasNext()) {
            TagDef tagDef = (TagDef) tagDefIterator.next();
            tagList.add( 
                docletTagFactory.createDocletTag(
                    tagDef.name, tagDef.text, 
                    entity, tagDef.lineNumber
                )
            );
        }
        entity.setTags(tagList);
        
        lastComment = null;
    }
-- end snip ---

This patch is an interproject patch: xdoclet2 and xdoclet-plugins (qtags 
module);
at xdoclet2, in QDoxMetadataProvider at method getMetadata i've encapsulated 
the DocletTagFactory used with a simple
delegating factory that captures all XdocletTags.
In the end of  metadata gathering it envokes for each XdocletTag an method 
validateModel. At that time the context already has all the tags added, so the 
same check  described above will work.

In xdoclet-plugins (qtags module) we override that validateModel method, and we 
make there the condition check.

This patch could maybe be prepared at qdox level, but that is an almost a dead 
project atm :|, while  xdoclet2 and xdoclet-plugins are not.

So xdoclet2 devs, please take some minutes to give your opinion.
Regards
Diogo



> @qtags.once doesn't work as expected
> ------------------------------------
>
>          Key: XDP-177
>          URL: http://jira.codehaus.org/browse/XDP-177
>      Project: XDoclet 2 Plugins
>         Type: Bug

>   Components: qtags
>     Versions: 1.0.4, 1.0.3
>     Reporter: Diogo Bacelar Quintela
>     Priority: Critical
>  Attachments: xdoclet-plugins-duplicate-tags-patch.txt
>
> Original Estimate: 30 minutes
>         Remaining: 30 minutes
>
> Tags marked as unique through the use of  @qtags.once don't work as expected.
> The duplicate check is called at validateLocation inherited from XdocletTag 
> that is called at constructor level. It checks for the context (the qdox-java 
> element where the tag bellongs [class, method, field, etc]) for the existence 
> of other tags with the same name. The problem is that qdox's ModelBuilder 
> only add all the found tags after it processes them all, so the check at 
> validateLocation allways finds 0 (zero) references to tags with same name.
> -- start snip ---
> private void addJavaDoc(AbstractJavaEntity entity) {
>         if (lastComment == null) return;
>         entity.setComment(lastComment);
>         
>         Iterator tagDefIterator = lastTagSet.iterator();
>         List tagList = new ArrayList();
>         while (tagDefIterator.hasNext()) {
>             TagDef tagDef = (TagDef) tagDefIterator.next();
>             tagList.add( 
>                 docletTagFactory.createDocletTag(
>                     tagDef.name, tagDef.text, 
>                     entity, tagDef.lineNumber
>                 )
>             );
>         }
>         entity.setTags(tagList);
>         
>         lastComment = null;
>     }
> -- end snip ---
> This patch is an interproject patch: xdoclet2 and xdoclet-plugins (qtags 
> module);
> at xdoclet2, in QDoxMetadataProvider at method getMetadata i've encapsulated 
> the DocletTagFactory used with a simple
> delegating factory that captures all XdocletTags.
> In the end of  metadata gathering it envokes for each XdocletTag an method 
> validateModel. At that time the context already has all the tags added, so 
> the same check  described above will work.
> In xdoclet-plugins (qtags module) we override that validateModel method, and 
> we make there the condition check.
> This patch could maybe be prepared at qdox level, but that is an almost a 
> dead project atm :|, while  xdoclet2 and xdoclet-plugins are not.
> So xdoclet2 devs, please take some minutes to give your opinion.
> Regards
> Diogo
> Check XDOCLET-47 for xdoclet2 patch

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
xdoclet-plugins-interest mailing list
xdoclet-plugins-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-plugins-interest

Reply via email to