-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Use SLASHSTAR instead of JAVADOC for Java #109
Use SLASHSTAR instead of JAVADOC for Java #109
Conversation
In Java JAVADOC-style comment blocks are intended for comments interpreted by documentation building tools such as `javadoc`. Strictly speaking, the license header block should not be interpreted by these tools. The common approach in Java is to use the uninterpreted SLASHSTAR-style of comments for the license header. Recent iterations of the JDK have been getting stricter with its parsing of Javadoc comment blocks; floating comment block not applied to any Java element (type, method, or field) may well result in warnings in future versions of the compiler. In JetBrain's IntelliJ Java IDE, Javadoc-style license headers already cause a syntax warning. While the style of comments can be configured (as mentioned in mathieucarbou#43 'License headers shouldn't be in Javadoc style') a sensible default seems preferable.
@mathieucarbou What is the motivation for keeping Javadoc-style as the default? |
I completely agree with you. This plugin as a lot of history and at the time we created it, we look after a lot of projects and there were no convention at all: some were using one style, some the others. So since it breaks backward compatibility, it would be for another major release. In the meantime, you can set this in the plugin config:
This is also what we do at work currently... |
No problem, there is a workaround as you mention. |
Note: in my #115 I’m deliberately not using a simple These tools reformat the source code, and they also reformat all “simple” (“slash star”) comments, but not those starting with either But I don’t see why we can’t have both. |
|
I am preparing version 4 of the plugin in which I'll allow breaking changes :-) |
Thanks @mathieucarbou - Any rough estimate when we can expect the release of version 4 with the fixed Java file header format? |
No sorry. Had issues with both laptop and appartement besides taking care of the new baby so I wasn't even able to do it as planned this spring. I need to setup everything again to be a able to release. I wanted to work on a couple of issues first initially but now I will focus on 4.0 release and I'll do a 4.1 after. |
Sure thing, no rush! Hope all is well now, and congrats on the baby! 👶🙂👍 |
In Java JAVADOC-style comment blocks are intended for comments interpreted by documentation building tools such as
javadoc
. Strictly speaking, the license header block should not be interpreted by these tools. The common approach in Java is to use the uninterpreted SLASHSTAR-style of comments for the license header.Recent iterations of the JDK have been getting stricter with its parsing of Javadoc comment blocks; floating comment blocks not applied to any Java element (type, method, or field) may well result in warnings in future versions of the compiler. In JetBrain's IntelliJ Java IDE, Javadoc-style license headers already cause a syntax warning.
While the style of comments can be configured (as mentioned before in #43 'License headers shouldn't be in Javadoc style') a sensible default seems preferable.