Skip to content

Commit 57774cf

Browse files
Marcono1234michael-o
authored andcommitted
[MJAVADOC-799] Remove inconsistent AbstractFixJavadocMojo#defaultVersion default value
The current default value has no use anymore. This closes #295
1 parent 7e5dea4 commit 57774cf

File tree

6 files changed

+9
-22
lines changed

6 files changed

+9
-22
lines changed

src/it/projects/javadoc-fix/verify.bsh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ try
6060
content = FileUtils.fileRead( javaFile, "UTF-8" );
6161

6262
assertContains( content, " * <p>ClassWithNoJavadoc class.</p>" );
63-
assertContains( content, " * @version $Id: $" );
6463
assertContains( content, " * @since 1.0" );
6564
assertContains( content, " * <p>main.</p>" );
6665
assertContains( content, " * @param args an array of {@link java.lang.String} objects" );
6766
// private sampleMethod
6867
assertNotContains( content, " * <p>sampleMethod.</p>" );
6968
assertNotContains( content, " * @param str a {@link java.lang.String} object" );
69+
assertNotContains( content, " * @version " );
7070

7171
javaFile = new File( basedir, "/src/main/java/fix/test/ClassWithJavadoc.java" );
7272
content = FileUtils.fileRead( javaFile, "UTF-8" );
@@ -93,21 +93,21 @@ try
9393
content = FileUtils.fileRead( javaFile, "UTF-8" );
9494

9595
assertContains( content, " * <p>InterfaceWithNoJavadoc interface.</p>" );
96-
assertContains( content, " * @version $Id: $" );
9796
assertContains( content, " * @since 1.0" );
9897
assertContains( content, " /** Constant <code>MY_STRING_CONSTANT=\"value\"</code> */" );
9998
assertContains( content, " * <p>method.</p>" );
10099
assertContains( content, " * @param aString a {@link java.lang.String} object" );
100+
assertNotContains( content, " * @version " );
101101

102102
javaFile = new File( basedir, "/src/main/java/fix/test/InterfaceWithJavadoc.java" );
103103
content = FileUtils.fileRead( javaFile, "UTF-8" );
104104

105105
assertContains( content, " * Some Javadoc." );
106-
assertContains( content, " * @version $Id: $" );
107106
assertContains( content, " * @since 1.0" );
108107
assertContains( content, " /** comment */" );
109108
assertContains( content, " * My method" );
110109
assertContains( content, " * @param aString a {@link java.lang.String} object" );
110+
assertNotContains( content, " * @version " );
111111

112112
}
113113
catch( Throwable e )

src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,6 @@ public abstract class AbstractFixJavadocMojo extends AbstractMojo {
207207
*/
208208
public static final String JAVA_FILES = "**\\/*.java";
209209

210-
/**
211-
* Default version value.
212-
*/
213-
public static final String DEFAULT_VERSION_VALUE = "\u0024Id: \u0024Id";
214-
215210
// ----------------------------------------------------------------------
216211
// Mojo components
217212
// ----------------------------------------------------------------------
@@ -251,13 +246,9 @@ public abstract class AbstractFixJavadocMojo extends AbstractMojo {
251246

252247
/**
253248
* Default value for the Javadoc tag <code>&#64;version</code>.
254-
* <br/>
255-
* By default, it is <code>&#36;Id:&#36;</code>, corresponding to a
256-
* <a href="http://svnbook.red-bean.com/en/1.1/ch07s02.html#svn-ch-7-sect-2.3.4">SVN keyword</a>.
257-
* Refer to your SCM to use an other SCM keyword.
258249
*/
259-
@Parameter(property = "defaultVersion", defaultValue = DEFAULT_VERSION_VALUE)
260-
private String defaultVersion = "\u0024Id: \u0024"; // can't use default-value="\u0024Id: \u0024"
250+
@Parameter(property = "defaultVersion")
251+
private String defaultVersion;
261252

262253
/**
263254
* The file encoding to use when reading the source files. If the property
@@ -286,7 +277,7 @@ public abstract class AbstractFixJavadocMojo extends AbstractMojo {
286277
* <li>link (fix only &#64;link tag)</li>
287278
* </ul>
288279
*/
289-
@Parameter(property = "fixTags", defaultValue = "all")
280+
@Parameter(property = "fixTags", defaultValue = FIX_TAGS_ALL)
290281
private String fixTags;
291282

292283
/**
@@ -346,7 +337,7 @@ public abstract class AbstractFixJavadocMojo extends AbstractMojo {
346337
* </ul>
347338
* @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javadoc.html#options-for-javadoc">private, protected, public, package options for Javadoc</a>
348339
*/
349-
@Parameter(property = "level", defaultValue = "protected")
340+
@Parameter(property = "level", defaultValue = LEVEL_PROTECTED)
350341
private String level;
351342

352343
/**
@@ -2109,7 +2100,7 @@ private void appendDefaultSinceTag(final StringBuilder sb, final String indent)
21092100
* @return true if separator has been added.
21102101
*/
21112102
private boolean appendDefaultVersionTag(final StringBuilder sb, final String indent, boolean separatorAdded) {
2112-
if (!fixTag(VERSION_TAG)) {
2103+
if (!fixTag(VERSION_TAG) || StringUtils.isEmpty(defaultVersion)) {
21132104
return separatorAdded;
21142105
}
21152106

@@ -2127,7 +2118,7 @@ private boolean appendDefaultVersionTag(final StringBuilder sb, final String ind
21272118
* @param indent not null
21282119
*/
21292120
private void appendDefaultVersionTag(final StringBuilder sb, final String indent) {
2130-
if (!fixTag(VERSION_TAG)) {
2121+
if (!fixTag(VERSION_TAG) || StringUtils.isEmpty(defaultVersion)) {
21312122
return;
21322123
}
21332124

src/test/resources/unit/fix-test/expected/src/main/java/fix/test/ClassWithJavadoc.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
* To add default class tags.
2424
*
2525
* @author <a href="mailto:[email protected]">[email protected]</a>
26-
* @version $Id: $
2726
*/
2827
@SuppressWarnings("SameReturnValue")
2928
public class ClassWithJavadoc

src/test/resources/unit/fix-test/expected/src/main/java/fix/test/ClassWithNoJavadoc.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
* <p>ClassWithNoJavadoc class.</p>
2626
*
2727
* @author <a href="mailto:[email protected]">[email protected]</a>
28-
* @version $Id: $
2928
*/
3029
@SuppressWarnings("SameReturnValue")
3130
public class ClassWithNoJavadoc

src/test/resources/unit/fix-test/expected/src/main/java/fix/test/InterfaceWithJavadoc.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
* To add default interface tags.
2424
*
2525
* @author <a href="mailto:[email protected]">[email protected]</a>
26-
* @version $Id: $
2726
*/
2827
public interface InterfaceWithJavadoc
2928
{

src/test/resources/unit/fix-test/expected/src/main/java/fix/test/InterfaceWithNoJavadoc.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
* <p>InterfaceWithNoJavadoc interface.</p>
2424
*
2525
* @author <a href="mailto:[email protected]">[email protected]</a>
26-
* @version $Id: $
2726
*/
2827
public interface InterfaceWithNoJavadoc
2928
{

0 commit comments

Comments
 (0)