QDox
  1. QDox
  2. QDOX-171 AbstractJavaEntity#getCodeBlock() skips Javadoc separator
  3. QDOX-172

Preserve method signature and indentation in AbstractJavaEntity#getCodeBlock()

    Details

    • Type: Sub-task Sub-task
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.9.1, 1.9.2
    • Fix Version/s: 1.10
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The AbstractJavaEntity#getCodeBlock() change the method signature, see the test case of QDOX-171:

      Original snippet

          public String myMethod( String s )
              throws Exception
          {
      

      getCodeBlock() snippet

      public java.lang.String myMethod(java.lang.String s) throws java.lang.Exception {
      

        Activity

        Hide
        Robert Scholte added a comment -

        Maybe it's me, but I can't see any difference in signature between the two snippets other than the Objects have FQN's and it's all on one line.

        Show
        Robert Scholte added a comment - Maybe it's me, but I can't see any difference in signature between the two snippets other than the Objects have FQN's and it's all on one line.
        Hide
        Vincent Siveton added a comment -

        In the getCodeBlock() snippet the differences are

        "missing indentation public"
        "java.lang.String" instead of "String"
        "myMethod(java.lang.String s)" instead of "myMethod( String s )"
        no return of line
        "throws java.lang.Exception" "instead of "throws Exception"

        Show
        Vincent Siveton added a comment - In the getCodeBlock() snippet the differences are " missing indentation public" "java.lang.String" instead of "String" "myMethod(java.lang.String s)" instead of "myMethod( String s )" no return of line "throws java.lang.Exception" "instead of "throws Exception"
        Hide
        Robert Scholte added a comment - - edited

        ok, seems like you expected the literal representation, but that's not what this method does. It builds a codeblock based on the model of the javaSource. In the model this kind of information is all lost. And keeping it goes far beyond the purpose of QDox.

        From your javadoc-mojo point of view I can imagine you want something like this Keep the code the as much as possible, only append javadoccomments where they're missing.
        You could of source build your own method without the full qualified names, but what if someone used a FQN of the class in the method: the code might not compile...
        Since you're already rewriting sourcefiles I don't think it's wrong to use full qualified names. This way you're sure the code will compile.
        And I think for the indent-stuff, you could bring it up to an even higher lever. Make use of a codestyler (mojo-parameter?) to reformat the complete sourcefile.

        edit:
        take a look at http://mojo.codehaus.org/jalopy-maven-plugin/index.html for inspiration

        Show
        Robert Scholte added a comment - - edited ok, seems like you expected the literal representation, but that's not what this method does. It builds a codeblock based on the model of the javaSource. In the model this kind of information is all lost. And keeping it goes far beyond the purpose of QDox. From your javadoc-mojo point of view I can imagine you want something like this Keep the code the as much as possible, only append javadoccomments where they're missing. You could of source build your own method without the full qualified names, but what if someone used a FQN of the class in the method: the code might not compile... Since you're already rewriting sourcefiles I don't think it's wrong to use full qualified names. This way you're sure the code will compile. And I think for the indent-stuff, you could bring it up to an even higher lever. Make use of a codestyler (mojo-parameter?) to reformat the complete sourcefile. edit: take a look at http://mojo.codehaus.org/jalopy-maven-plugin/index.html for inspiration
        Hide
        Robert Scholte added a comment -

        The generated code is as intended. But I created another issue, QDOX-177, which might be closer to the feature you're requesting.

        Show
        Robert Scholte added a comment - The generated code is as intended. But I created another issue, QDOX-177 , which might be closer to the feature you're requesting.
        Robert Scholte made changes -
        Field Original Value New Value
        Assignee Robert Scholte [ rfscholte ]
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 1.10 [ 15020 ]
        Resolution Won't Fix [ 2 ]

          People

          • Assignee:
            Robert Scholte
            Reporter:
            Vincent Siveton
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: