Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

copy javadoc for Activity @Extra and @FragmentArg to thier Builder#1526

Merged
WonderCsabo merged 3 commits into
androidannotations:developandroidannotations/androidannotations:developfrom
dodgex:1525_copy_javadoc_to_builderCopy head branch name to clipboard
Sep 15, 2015
Merged

copy javadoc for Activity @Extra and @FragmentArg to thier Builder#1526
WonderCsabo merged 3 commits into
androidannotations:developandroidannotations/androidannotations:developfrom
dodgex:1525_copy_javadoc_to_builderCopy head branch name to clipboard

Conversation

@dodgex

@dodgex dodgex commented Aug 19, 2015

Copy link
Copy Markdown
Member

see #1525

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

@dodgex

dodgex commented Sep 4, 2015

Copy link
Copy Markdown
Member Author

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

@WonderCsabo

Copy link
Copy Markdown
Member

Please rebase this onto develop.

@dodgex

dodgex commented Sep 12, 2015

Copy link
Copy Markdown
Member Author

rebased

@WonderCsabo

WonderCsabo commented Sep 12, 2015 via email

Copy link
Copy Markdown
Member

@dodgex

dodgex commented Sep 12, 2015

Copy link
Copy Markdown
Member Author

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

@WonderCsabo

Copy link
Copy Markdown
Member

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

@dodgex

dodgex commented Sep 12, 2015

Copy link
Copy Markdown
Member Author

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

@dodgex

dodgex commented Sep 12, 2015

Copy link
Copy Markdown
Member Author

should be fixed

@dodgex

dodgex commented Sep 12, 2015

Copy link
Copy Markdown
Member Author

TODO: copy ServiceAction javadoc

@WonderCsabo

Copy link
Copy Markdown
Member

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

@dodgex

dodgex commented Sep 15, 2015

Copy link
Copy Markdown
Member Author

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

@WonderCsabo

Copy link
Copy Markdown
Member

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

@dodgex

dodgex commented Sep 15, 2015

Copy link
Copy Markdown
Member Author

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

@WonderCsabo

Copy link
Copy Markdown
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
Copy Markdown
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

dodgex commented Sep 15, 2015

Copy link
Copy Markdown
Member Author

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

dodgex commented Sep 15, 2015

Copy link
Copy Markdown
Member Author

PR updated

@WonderCsabo

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.