Skip to content

Commit

Permalink
[MJAVADOC-799] Remove inconsistent `AbstractFixJavadocMojo#defaultVer…
Browse files Browse the repository at this point in the history
…sion` default value

The current default value has no use anymore.

This closes #295
  • Loading branch information
Marcono1234 authored and michael-o committed Jul 12, 2024
1 parent 7e5dea4 commit 57774cf
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/it/projects/javadoc-fix/verify.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ try
content = FileUtils.fileRead( javaFile, "UTF-8" );

assertContains( content, " * <p>ClassWithNoJavadoc class.</p>" );
assertContains( content, " * @version $Id: $" );
assertContains( content, " * @since 1.0" );
assertContains( content, " * <p>main.</p>" );
assertContains( content, " * @param args an array of {@link java.lang.String} objects" );
// private sampleMethod
assertNotContains( content, " * <p>sampleMethod.</p>" );
assertNotContains( content, " * @param str a {@link java.lang.String} object" );
assertNotContains( content, " * @version " );

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

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

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

assertContains( content, " * Some Javadoc." );
assertContains( content, " * @version $Id: $" );
assertContains( content, " * @since 1.0" );
assertContains( content, " /** comment */" );
assertContains( content, " * My method" );
assertContains( content, " * @param aString a {@link java.lang.String} object" );
assertNotContains( content, " * @version " );

}
catch( Throwable e )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,6 @@ public abstract class AbstractFixJavadocMojo extends AbstractMojo {
*/
public static final String JAVA_FILES = "**\\/*.java";

/**
* Default version value.
*/
public static final String DEFAULT_VERSION_VALUE = "\u0024Id: \u0024Id";

// ----------------------------------------------------------------------
// Mojo components
// ----------------------------------------------------------------------
Expand Down Expand Up @@ -251,13 +246,9 @@ public abstract class AbstractFixJavadocMojo extends AbstractMojo {

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

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

/**
Expand Down Expand Up @@ -346,7 +337,7 @@ public abstract class AbstractFixJavadocMojo extends AbstractMojo {
* </ul>
* @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>
*/
@Parameter(property = "level", defaultValue = "protected")
@Parameter(property = "level", defaultValue = LEVEL_PROTECTED)
private String level;

/**
Expand Down Expand Up @@ -2109,7 +2100,7 @@ private void appendDefaultSinceTag(final StringBuilder sb, final String indent)
* @return true if separator has been added.
*/
private boolean appendDefaultVersionTag(final StringBuilder sb, final String indent, boolean separatorAdded) {
if (!fixTag(VERSION_TAG)) {
if (!fixTag(VERSION_TAG) || StringUtils.isEmpty(defaultVersion)) {
return separatorAdded;
}

Expand All @@ -2127,7 +2118,7 @@ private boolean appendDefaultVersionTag(final StringBuilder sb, final String ind
* @param indent not null
*/
private void appendDefaultVersionTag(final StringBuilder sb, final String indent) {
if (!fixTag(VERSION_TAG)) {
if (!fixTag(VERSION_TAG) || StringUtils.isEmpty(defaultVersion)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
* To add default class tags.
*
* @author <a href="mailto:[email protected]">[email protected]</a>
* @version $Id: $
*/
@SuppressWarnings("SameReturnValue")
public class ClassWithJavadoc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
* <p>ClassWithNoJavadoc class.</p>
*
* @author <a href="mailto:[email protected]">[email protected]</a>
* @version $Id: $
*/
@SuppressWarnings("SameReturnValue")
public class ClassWithNoJavadoc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
* To add default interface tags.
*
* @author <a href="mailto:[email protected]">[email protected]</a>
* @version $Id: $
*/
public interface InterfaceWithJavadoc
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
* <p>InterfaceWithNoJavadoc interface.</p>
*
* @author <a href="mailto:[email protected]">[email protected]</a>
* @version $Id: $
*/
public interface InterfaceWithNoJavadoc
{
Expand Down

0 comments on commit 57774cf

Please sign in to comment.