Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MPLUGIN-426] add @Description annotation #152

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

bmarwell
Copy link

ITs missing, tests missing, draft.

*
* @return a description of the Mojo or the parameter.
*/
String content();
Copy link
Author

Choose a reason for hiding this comment

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

Naming?

Copy link
Contributor

Choose a reason for hiding this comment

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

With this named as value, could annotation be used as @Description("xxx yyy")?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, that was my first idea. But since it contains HTML, I thought it might be a good idea to not use "value". But then, what would value be if added later...
Can change that. Will also add tests.

Comment on lines -291 to 304
mojoAnnotationContent.setDescription( javaClass.getComment() );
if ( StringUtils.isEmpty( mojoAnnotationContent.getDescription() ) )
{
mojoAnnotationContent.setDescription( javaClass.getComment() );
}

DocletTag since = findInClassHierarchy( javaClass, "since" );
if ( since != null )
if ( since != null && StringUtils.isEmpty( mojoAnnotationContent.getSince() ) )
{
mojoAnnotationContent.setSince( since.getValue() );
}

DocletTag deprecated = findInClassHierarchy( javaClass, "deprecated" );
if ( deprecated != null )
if ( deprecated != null && StringUtils.isEmpty( mojoAnnotationContent.getDeprecated() ) )
{
Copy link
Author

Choose a reason for hiding this comment

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

New behaviour (compatible): Only set from javadoc annotation if not already set by Java annotation..

Comment on lines +321 to +327
DescriptionAnnotationContent descriptionAnnotationContent = new DescriptionAnnotationContent();
final MojoAnnotationVisitor descriptionAnnotationVisitor =
annotationVisitorMap.get( Description.class.getName() );
if ( descriptionAnnotationVisitor != null )
{
populateAnnotationContent( descriptionAnnotationContent, descriptionAnnotationVisitor );
}
Copy link
Author

Choose a reason for hiding this comment

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

@Description is optional and thus can be null.

@cstamas
Copy link
Member

cstamas commented Oct 17, 2022

Looks ok to me

@hboutemy
Copy link
Member

commits added as a review
build is failing on GH: does not seem related to this updates, but we'll need to fix because additional failure (like the rat failure I fixed) are not visible

@gnodet
Copy link
Contributor

gnodet commented Nov 15, 2022

Should the new annotation contain a since field to be able to avoid the since javadoc tag ?

@bmarwell
Copy link
Author

Should the new annotation contain a since field to be able to avoid the since javadoc tag ?

Sounds like a plan!
But we still have a "dispute", some favour an approach where we instead implement a kotlin kdoc, scala doc and groovy doc parser as well. I am pretty sure if we went that way (ie support external parsers for other JVM languages), we should provide the appropriate parsers/extractors as well. This option here is WAY simpler, but not necessarily better.
Maybe this should go to the mailing list AGAIN? WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants