@@ -211,44 +211,6 @@ public abstract class AbstractJavadocMojo extends AbstractMojo {
211211 private static final String PACKAGE_LIST = "package-list" ;
212212 private static final String ELEMENT_LIST = "element-list" ;
213213
214- /**
215- * For Javadoc options appears since Java 1.4.
216- * See <a href="https://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/whatsnew-1.4.1.html#summary">
217- * What's New in Javadoc 1.4</a>
218- *
219- * @since 2.1
220- */
221- private static final JavaVersion SINCE_JAVADOC_1_4 = JavaVersion .parse ("1.4" );
222-
223- /**
224- * For Javadoc options appears since Java 1.4.2.
225- * See <a
226- * href="https://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/whatsnew-1.4.2.html#commandlineoptions">
227- * What's New in Javadoc 1.4.2</a>
228- *
229- * @since 2.1
230- */
231- private static final JavaVersion SINCE_JAVADOC_1_4_2 = JavaVersion .parse ("1.4.2" );
232-
233- /**
234- * For Javadoc options appears since Java 5.0.
235- * See <a
236- * href="https://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/whatsnew-1.5.0.html#commandlineoptions">
237- * What's New in Javadoc 5.0</a>
238- *
239- * @since 2.1
240- */
241- private static final JavaVersion SINCE_JAVADOC_1_5 = JavaVersion .parse ("1.5" );
242-
243- /**
244- * For Javadoc options appears since Java 6.0.
245- * See <a href="https://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/index.html">
246- * Javadoc Technology</a>
247- *
248- * @since 2.4
249- */
250- private static final JavaVersion SINCE_JAVADOC_1_6 = JavaVersion .parse ("1.6" );
251-
252214 /**
253215 * For Javadoc options appears since Java 8.0.
254216 * See <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/index.html">
@@ -1801,7 +1763,7 @@ protected List<String> getProjectSourceRoots(MavenProject p) {
18011763 }
18021764
18031765 return p .getCompileSourceRoots () == null
1804- ? Collections .< String > emptyList ()
1766+ ? Collections .emptyList ()
18051767 : new LinkedList <>(p .getCompileSourceRoots ());
18061768 }
18071769
@@ -1815,7 +1777,7 @@ protected List<String> getExecutionProjectSourceRoots(MavenProject p) {
18151777 }
18161778
18171779 return p .getExecutionProject ().getCompileSourceRoots () == null
1818- ? Collections .< String > emptyList ()
1780+ ? Collections .emptyList ()
18191781 : new LinkedList <>(p .getExecutionProject ().getCompileSourceRoots ());
18201782 }
18211783
@@ -3329,7 +3291,7 @@ private List<String> getArtifactsAbsolutePath(JavadocPathArtifact javadocArtifac
33293291 * @param javadocArtifact the {@link JavadocPathArtifact} to resolve
33303292 * @return a resolved {@link Artifact}
33313293 * @throws org.eclipse.aether.resolution.ArtifactResolutionException
3332- * @throws ArtifactResolverException issue while resolving artifact
3294+ * @throws org.eclipse.aether.resolution.ArtifactResolutionException issue while resolving artifact
33333295 */
33343296 private Artifact createAndResolveArtifact (JavadocPathArtifact javadocArtifact )
33353297 throws org .eclipse .aether .resolution .ArtifactResolutionException {
@@ -3860,7 +3822,6 @@ private void addLinkArguments(List<String> arguments) throws MavenReportExceptio
38603822 *
38613823 * @param javadocOutputDirectory not null
38623824 * @throws MavenReportException if any
3863- * @see #copyDefaultStylesheet(File)
38643825 * @see #copyJavadocResources(File)
38653826 * @see #copyAdditionalJavadocResources(File)
38663827 */
@@ -4233,13 +4194,8 @@ private void addCommandLineOptions(Commandline cmd, List<String> arguments, File
42334194 private void addCommandLineArgFile (Commandline cmd , File javadocOutputDirectory , List <String > files )
42344195 throws MavenReportException {
42354196 File argfileFile ;
4236- if (JAVA_VERSION .compareTo (SINCE_JAVADOC_1_4 ) >= 0 ) {
4237- argfileFile = new File (javadocOutputDirectory , ARGFILE_FILE_NAME );
4238- cmd .createArg ().setValue ("@" + ARGFILE_FILE_NAME );
4239- } else {
4240- argfileFile = new File (javadocOutputDirectory , FILES_FILE_NAME );
4241- cmd .createArg ().setValue ("@" + FILES_FILE_NAME );
4242- }
4197+ argfileFile = new File (javadocOutputDirectory , ARGFILE_FILE_NAME );
4198+ cmd .createArg ().setValue ("@" + ARGFILE_FILE_NAME );
42434199
42444200 List <String > quotedFiles = new ArrayList <>(files .size ());
42454201 for (String file : files ) {
@@ -4377,20 +4333,15 @@ private void addJavadocOptions(
43774333
43784334 // all options in alphabetical order
43794335
4380- if (old && isJavaDocVersionAtLeast (SINCE_JAVADOC_1_4 )) {
4381- if (getLog ().isWarnEnabled ()) {
4382- getLog ().warn ("Javadoc 1.4+ doesn't support the -1.1 switch anymore. Ignore this option." );
4383- }
4384- } else {
4385- 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." );
43864338 }
43874339
43884340 addArgIfNotEmpty (arguments , "-bootclasspath" , JavadocUtil .quotedPathArgument (getBootclassPath ()));
43894341
4390- if (isJavaDocVersionAtLeast ( SINCE_JAVADOC_1_5 ) ) {
4391- addArgIf (arguments , breakiterator , "-breakiterator" , SINCE_JAVADOC_1_5 );
4342+ if (breakiterator ) {
4343+ addArgIf (arguments , breakiterator , "-breakiterator" );
43924344 }
4393-
43944345 List <MavenProject > aggregatedProjects = reactorProjects ; // getAggregatedProjects();
43954346 Map <String , MavenProject > reactorKeys = new HashMap <>(aggregatedProjects .size ());
43964347 for (MavenProject reactorProject : aggregatedProjects ) {
@@ -4650,15 +4601,13 @@ private void addJavadocOptions(
46504601
46514602 arguments .add (getAccessLevel ());
46524603
4653- if (isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) {
4654- addArgIf (arguments , quiet , "-quiet" , SINCE_JAVADOC_1_5 );
4655- }
4604+ addArgIf (arguments , quiet , "-quiet" );
46564605
46574606 if (javadocRuntimeVersion .isAtLeast ("9" ) && release != null ) {
46584607 arguments .add ("--release" );
46594608 arguments .add (release );
46604609 } else {
4661- addArgIfNotEmpty (arguments , "-source" , JavadocUtil .quotedArgument (source ), SINCE_JAVADOC_1_4 );
4610+ addArgIfNotEmpty (arguments , "-source" , JavadocUtil .quotedArgument (source ));
46624611 }
46634612
46644613 if ((sourcepath == null || sourcepath .isEmpty ()) && (subpackages != null && !subpackages .isEmpty ())) {
@@ -4681,12 +4630,10 @@ private void addJavadocOptions(
46814630 arguments , "--module-source-path" , JavadocUtil .quotedPathArgument (moduleSourceDir .toString ()));
46824631 }
46834632
4684- if ((sourcepath != null && !sourcepath .isEmpty ()) && isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) {
4685- addArgIfNotEmpty (arguments , "-subpackages" , subpackages , SINCE_JAVADOC_1_5 );
4686- }
4633+ addArgIfNotEmpty (arguments , "-subpackages" , subpackages );
46874634
46884635 // [MJAVADOC-497] must be after sourcepath is recalculated, since getExcludedPackages() depends on it
4689- addArgIfNotEmpty (arguments , "-exclude" , getExcludedPackages (sourcePaths ), SINCE_JAVADOC_1_4 );
4636+ addArgIfNotEmpty (arguments , "-exclude" , getExcludedPackages (sourcePaths ));
46904637
46914638 addArgIf (arguments , verbose , "-verbose" );
46924639
@@ -4756,28 +4703,23 @@ private void addStandardDocletOptions(
47564703
47574704 addArgIfNotEmpty (arguments , "-bottom" , JavadocUtil .quotedArgument (getBottomText ()), false , false );
47584705
4759- if (!isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) {
4760- addArgIf (arguments , breakiterator , "-breakiterator" , SINCE_JAVADOC_1_4 );
4761- }
4706+ addArgIf (arguments , breakiterator , "-breakiterator" );
47624707
47634708 addArgIfNotEmpty (arguments , "-charset" , JavadocUtil .quotedArgument (getCharset ()));
47644709
47654710 addArgIfNotEmpty (arguments , "-d" , JavadocUtil .quotedPathArgument (javadocOutputDirectory .toString ()));
47664711
47674712 addArgIfNotEmpty (arguments , "-docencoding" , JavadocUtil .quotedArgument (getDocencoding ()));
47684713
4769- addArgIf (arguments , docfilessubdirs , "-docfilessubdirs" , SINCE_JAVADOC_1_4 );
4714+ addArgIf (arguments , docfilessubdirs , "-docfilessubdirs" );
47704715
47714716 addArgIf (arguments , (doclint != null && !doclint .isEmpty ()), "-Xdoclint:" + getDoclint (), SINCE_JAVADOC_1_8 );
47724717
47734718 addArgIfNotEmpty (arguments , "-doctitle" , JavadocUtil .quotedArgument (getDoctitle ()), false , false );
47744719
47754720 if (docfilessubdirs ) {
47764721 addArgIfNotEmpty (
4777- arguments ,
4778- "-excludedocfilessubdir" ,
4779- JavadocUtil .quotedPathArgument (excludedocfilessubdir ),
4780- SINCE_JAVADOC_1_4 );
4722+ arguments , "-excludedocfilessubdir" , JavadocUtil .quotedPathArgument (excludedocfilessubdir ));
47814723 }
47824724
47834725 addArgIfNotEmpty (arguments , "-footer" , JavadocUtil .quotedArgument (footer ), false , false );
@@ -4786,30 +4728,23 @@ private void addStandardDocletOptions(
47864728
47874729 addArgIfNotEmpty (arguments , "-header" , JavadocUtil .quotedArgument (header ), false , false );
47884730
4789- Optional <File > helpFile = getHelpFile (javadocOutputDirectory );
4790- if (helpFile .isPresent ()) {
4791- addArgIfNotEmpty (
4792- arguments ,
4793- "-helpfile" ,
4794- JavadocUtil .quotedPathArgument (helpFile .get ().getAbsolutePath ()));
4795- }
4731+ getHelpFile (javadocOutputDirectory )
4732+ .ifPresent (file -> addArgIfNotEmpty (
4733+ arguments , "-helpfile" , JavadocUtil .quotedPathArgument (file .getAbsolutePath ())));
47964734
4797- addArgIf (arguments , keywords , "-keywords" , SINCE_JAVADOC_1_4_2 );
4735+ addArgIf (arguments , keywords , "-keywords" );
47984736
47994737 addLinkArguments (arguments );
48004738
48014739 addLinkofflineArguments (arguments , offlineLinks );
48024740
4803- addArgIf (arguments , linksource , "-linksource" , SINCE_JAVADOC_1_4 );
4741+ addArgIf (arguments , linksource , "-linksource" );
48044742
48054743 if (sourcetab > 0 ) {
4806- if (javadocRuntimeVersion == SINCE_JAVADOC_1_4_2 ) {
4807- addArgIfNotEmpty (arguments , "-linksourcetab" , String .valueOf (sourcetab ));
4808- }
4809- addArgIfNotEmpty (arguments , "-sourcetab" , String .valueOf (sourcetab ), SINCE_JAVADOC_1_5 );
4744+ addArgIfNotEmpty (arguments , "-sourcetab" , String .valueOf (sourcetab ));
48104745 }
48114746
4812- addArgIf (arguments , nocomment , "-nocomment" , SINCE_JAVADOC_1_4 );
4747+ addArgIf (arguments , nocomment , "-nocomment" );
48134748
48144749 addArgIf (arguments , nodeprecated , "-nodeprecated" );
48154750
@@ -4823,7 +4758,7 @@ private void addStandardDocletOptions(
48234758
48244759 addArgIf (arguments , nooverview , "-nooverview" );
48254760
4826- addArgIfNotEmpty (arguments , "-noqualifier" , JavadocUtil .quotedArgument (noqualifier ), SINCE_JAVADOC_1_4 );
4761+ addArgIfNotEmpty (arguments , "-noqualifier" , JavadocUtil .quotedArgument (noqualifier ));
48274762
48284763 addArgIf (arguments , nosince , "-nosince" );
48294764
@@ -4833,44 +4768,34 @@ private void addStandardDocletOptions(
48334768 notimestamp = true ;
48344769 }
48354770
4836- addArgIf (arguments , notimestamp , "-notimestamp" , SINCE_JAVADOC_1_5 );
4771+ addArgIf (arguments , notimestamp , "-notimestamp" );
48374772
48384773 addArgIf (arguments , notree , "-notree" );
48394774
4840- addArgIfNotEmpty (arguments , "-packagesheader" , JavadocUtil .quotedArgument (packagesheader ), SINCE_JAVADOC_1_4_2 );
4775+ addArgIfNotEmpty (arguments , "-packagesheader" , JavadocUtil .quotedArgument (packagesheader ));
48414776
4842- if (!isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) // Sun bug: 4714350
4843- {
4844- addArgIf (arguments , quiet , "-quiet" , SINCE_JAVADOC_1_4 );
4845- }
4777+ addArgIf (arguments , quiet , "-quiet" );
48464778
48474779 addArgIf (arguments , serialwarn , "-serialwarn" );
48484780
48494781 addArgIf (arguments , splitindex , "-splitindex" );
48504782
4851- Optional <File > stylesheetfile = getStylesheetFile (javadocOutputDirectory );
4852-
4853- if (stylesheetfile .isPresent ()) {
4854- addArgIfNotEmpty (
4855- arguments ,
4856- "-stylesheetfile" ,
4857- JavadocUtil .quotedPathArgument (stylesheetfile .get ().getAbsolutePath ()));
4858- }
4783+ getStylesheetFile (javadocOutputDirectory )
4784+ .ifPresent (file -> addArgIfNotEmpty (
4785+ arguments , "-stylesheetfile" , JavadocUtil .quotedPathArgument (file .getAbsolutePath ())));
48594786
48604787 addAddStyleSheets (arguments );
48614788
4862- if ((sourcepath != null && !sourcepath .isEmpty ()) && !isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) {
4863- addArgIfNotEmpty (arguments , "-subpackages" , subpackages , SINCE_JAVADOC_1_4 );
4864- }
4789+ addArgIfNotEmpty (arguments , "-subpackages" , subpackages );
48654790
4866- addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (taglet ), SINCE_JAVADOC_1_4 );
4791+ addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (taglet ));
48674792 addTaglets (arguments );
48684793 addTagletsFromTagletArtifacts (arguments );
4869- addArgIfNotEmpty (arguments , "-tagletpath" , JavadocUtil .quotedPathArgument (getTagletPath ()), SINCE_JAVADOC_1_4 );
4794+ addArgIfNotEmpty (arguments , "-tagletpath" , JavadocUtil .quotedPathArgument (getTagletPath ()));
48704795
48714796 addTags (arguments );
48724797
4873- addArgIfNotEmpty (arguments , "-top" , JavadocUtil .quotedArgument (top ), false , false , SINCE_JAVADOC_1_6 );
4798+ addArgIfNotEmpty (arguments , "-top" , JavadocUtil .quotedArgument (top ), false , false );
48744799
48754800 addArgIf (arguments , use , "-use" );
48764801
@@ -4935,7 +4860,7 @@ private void addTags(List<String> arguments) throws MavenReportException {
49354860 }
49364861 }
49374862 value += "\" " ;
4938- addArgIfNotEmpty (arguments , "-tag" , value , SINCE_JAVADOC_1_4 );
4863+ addArgIfNotEmpty (arguments , "-tag" , value );
49394864 }
49404865 }
49414866 }
@@ -4956,8 +4881,7 @@ private void addTaglets(List<String> arguments) {
49564881 getLog ().warn ("A taglet option is empty. Ignore this option." );
49574882 }
49584883 } else {
4959- addArgIfNotEmpty (
4960- arguments , "-taglet" , JavadocUtil .quotedArgument (taglet1 .getTagletClass ()), SINCE_JAVADOC_1_4 );
4884+ addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (taglet1 .getTagletClass ()));
49614885 }
49624886 }
49634887 }
@@ -5055,7 +4979,7 @@ private void addTagletsFromTagletArtifacts(List<String> arguments) throws MavenR
50554979
50564980 if (tagletClasses != null && !tagletClasses .isEmpty ()) {
50574981 for (String tagletClass : tagletClasses ) {
5058- addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (tagletClass ), SINCE_JAVADOC_1_4 );
4982+ addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (tagletClass ));
50594983 }
50604984 }
50614985 }
@@ -5602,7 +5526,7 @@ private List<String> getDependenciesLinks() {
56025526 url = getJavadocLink (artifactProject );
56035527 detected = true ;
56045528 } catch (ProjectBuildingException e ) {
5605- logError ("ProjectBuildingException for " + artifact . toString () + ": " + e .getMessage (), e );
5529+ logError ("ProjectBuildingException for " + artifact + ": " + e .getMessage (), e );
56065530 continue ;
56075531 }
56085532 }
0 commit comments