[ 
http://opensource.atlassian.com/projects/xdoclet/browse/XJD-72?page=comments#action_17605
 ] 

Scott Sayles commented on XJD-72:
---------------------------------


Just thouht it might be nice to see a before and after of the generated parser 
code:

-------- (BEFORE) -------------
  final public void ExtendsList(boolean isInterface) throws ParseException {
   boolean extendsMoreThanOne = false;
   SourceClass sourceClass = currentClass();
   String name = null;
    jj_consume_token(EXTENDS);
    name = ClassOrInterfaceType();
    label_4:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        break label_4;
      }
      jj_consume_token(COMMA);
      name = ClassOrInterfaceType();
                                       extendsMoreThanOne = true;
    }
      if (extendsMoreThanOne && !isInterface) {if (true) throw new 
ParseException("A class cannot extend more than one other class");}
    //System.err.println("setSuperclass name=" + (name != null ? name : 
"java.lang.Object"));
    sourceClass.setSuperclass(name != null ? name : "java.lang.Object");
  }



-------- (AFTER) -------------
  final public void ExtendsList(boolean isInterface) throws ParseException {
   boolean extendsMoreThanOne = false;
   SourceClass sourceClass = currentClass();
   String name = null;
    jj_consume_token(EXTENDS);
    name = ClassOrInterfaceType();
    if (isInterface) sourceClass.addInterface(name);
    label_4:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        break label_4;
      }
      jj_consume_token(COMMA);
      name = ClassOrInterfaceType();
      extendsMoreThanOne = true;
      if (isInterface) sourceClass.addInterface(name);
    }
      if (extendsMoreThanOne && !isInterface) {if (true) throw new 
ParseException("A class cannot extend more than one other class");}
    //System.err.println("setSuperclass name=" + (name != null ? name : 
"java.lang.Object"));
    if (!isInterface) sourceClass.setSuperclass(name != null ? name : 
"java.lang.Object");
  }

> 1.5 parser - Declared interfaces of an inerface are not added
> -------------------------------------------------------------
>
>          Key: XJD-72
>          URL: http://opensource.atlassian.com/projects/xdoclet/browse/XJD-72
>      Project: XJavaDoc
>         Type: Bug

>   Components: Parser
>     Versions: 1.5
>     Reporter: Scott Sayles
>     Assignee: xdoclet-devel (Use for new issues)
>  Attachments: patch.diff
>
> Original Estimate: 1 hour
>         Remaining: 1 hour
>
> With a source class that is an interface that extends other interfaces, for 
> example....
> public interface Dog extends Animal, FurryThing {}
> The xjavadoc AbstractClass representation of this should return Animal and 
> FurryThing when asking it for it's declared interfaces.  While this worked in 
> the java1.2 parser, this does not with the 1.5 parser.
> Within the 1.5 parser (Java1.5x.jjt), the generated method 
> ExtendsList(boolean) only sets the super interface for the current class 
> regardless of whether or not it's an interface or a concrete class.
> I've created a patch that updates Java1.5x.jjt so that it will destinguish 
> between an interface and a concrete class and only set super class on the 
> concrete, and call sourceClass.addInterface(name) if it is an interface (for 
> all declared extending interfaces).  I'm not very familiar with the javacc 
> parser stuff so please excuse the naivety of the fix.  However, what is there 
> seems to work and all unit tests pass.  I'll add the patch soon after 
> entering this.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/xdoclet/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-devel mailing list
xdoclet-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to