Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Conversation

@dodgex
Copy link
Member

@dodgex dodgex commented Aug 19, 2015

see #1525

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i assume you ask for the .replaceAll("\r", ""). I removed the \n because it breaks the output.

e.g.

/**
 * Hello
World
 *
 */

instead of

/**
 * Hello
 * World
 *
 */

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean you removed the \r, right? But why is this needed? CodeModel assumes only \n line ending and breaks with \r\n?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes i mean that i removed the \r, sorry.

the .getDocComment(element) call returns comment with \r\n but when i apped that to the javadoc i get the line-break without an * in the line (like the first snippet). removing the \r resulted in having a correctly formatted javadoc output.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Can you move this duplicated code then to APTCodeModelHelper?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would extract this whole block into one method:

if (docComment != null) {
  method.javadoc().append(docComment.replaceAll("\r", "").trim());
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@WonderCsabo
Copy link
Member

Thanks! Seems to be okay. After the plugin system is merged, i will have to ask you to rebase this unfortunately.

@dodgex
Copy link
Member Author

dodgex commented Sep 4, 2015

I'm just waiting for the moment i can rebase ;-)

@WonderCsabo
Copy link
Member

Please rebase this onto develop.

@dodgex
Copy link
Member Author

dodgex commented Sep 12, 2015

rebased

@WonderCsabo
Copy link
Member

WonderCsabo commented Sep 12, 2015 via email

@dodgex
Copy link
Member Author

dodgex commented Sep 12, 2015

yeah... currently fighting with my eclipse to get AA working.

@WonderCsabo
Copy link
Member

Sorry... We changed to IntelliJ. I did not update the instructions, yet.

@dodgex
Copy link
Member Author

dodgex commented Sep 12, 2015

the androidannotations-test project is missing project.properties :/

@dodgex
Copy link
Member Author

dodgex commented Sep 12, 2015

should be fixed

@dodgex
Copy link
Member Author

dodgex commented Sep 12, 2015

TODO: copy ServiceAction javadoc

@WonderCsabo
Copy link
Member

@dodgex will you add @ServiceAction javadoc gen in this PR?

@dodgex
Copy link
Member Author

dodgex commented Sep 15, 2015

yeah. it is planned. but i had no time yet. maybe this evening.

@WonderCsabo
Copy link
Member

OK, i will wait with merging, then. Thanks.

@dodgex
Copy link
Member Author

dodgex commented Sep 15, 2015

PR updated with javadoc for @ServiceAction. here it is a plain copy of the original doc.

@WonderCsabo
Copy link
Member

Thanks for handling @ServiceAction as well. And it seems it also handles javadoc for parameters correctly:

/**
 * this is a javadoc comment
 *
 * @param param This is something
 */
@ServiceAction
void action(int param) {
}
/**
 * this is a javadoc comment
 * 
 *  @param param This is something
 * 
 */
public ServiceWithServiceAction_.IntentBuilder_ action(int param) {
    action(ACTION);
    super.extra(PARAM_EXTRA, param);
    return this;
}

Can i ask you to add the param to the test? Also please add a @return tag to the ServiceAction javadoc as you did for the other two annotations (and also test that)..

Thanks for your work!

@WonderCsabo
Copy link
Member

Well, the only little problem with @param that it is has extra space before it. But i think that is okay, since JavaDoc parsers should be able to handle that (IntelliJ's can).

@dodgex
Copy link
Member Author

dodgex commented Sep 15, 2015

no idea where the space comes from. but i'm pretty sure that JavaDoc parsers do not care for spaces at all (if not in a <pre> block)

@dodgex
Copy link
Member Author

dodgex commented Sep 15, 2015

PR updated

@WonderCsabo
Copy link
Member

I know where it comes from. The javadoc which is added here, is interpreted as the main JavaDoc. When codemodel renders it, it adds a space after the starts. But the @param already has a space, that is why it is duplicated. But this is not a problem.

WonderCsabo added a commit that referenced this pull request Sep 15, 2015
Copy JavaDoc for @extra, @FragmentArg and @ServiceAction to the generated builder method
@WonderCsabo WonderCsabo merged commit f4b732e into androidannotations:develop Sep 15, 2015
@WonderCsabo WonderCsabo added this to the 4.0 milestone Sep 15, 2015
@WonderCsabo
Copy link
Member

After the final review of this PR, i realized there is another last annotations, which can use JavaDoc copy: @SharedPref and @DefaultXXX. These are not so important, but if you want to contribute that too, go ahead.

@WonderCsabo
Copy link
Member

Follow up issue for shared prefs: #1551.

@dodgex dodgex deleted the 1525_copy_javadoc_to_builder branch September 17, 2015 15:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants