QDox
  1. QDox
  2. QDOX-101

Multiple annotations on one field and generics

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.8
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      It would seem QDox cannot parse a Java 5 file that has more than one annotation on a field and generics are present.

      For example, this will parse fine:

      import javax.xml.bind.annotation.XmlID;
      import java.util.List;
      
      public class Person {
      
          protected List<String> address;
      
          @XmlID
          protected String name;
      
          public List<String> getAddress() {
              return address;
          }
      
          public void setAddress(List<String> address) {
              this.address = address;
          }
      
          public String getName() {
              return name;
          }
      
          public void setName(String name) {
              this.name = name;
          }
      }
      

      But this will fail:

      package org.openejb.alt.config.ejb;
      
      import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
      import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
      import javax.xml.bind.annotation.XmlID;
      import java.util.List;
      
      public class Person {
      
          protected List<String> address;
      
          @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
          @XmlID
          protected String name;
      
          public List<String> getAddress() {
              return address;
          }
      
          public void setAddress(List<String> address) {
              this.address = address;
          }
      
          public String getName() {
              return name;
          }
      
          public void setName(String name) {
              this.name = name;
          }
      }
      

      .. with this error:

      com.thoughtworks.qdox.parser.ParseException: syntax error @[16,38] in file:/Users/dblevins/work/openejb3/container/openejb-core/src/main/java/org/openejb/alt/config/ejb/Person.java
      at com.thoughtworks.qdox.parser.impl.Parser.yyerror(Parser.java:607)
      at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:715)
      at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:588)
      at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:300)
      at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:316)
      at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:312)
      at com.thoughtworks.qdox.JavaDocBuilder$1.visitFile(JavaDocBuilder.java:369)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:43)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.scan(DirectoryScanner.java:52)
      at com.thoughtworks.qdox.JavaDocBuilder.addSourceTree(JavaDocBuilder.java:366)

        Activity

        David Blevins made changes -
        Field Original Value New Value
        Summary Multiple annotations on one field Multiple annotations on one field and generics
        Description QDox cannot parse a Java 5 file that has more than one annotation on a field. It would seem QDox cannot parse a Java 5 file that has more than one annotation on a field and generics are present.

        For example, this will parse fine:

        {code}
        import javax.xml.bind.annotation.XmlID;
        import java.util.List;

        public class Person {

            protected List<String> address;

            @XmlID
            protected String name;

            public List<String> getAddress() {
                return address;
            }

            public void setAddress(List<String> address) {
                this.address = address;
            }

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }
        }
        {code}

        But this will fail:

        {code}
        package org.openejb.alt.config.ejb;

        import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
        import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
        import javax.xml.bind.annotation.XmlID;
        import java.util.List;

        public class Person {

            protected List<String> address;

            @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
            @XmlID
            protected String name;

            public List<String> getAddress() {
                return address;
            }

            public void setAddress(List<String> address) {
                this.address = address;
            }

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }
        }
        {code}

        .. with this error:

        com.thoughtworks.qdox.parser.ParseException: syntax error @[16,38] in file:/Users/dblevins/work/openejb3/container/openejb-core/src/main/java/org/openejb/alt/config/ejb/Person.java
                at com.thoughtworks.qdox.parser.impl.Parser.yyerror(Parser.java:607)
                at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:715)
                at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:588)
                at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:300)
                at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:316)
                at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:312)
                at com.thoughtworks.qdox.JavaDocBuilder$1.visitFile(JavaDocBuilder.java:369)
                at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:43)
                at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
                at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
                at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
                at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
                at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
                at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
                at com.thoughtworks.qdox.directorywalker.DirectoryScanner.scan(DirectoryScanner.java:52)
                at com.thoughtworks.qdox.JavaDocBuilder.addSourceTree(JavaDocBuilder.java:366)
        Hide
        Paul Hammant added a comment -

        double annotations on own seem to be ok with that in Svn presently
        generics on own seem to be ok with that in Svn presently
        together they make it barf.

        See todo_testShouldNotChokeOnDoubleAttributeAnnotationAndGenerics() in AnnotationTestCase

        Show
        Paul Hammant added a comment - double annotations on own seem to be ok with that in Svn presently generics on own seem to be ok with that in Svn presently together they make it barf. See todo_testShouldNotChokeOnDoubleAttributeAnnotationAndGenerics() in AnnotationTestCase
        Hide
        Robert Scholte added a comment -

        doesn't seem to be a problem anymore on my machine. Don't no if it was resolved earlier or due to one of my fixes. I guess the first one.

        Show
        Robert Scholte added a comment - doesn't seem to be a problem anymore on my machine. Don't no if it was resolved earlier or due to one of my fixes. I guess the first one.
        Hide
        Robert Scholte added a comment -

        r517 | rfscholte | 2009-01-30 21:23:31 CET

        activated test for qdox-101; doesn't seem to fail

        Show
        Robert Scholte added a comment - r517 | rfscholte | 2009-01-30 21:23:31 CET activated test for qdox-101; doesn't seem to fail
        Robert Scholte made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s 1.8 [ 14826 ]
        Status Open [ 1 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            David Blevins
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: