@@ -212,44 +212,6 @@ public abstract class AbstractJavadocMojo extends AbstractMojo {
212212 private static final String PACKAGE_LIST = "package-list" ;
213213 private static final String ELEMENT_LIST = "element-list" ;
214214
215- /**
216- * For Javadoc options appears since Java 1.4.
217- * See <a href="https://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/whatsnew-1.4.1.html#summary">
218- * What's New in Javadoc 1.4</a>
219- *
220- * @since 2.1
221- */
222- private static final JavaVersion SINCE_JAVADOC_1_4 = JavaVersion .parse ("1.4" );
223-
224- /**
225- * For Javadoc options appears since Java 1.4.2.
226- * See <a
227- * href="https://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/whatsnew-1.4.2.html#commandlineoptions">
228- * What's New in Javadoc 1.4.2</a>
229- *
230- * @since 2.1
231- */
232- private static final JavaVersion SINCE_JAVADOC_1_4_2 = JavaVersion .parse ("1.4.2" );
233-
234- /**
235- * For Javadoc options appears since Java 5.0.
236- * See <a
237- * href="https://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/whatsnew-1.5.0.html#commandlineoptions">
238- * What's New in Javadoc 5.0</a>
239- *
240- * @since 2.1
241- */
242- private static final JavaVersion SINCE_JAVADOC_1_5 = JavaVersion .parse ("1.5" );
243-
244- /**
245- * For Javadoc options appears since Java 6.0.
246- * See <a href="https://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/index.html">
247- * Javadoc Technology</a>
248- *
249- * @since 2.4
250- */
251- private static final JavaVersion SINCE_JAVADOC_1_6 = JavaVersion .parse ("1.6" );
252-
253215 /**
254216 * For Javadoc options appears since Java 8.0.
255217 * See <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/index.html">
@@ -1802,7 +1764,7 @@ protected List<String> getProjectSourceRoots(MavenProject p) {
18021764 }
18031765
18041766 return p .getCompileSourceRoots () == null
1805- ? Collections .< String > emptyList ()
1767+ ? Collections .emptyList ()
18061768 : new LinkedList <>(p .getCompileSourceRoots ());
18071769 }
18081770
@@ -1816,7 +1778,7 @@ protected List<String> getExecutionProjectSourceRoots(MavenProject p) {
18161778 }
18171779
18181780 return p .getExecutionProject ().getCompileSourceRoots () == null
1819- ? Collections .< String > emptyList ()
1781+ ? Collections .emptyList ()
18201782 : new LinkedList <>(p .getExecutionProject ().getCompileSourceRoots ());
18211783 }
18221784
@@ -3325,7 +3287,7 @@ private List<String> getArtifactsAbsolutePath(JavadocPathArtifact javadocArtifac
33253287 }
33263288
33273289 /**
3328- * creates an {@link Artifact} representing the configured {@link JavadocPathArtifact} and resolves it.
3290+ * Creates an {@link Artifact} representing the configured {@link JavadocPathArtifact} and resolves it.
33293291 *
33303292 * @param javadocArtifact the {@link JavadocPathArtifact} to resolve
33313293 * @return a resolved {@link Artifact}
@@ -4232,13 +4194,8 @@ private void addCommandLineOptions(Commandline cmd, List<String> arguments, File
42324194 private void addCommandLineArgFile (Commandline cmd , File javadocOutputDirectory , List <String > files )
42334195 throws MavenReportException {
42344196 File argfileFile ;
4235- if (JAVA_VERSION .compareTo (SINCE_JAVADOC_1_4 ) >= 0 ) {
4236- argfileFile = new File (javadocOutputDirectory , ARGFILE_FILE_NAME );
4237- cmd .createArg ().setValue ("@" + ARGFILE_FILE_NAME );
4238- } else {
4239- argfileFile = new File (javadocOutputDirectory , FILES_FILE_NAME );
4240- cmd .createArg ().setValue ("@" + FILES_FILE_NAME );
4241- }
4197+ argfileFile = new File (javadocOutputDirectory , ARGFILE_FILE_NAME );
4198+ cmd .createArg ().setValue ("@" + ARGFILE_FILE_NAME );
42424199
42434200 List <String > quotedFiles = new ArrayList <>(files .size ());
42444201 for (String file : files ) {
@@ -4376,20 +4333,15 @@ private void addJavadocOptions(
43764333
43774334 // all options in alphabetical order
43784335
4379- if (old && isJavaDocVersionAtLeast (SINCE_JAVADOC_1_4 )) {
4380- if (getLog ().isWarnEnabled ()) {
4381- getLog ().warn ("Javadoc 1.4+ doesn't support the -1.1 switch anymore. Ignore this option." );
4382- }
4383- } else {
4384- addArgIf (arguments , old , "-1.1" );
4336+ if (getLog ().isWarnEnabled ()) {
4337+ getLog ().warn ("Javadoc 1.4+ doesn't support the -1.1 switch anymore. Ignore this option." );
43854338 }
43864339
43874340 addArgIfNotEmpty (arguments , "-bootclasspath" , JavadocUtil .quotedPathArgument (getBootclassPath ()));
43884341
4389- if (isJavaDocVersionAtLeast ( SINCE_JAVADOC_1_5 ) ) {
4390- addArgIf (arguments , breakiterator , "-breakiterator" , SINCE_JAVADOC_1_5 );
4342+ if (breakiterator ) {
4343+ addArgIf (arguments , breakiterator , "-breakiterator" );
43914344 }
4392-
43934345 List <MavenProject > aggregatedProjects = reactorProjects ; // getAggregatedProjects();
43944346 Map <String , MavenProject > reactorKeys = new HashMap <>(aggregatedProjects .size ());
43954347 for (MavenProject reactorProject : aggregatedProjects ) {
@@ -4649,15 +4601,13 @@ private void addJavadocOptions(
46494601
46504602 arguments .add (getAccessLevel ());
46514603
4652- if (isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) {
4653- addArgIf (arguments , quiet , "-quiet" , SINCE_JAVADOC_1_5 );
4654- }
4604+ addArgIf (arguments , quiet , "-quiet" );
46554605
46564606 if (javadocRuntimeVersion .isAtLeast ("9" ) && release != null ) {
46574607 arguments .add ("--release" );
46584608 arguments .add (release );
46594609 } else {
4660- addArgIfNotEmpty (arguments , "-source" , JavadocUtil .quotedArgument (source ), SINCE_JAVADOC_1_4 );
4610+ addArgIfNotEmpty (arguments , "-source" , JavadocUtil .quotedArgument (source ));
46614611 }
46624612
46634613 if ((sourcepath == null || sourcepath .isEmpty ()) && (subpackages != null && !subpackages .isEmpty ())) {
@@ -4680,12 +4630,10 @@ private void addJavadocOptions(
46804630 arguments , "--module-source-path" , JavadocUtil .quotedPathArgument (moduleSourceDir .toString ()));
46814631 }
46824632
4683- if ((sourcepath != null && !sourcepath .isEmpty ()) && isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) {
4684- addArgIfNotEmpty (arguments , "-subpackages" , subpackages , SINCE_JAVADOC_1_5 );
4685- }
4633+ addArgIfNotEmpty (arguments , "-subpackages" , subpackages );
46864634
46874635 // [MJAVADOC-497] must be after sourcepath is recalculated, since getExcludedPackages() depends on it
4688- addArgIfNotEmpty (arguments , "-exclude" , getExcludedPackages (sourcePaths ), SINCE_JAVADOC_1_4 );
4636+ addArgIfNotEmpty (arguments , "-exclude" , getExcludedPackages (sourcePaths ));
46894637
46904638 addArgIf (arguments , verbose , "-verbose" );
46914639
@@ -4755,28 +4703,23 @@ private void addStandardDocletOptions(
47554703
47564704 addArgIfNotEmpty (arguments , "-bottom" , JavadocUtil .quotedArgument (getBottomText ()), false , false );
47574705
4758- if (!isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) {
4759- addArgIf (arguments , breakiterator , "-breakiterator" , SINCE_JAVADOC_1_4 );
4760- }
4706+ addArgIf (arguments , breakiterator , "-breakiterator" );
47614707
47624708 addArgIfNotEmpty (arguments , "-charset" , JavadocUtil .quotedArgument (getCharset ()));
47634709
47644710 addArgIfNotEmpty (arguments , "-d" , JavadocUtil .quotedPathArgument (javadocOutputDirectory .toString ()));
47654711
47664712 addArgIfNotEmpty (arguments , "-docencoding" , JavadocUtil .quotedArgument (getDocencoding ()));
47674713
4768- addArgIf (arguments , docfilessubdirs , "-docfilessubdirs" , SINCE_JAVADOC_1_4 );
4714+ addArgIf (arguments , docfilessubdirs , "-docfilessubdirs" );
47694715
47704716 addArgIf (arguments , (doclint != null && !doclint .isEmpty ()), "-Xdoclint:" + getDoclint (), SINCE_JAVADOC_1_8 );
47714717
47724718 addArgIfNotEmpty (arguments , "-doctitle" , JavadocUtil .quotedArgument (getDoctitle ()), false , false );
47734719
47744720 if (docfilessubdirs ) {
47754721 addArgIfNotEmpty (
4776- arguments ,
4777- "-excludedocfilessubdir" ,
4778- JavadocUtil .quotedPathArgument (excludedocfilessubdir ),
4779- SINCE_JAVADOC_1_4 );
4722+ arguments , "-excludedocfilessubdir" , JavadocUtil .quotedPathArgument (excludedocfilessubdir ));
47804723 }
47814724
47824725 addArgIfNotEmpty (arguments , "-footer" , JavadocUtil .quotedArgument (footer ), false , false );
@@ -4785,30 +4728,23 @@ private void addStandardDocletOptions(
47854728
47864729 addArgIfNotEmpty (arguments , "-header" , JavadocUtil .quotedArgument (header ), false , false );
47874730
4788- Optional <File > helpFile = getHelpFile (javadocOutputDirectory );
4789- if (helpFile .isPresent ()) {
4790- addArgIfNotEmpty (
4791- arguments ,
4792- "-helpfile" ,
4793- JavadocUtil .quotedPathArgument (helpFile .get ().getAbsolutePath ()));
4794- }
4731+ getHelpFile (javadocOutputDirectory )
4732+ .ifPresent (file -> addArgIfNotEmpty (
4733+ arguments , "-helpfile" , JavadocUtil .quotedPathArgument (file .getAbsolutePath ())));
47954734
4796- addArgIf (arguments , keywords , "-keywords" , SINCE_JAVADOC_1_4_2 );
4735+ addArgIf (arguments , keywords , "-keywords" );
47974736
47984737 addLinkArguments (arguments );
47994738
48004739 addLinkofflineArguments (arguments , offlineLinks );
48014740
4802- addArgIf (arguments , linksource , "-linksource" , SINCE_JAVADOC_1_4 );
4741+ addArgIf (arguments , linksource , "-linksource" );
48034742
48044743 if (sourcetab > 0 ) {
4805- if (javadocRuntimeVersion == SINCE_JAVADOC_1_4_2 ) {
4806- addArgIfNotEmpty (arguments , "-linksourcetab" , String .valueOf (sourcetab ));
4807- }
4808- addArgIfNotEmpty (arguments , "-sourcetab" , String .valueOf (sourcetab ), SINCE_JAVADOC_1_5 );
4744+ addArgIfNotEmpty (arguments , "-sourcetab" , String .valueOf (sourcetab ));
48094745 }
48104746
4811- addArgIf (arguments , nocomment , "-nocomment" , SINCE_JAVADOC_1_4 );
4747+ addArgIf (arguments , nocomment , "-nocomment" );
48124748
48134749 addArgIf (arguments , nodeprecated , "-nodeprecated" );
48144750
@@ -4822,7 +4758,7 @@ private void addStandardDocletOptions(
48224758
48234759 addArgIf (arguments , nooverview , "-nooverview" );
48244760
4825- addArgIfNotEmpty (arguments , "-noqualifier" , JavadocUtil .quotedArgument (noqualifier ), SINCE_JAVADOC_1_4 );
4761+ addArgIfNotEmpty (arguments , "-noqualifier" , JavadocUtil .quotedArgument (noqualifier ));
48264762
48274763 addArgIf (arguments , nosince , "-nosince" );
48284764
@@ -4832,44 +4768,34 @@ private void addStandardDocletOptions(
48324768 notimestamp = true ;
48334769 }
48344770
4835- addArgIf (arguments , notimestamp , "-notimestamp" , SINCE_JAVADOC_1_5 );
4771+ addArgIf (arguments , notimestamp , "-notimestamp" );
48364772
48374773 addArgIf (arguments , notree , "-notree" );
48384774
4839- addArgIfNotEmpty (arguments , "-packagesheader" , JavadocUtil .quotedArgument (packagesheader ), SINCE_JAVADOC_1_4_2 );
4775+ addArgIfNotEmpty (arguments , "-packagesheader" , JavadocUtil .quotedArgument (packagesheader ));
48404776
4841- if (!isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) // Sun bug: 4714350
4842- {
4843- addArgIf (arguments , quiet , "-quiet" , SINCE_JAVADOC_1_4 );
4844- }
4777+ addArgIf (arguments , quiet , "-quiet" );
48454778
48464779 addArgIf (arguments , serialwarn , "-serialwarn" );
48474780
48484781 addArgIf (arguments , splitindex , "-splitindex" );
48494782
4850- Optional <File > stylesheetfile = getStylesheetFile (javadocOutputDirectory );
4851-
4852- if (stylesheetfile .isPresent ()) {
4853- addArgIfNotEmpty (
4854- arguments ,
4855- "-stylesheetfile" ,
4856- JavadocUtil .quotedPathArgument (stylesheetfile .get ().getAbsolutePath ()));
4857- }
4783+ getStylesheetFile (javadocOutputDirectory )
4784+ .ifPresent (file -> addArgIfNotEmpty (
4785+ arguments , "-stylesheetfile" , JavadocUtil .quotedPathArgument (file .getAbsolutePath ())));
48584786
48594787 addAddStyleSheets (arguments );
48604788
4861- if ((sourcepath != null && !sourcepath .isEmpty ()) && !isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) {
4862- addArgIfNotEmpty (arguments , "-subpackages" , subpackages , SINCE_JAVADOC_1_4 );
4863- }
4789+ addArgIfNotEmpty (arguments , "-subpackages" , subpackages );
48644790
4865- addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (taglet ), SINCE_JAVADOC_1_4 );
4791+ addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (taglet ));
48664792 addTaglets (arguments );
48674793 addTagletsFromTagletArtifacts (arguments );
4868- addArgIfNotEmpty (arguments , "-tagletpath" , JavadocUtil .quotedPathArgument (getTagletPath ()), SINCE_JAVADOC_1_4 );
4794+ addArgIfNotEmpty (arguments , "-tagletpath" , JavadocUtil .quotedPathArgument (getTagletPath ()));
48694795
48704796 addTags (arguments );
48714797
4872- addArgIfNotEmpty (arguments , "-top" , JavadocUtil .quotedArgument (top ), false , false , SINCE_JAVADOC_1_6 );
4798+ addArgIfNotEmpty (arguments , "-top" , JavadocUtil .quotedArgument (top ), false , false );
48734799
48744800 addArgIf (arguments , use , "-use" );
48754801
@@ -4934,7 +4860,7 @@ private void addTags(List<String> arguments) throws MavenReportException {
49344860 }
49354861 }
49364862 value += "\" " ;
4937- addArgIfNotEmpty (arguments , "-tag" , value , SINCE_JAVADOC_1_4 );
4863+ addArgIfNotEmpty (arguments , "-tag" , value );
49384864 }
49394865 }
49404866 }
@@ -4955,8 +4881,7 @@ private void addTaglets(List<String> arguments) {
49554881 getLog ().warn ("A taglet option is empty. Ignore this option." );
49564882 }
49574883 } else {
4958- addArgIfNotEmpty (
4959- arguments , "-taglet" , JavadocUtil .quotedArgument (taglet1 .getTagletClass ()), SINCE_JAVADOC_1_4 );
4884+ addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (taglet1 .getTagletClass ()));
49604885 }
49614886 }
49624887 }
@@ -5054,7 +4979,7 @@ private void addTagletsFromTagletArtifacts(List<String> arguments) throws MavenR
50544979
50554980 if (tagletClasses != null && !tagletClasses .isEmpty ()) {
50564981 for (String tagletClass : tagletClasses ) {
5057- addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (tagletClass ), SINCE_JAVADOC_1_4 );
4982+ addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (tagletClass ));
50584983 }
50594984 }
50604985 }
@@ -5601,7 +5526,7 @@ private List<String> getDependenciesLinks() {
56015526 url = getJavadocLink (artifactProject );
56025527 detected = true ;
56035528 } catch (ProjectBuildingException e ) {
5604- logError ("ProjectBuildingException for " + artifact . toString () + ": " + e .getMessage (), e );
5529+ logError ("ProjectBuildingException for " + artifact + ": " + e .getMessage (), e );
56055530 continue ;
56065531 }
56075532 }
0 commit comments