QDox
  1. QDox
  2. QDOX-54

Support for retrieval of generic type information (JSR 14)

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      1

      Issue Links

        Activity

        Hide
        Aslak Hellesøy added a comment -

        gotta get the parser up to snuff first

        Show
        Aslak Hellesøy added a comment - gotta get the parser up to snuff first
        Aslak Hellesøy made changes -
        Field Original Value New Value
        Link This issue depends upon QDOX-53 [ QDOX-53 ]
        Hide
        Aslak Hellesøy added a comment -

        More specificly, what we need to do is to improve the QDox API to allow retrieval of generic parameters - similar to the new reflective API methods in JDK1.5. We should try to keep it as simple as possible though.

        Show
        Aslak Hellesøy added a comment - More specificly, what we need to do is to improve the QDox API to allow retrieval of generic parameters - similar to the new reflective API methods in JDK1.5. We should try to keep it as simple as possible though.
        Aslak Hellesøy made changes -
        Fix Version/s 1.6 [ 10814 ]
        Hide
        Mike Williams added a comment -

        I'm tentatively bumping this to 1.7, as I think we need to concentrate on getting a "Tiger tolerant" release out the door, before worrying about how to expose generic-type data (or annotation data, for that matter). Aslak, any objection?

        Show
        Mike Williams added a comment - I'm tentatively bumping this to 1.7, as I think we need to concentrate on getting a "Tiger tolerant" release out the door, before worrying about how to expose generic-type data (or annotation data, for that matter). Aslak, any objection?
        Mike Williams made changes -
        Fix Version/s 1.6 [ 10814 ]
        Fix Version/s 1.7 [ 11160 ]
        Hide
        Paul Hammant added a comment -

        How does it work now? does it barf or honor an aggressive type-erasure design

        Show
        Paul Hammant added a comment - How does it work now? does it barf or honor an aggressive type-erasure design
        Hide
        Arie Ozarov added a comment -

        Thanks guys, the project is very useful for our needs, mainly for the last two reasons mentioned on http://joe.truemesh.com/blog//000642.html (chicken and egg & javadoc and param names).

        When do you plan to expose Generic types?
        If two complex exposing them correctly (using their own representation) a valuable interim solution (at least for us) would be to include it as part of the Type#getValue (or a new Type#getRawValue) method.

        Show
        Arie Ozarov added a comment - Thanks guys, the project is very useful for our needs, mainly for the last two reasons mentioned on http://joe.truemesh.com/blog//000642.html (chicken and egg & javadoc and param names). When do you plan to expose Generic types? If two complex exposing them correctly (using their own representation) a valuable interim solution (at least for us) would be to include it as part of the Type#getValue (or a new Type#getRawValue) method.
        nicolas de loof made changes -
        Link This issue is depended upon by MGWT-1 [ MGWT-1 ]
        Paul Hammant made changes -
        Fix Version/s 1.8 [ 14826 ]
        Fix Version/s 1.7 [ 11160 ]
        Hide
        Robert Scholte added a comment -

        One of the projects I'm involved in is using gwt. They struggled a bit, and so I had the change to introduce maven. I managed to mavenize the project, but when using the gwt:generateAsync only half of the classes were properly generated. This issue was the very first issue for gwt, which depends on qdox.
        Of course I had to convince the other members of the power of maven, so I saw I nice challenge in this issue.
        I've started on it and I'm very far.
        Now it's time for writing a lot of tests, some code cleanups must be done, but I had to share this little success

        Show
        Robert Scholte added a comment - One of the projects I'm involved in is using gwt. They struggled a bit, and so I had the change to introduce maven. I managed to mavenize the project, but when using the gwt:generateAsync only half of the classes were properly generated. This issue was the very first issue for gwt, which depends on qdox. Of course I had to convince the other members of the power of maven, so I saw I nice challenge in this issue. I've started on it and I'm very far. Now it's time for writing a lot of tests, some code cleanups must be done, but I had to share this little success
        Hide
        Robert Scholte added a comment -

        Even sooner than expected, but here's my patch.
        In a view words:

        The parser (pojo)-classes
        TypeDef has a new attribute:
        public List actualArgumentTypes; // List<TypeDef>

        MethodDef has changed:
        String returns has been removed
        TypeDef returnType has been added

        FieldDef:
        String type is now TypeDef type;

        and a WildCardTypeDef-class has been added to support these Types

        The qdox.model:
        Of course Type has been modified. It has now actualArgumentType and most important
        String getGenericValue()

        Both ModelBuilder and JavadocBuilder has been changed to process these change properly. Important to know: the JavaDocBuilder itself still doesn't create generics (requires java5 compilation).

        Tests have been modified. Every type which was representated as a String is now a (Wildcard)Type or a(Wildcard)TypeDef.

        And of course modifications to parser.y for generating a new Parser together with a small adjustment in lexer.flex to get a fully clean build.

        Show
        Robert Scholte added a comment - Even sooner than expected, but here's my patch. In a view words: The parser (pojo)-classes TypeDef has a new attribute: public List actualArgumentTypes; // List<TypeDef> MethodDef has changed: String returns has been removed TypeDef returnType has been added FieldDef: String type is now TypeDef type; and a WildCardTypeDef-class has been added to support these Types The qdox.model: Of course Type has been modified. It has now actualArgumentType and most important String getGenericValue() Both ModelBuilder and JavadocBuilder has been changed to process these change properly. Important to know: the JavaDocBuilder itself still doesn't create generics (requires java5 compilation). Tests have been modified. Every type which was representated as a String is now a (Wildcard)Type or a(Wildcard)TypeDef. And of course modifications to parser.y for generating a new Parser together with a small adjustment in lexer.flex to get a fully clean build.
        Robert Scholte made changes -
        Attachment QDOX-54.patch [ 39088 ]
        Hide
        Mauro Talevi added a comment -

        Robert, patch applied with thanks! Snapshot deployed.

        Show
        Mauro Talevi added a comment - Robert, patch applied with thanks! Snapshot deployed.
        Mauro Talevi made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Hide
        Markus Landwehr added a comment -

        Hi,

        I'm new to QDOX (and Java) and try to use it for a project that takes source files and creates an UML diagram. Can please someone explain to me, how to get "ArrayList<Rectangle>" from the following source:

        private ArrayList<Rectangle> getLines()
        {
        }

        if i use JavaMethod.getValue() or JavaMethod.getGenericValue() i always get "ArrayList" as result. With getGenericValue i hopped to get "ArrayList<Rectangle>".

        Sorry if this is not the right place to ask such questions.

        Thank you,
        Markus

        Show
        Markus Landwehr added a comment - Hi, I'm new to QDOX (and Java) and try to use it for a project that takes source files and creates an UML diagram. Can please someone explain to me, how to get "ArrayList<Rectangle>" from the following source: private ArrayList<Rectangle> getLines() { } if i use JavaMethod.getValue() or JavaMethod.getGenericValue() i always get "ArrayList" as result. With getGenericValue i hopped to get "ArrayList<Rectangle>". Sorry if this is not the right place to ask such questions. Thank you, Markus
        Hide
        Robert Scholte added a comment -

        getGenericValue() should indeed return java.util.ArrayList<java.awt.Rectangle>. I've used your method (for as far as I can predict the rest of the class) in a testcase and I get the right response. Can you write your own failing testcase?

        Show
        Robert Scholte added a comment - getGenericValue() should indeed return java.util.ArrayList<java.awt.Rectangle>. I've used your method (for as far as I can predict the rest of the class) in a testcase and I get the right response. Can you write your own failing testcase?
        Hide
        Markus Landwehr added a comment -

        Hello Robert, thank you very much. You are right. It was my mistake. I put the result of getGenericValue() into a JLabel and there "<" and ">" are not shown (html-tags?). Because of your answer i know it should work and did this: String methodType = javaMethod.getGenericValue().RepalaceAll("<","<").ReplaceAll(">",">");

        Thank you for your help,
        Markus

        Show
        Markus Landwehr added a comment - Hello Robert, thank you very much. You are right. It was my mistake. I put the result of getGenericValue() into a JLabel and there "<" and ">" are not shown (html-tags?). Because of your answer i know it should work and did this: String methodType = javaMethod.getGenericValue().RepalaceAll("<","<").ReplaceAll(">",">"); Thank you for your help, Markus
        Hide
        Olivier Lamy added a comment -

        Hi,
        Any ideas when a released will be out with this fix ?
        Because we are currently blocked with this to release the gwt-maven-plugin.
        Thanks !

        Show
        Olivier Lamy added a comment - Hi, Any ideas when a released will be out with this fix ? Because we are currently blocked with this to release the gwt-maven-plugin. Thanks !

          People

          • Assignee:
            Unassigned
            Reporter:
            Aslak Hellesøy
          • Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: