[jira] Created: (QDOX-146) Retaining whitespace in comments

View: New views
7 Messages — Rating Filter:   Alert me  

[jira] Created: (QDOX-146) Retaining whitespace in comments

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Retaining whitespace in comments
--------------------------------

                 Key: QDOX-146
                 URL: http://jira.codehaus.org/browse/QDOX-146
             Project: QDox
          Issue Type: New Feature
          Components: Java API, Parser
    Affects Versions: 1.6.3
            Reporter: Grégory Joseph


As per the dev-list, it might be useful, in some cases, to preserve whitespace in javadoc comments:
http://www.nabble.com/Retaining-whitespace-in-comments-td18738908.html

Since it is not *always* desired, I'd suggest adding a method and/or parameter so that users can get one or the other as they see fit.

I've tried looking into the source to see where this was happening, but haven't been able to locate it precisely.

--
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



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Commented: (QDOX-146) Retaining whitespace in comments

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/QDOX-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=156359#action_156359 ]

Grégory Joseph commented on QDOX-146:
-------------------------------------

Here's a testcase that shows the potentially desired behavior:
{code}

    public void testWhitespaceCanBeRetainedInJavadoc() {
        String sourceCode = ""
                + "package com.acme.thing;\n"
                + "\n"
                + "/**\n"
                + " * This class does something.\n"
                + " *     chalala\n"
                + " *         cha  **  lala\n"
                + " **/\n"
                + "public class AClassName {\n"
                + "}";
        JavaDocBuilder builder = new JavaDocBuilder();
        builder.addSource(new StringReader(sourceCode));
        JavaClass aClass = builder.getClassByName("com.acme.thing.AClassName");
        assertEquals("This class does something.\n"
                + "    chalala\n"
                + "    cha  **  lala", aClass.getComment());
    }
{code}

--- as you can see, I think the concern is mainly about leading whitespace on each line.

> Retaining whitespace in comments
> --------------------------------
>
>                 Key: QDOX-146
>                 URL: http://jira.codehaus.org/browse/QDOX-146
>             Project: QDox
>          Issue Type: New Feature
>          Components: Java API, Parser
>    Affects Versions: 1.6.3
>            Reporter: Grégory Joseph
>
> As per the dev-list, it might be useful, in some cases, to preserve whitespace in javadoc comments:
> http://www.nabble.com/Retaining-whitespace-in-comments-td18738908.html
> Since it is not *always* desired, I'd suggest adding a method and/or parameter so that users can get one or the other as they see fit.
> I've tried looking into the source to see where this was happening, but haven't been able to locate it precisely.

--
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



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Commented: (QDOX-146) Retaining whitespace in comments

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/QDOX-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=158931#action_158931 ]

Paul Hammant commented on QDOX-146:
-----------------------------------

Gregory, look at line 211- 226 in lexer.flex.

I think the stripping of spaces is baked into QDox at the parser stage. It would most likely need to be a change for QDox rather than a switch.

In AbstractJavaEntity.commentHeader(..) there is an attempt to format again in /** Javadoc Style */ but it does not add back the spaces.

> Retaining whitespace in comments
> --------------------------------
>
>                 Key: QDOX-146
>                 URL: http://jira.codehaus.org/browse/QDOX-146
>             Project: QDox
>          Issue Type: New Feature
>          Components: Java API, Parser
>    Affects Versions: 1.6.3
>            Reporter: Grégory Joseph
>
> As per the dev-list, it might be useful, in some cases, to preserve whitespace in javadoc comments:
> http://www.nabble.com/Retaining-whitespace-in-comments-td18738908.html
> Since it is not *always* desired, I'd suggest adding a method and/or parameter so that users can get one or the other as they see fit.
> I've tried looking into the source to see where this was happening, but haven't been able to locate it precisely.

--
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



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Updated: (QDOX-146) Retaining whitespace in comments

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/QDOX-146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Hammant updated QDOX-146:
------------------------------

    Priority: Minor  (was: Major)

> Retaining whitespace in comments
> --------------------------------
>
>                 Key: QDOX-146
>                 URL: http://jira.codehaus.org/browse/QDOX-146
>             Project: QDox
>          Issue Type: New Feature
>          Components: Java API, Parser
>    Affects Versions: 1.6.3
>            Reporter: Grégory Joseph
>            Priority: Minor
>
> As per the dev-list, it might be useful, in some cases, to preserve whitespace in javadoc comments:
> http://www.nabble.com/Retaining-whitespace-in-comments-td18738908.html
> Since it is not *always* desired, I'd suggest adding a method and/or parameter so that users can get one or the other as they see fit.
> I've tried looking into the source to see where this was happening, but haven't been able to locate it precisely.

--
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



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Commented: (QDOX-146) Retaining whitespace in comments

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/QDOX-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=169839#action_169839 ]

Robert Scholte commented on QDOX-146:
-------------------------------------

I've had a look at the lexer and I think it's a bit too complecated right now.
Why not read per line instead of per word? Everything after a javaDocComment-linestart can be copied as it is, remaining spaces, asterisks, etc.
The only reason I can think of is detecting doclet-tags.
For the doclet case you could use javaDocComment-linestart followed by an '@', push state and read until the space and pop back.

Are there cases which won't fit this strategy?

If this seems solid enough, then most lexer-tests specific for javadocs have to be rewritten. Any ideas?




> Retaining whitespace in comments
> --------------------------------
>
>                 Key: QDOX-146
>                 URL: http://jira.codehaus.org/browse/QDOX-146
>             Project: QDox
>          Issue Type: New Feature
>          Components: Java API, Parser
>    Affects Versions: 1.6.3
>            Reporter: Grégory Joseph
>            Priority: Minor
>
> As per the dev-list, it might be useful, in some cases, to preserve whitespace in javadoc comments:
> http://www.nabble.com/Retaining-whitespace-in-comments-td18738908.html
> Since it is not *always* desired, I'd suggest adding a method and/or parameter so that users can get one or the other as they see fit.
> I've tried looking into the source to see where this was happening, but haven't been able to locate it precisely.

--
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



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Commented: (QDOX-146) Retaining whitespace in comments

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/QDOX-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=184168#action_184168 ]

Robert Scholte commented on QDOX-146:
-------------------------------------

Take a look at the test below. I think I found a way to parse javadoccomments, but it looks like both tests collide with each other.
Unless we say: JavadocTags should remove leading spaces, comments not.
But then there´s another thing: in the chalala-example I think the last line should contain the extra 4 spaces in front of 'cha'.

Any ideas?

{code:title=JavaDocBuilderTest.java}
    public void testTagValuesCanSpanMultipleLines() {
        String source = "" +
                "/**\n" +
                " * @bar.baz foo=\"this is\\\n" +
                " *       multilined\"\n" +
                " */\n" +
                "class x{}";
        builder.addSource(new StringReader(source));
        JavaClass x = builder.getClassByName("x");
        DocletTag tag = x.getTagByName("bar.baz");
        assertEquals("foo=\"this is\\\nmultilined\"", tag.getValue());
        assertEquals("this is\nmultilined", tag.getNamedParameter("foo"));
    }
{code}

> Retaining whitespace in comments
> --------------------------------
>
>                 Key: QDOX-146
>                 URL: http://jira.codehaus.org/browse/QDOX-146
>             Project: QDox
>          Issue Type: New Feature
>          Components: Java API, Parser
>    Affects Versions: 1.6.3
>            Reporter: Grégory Joseph
>            Priority: Minor
>
> As per the dev-list, it might be useful, in some cases, to preserve whitespace in javadoc comments:
> http://www.nabble.com/Retaining-whitespace-in-comments-td18738908.html
> Since it is not *always* desired, I'd suggest adding a method and/or parameter so that users can get one or the other as they see fit.
> I've tried looking into the source to see where this was happening, but haven't been able to locate it precisely.

--
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



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Resolved: (QDOX-146) Retaining whitespace in comments

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/QDOX-146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Scholte resolved QDOX-146.
---------------------------------

         Assignee: Robert Scholte
       Resolution: Fixed
    Fix Version/s: 1.10

Issue resolved like mentioned: add those 4 extra spaces so the comment stays as it is.

> Retaining whitespace in comments
> --------------------------------
>
>                 Key: QDOX-146
>                 URL: http://jira.codehaus.org/browse/QDOX-146
>             Project: QDox
>          Issue Type: New Feature
>          Components: Java API, Parser
>    Affects Versions: 1.6.3
>            Reporter: Grégory Joseph
>            Assignee: Robert Scholte
>            Priority: Minor
>             Fix For: 1.10
>
>
> As per the dev-list, it might be useful, in some cases, to preserve whitespace in javadoc comments:
> http://www.nabble.com/Retaining-whitespace-in-comments-td18738908.html
> Since it is not *always* desired, I'd suggest adding a method and/or parameter so that users can get one or the other as they see fit.
> I've tried looking into the source to see where this was happening, but haven't been able to locate it precisely.

--
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



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email