@@ -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
@@ -3330,7 +3292,7 @@ private List<String> getArtifactsAbsolutePath(JavadocPathArtifact javadocArtifac
33303292 * @param javadocArtifact the {@link JavadocPathArtifact} to resolve
33313293 * @return a resolved {@link Artifact}
33323294 * @throws org.eclipse.aether.resolution.ArtifactResolutionException
3333- * @throws ArtifactResolverException issue while resolving artifact
3295+ * @throws org.eclipse.aether.resolution.ArtifactResolutionException issue while resolving artifact
33343296 */
33353297 private Artifact createAndResolveArtifact (JavadocPathArtifact javadocArtifact )
33363298 throws org .eclipse .aether .resolution .ArtifactResolutionException {
@@ -3861,7 +3823,6 @@ private void addLinkArguments(List<String> arguments) throws MavenReportExceptio
38613823 *
38623824 * @param javadocOutputDirectory not null
38633825 * @throws MavenReportException if any
3864- * @see #copyDefaultStylesheet(File)
38653826 * @see #copyJavadocResources(File)
38663827 * @see #copyAdditionalJavadocResources(File)
38673828 */
@@ -4234,13 +4195,8 @@ private void addCommandLineOptions(Commandline cmd, List<String> arguments, File
42344195 private void addCommandLineArgFile (Commandline cmd , File javadocOutputDirectory , List <String > files )
42354196 throws MavenReportException {
42364197 File argfileFile ;
4237- if (JAVA_VERSION .compareTo (SINCE_JAVADOC_1_4 ) >= 0 ) {
4238- argfileFile = new File (javadocOutputDirectory , ARGFILE_FILE_NAME );
4239- cmd .createArg ().setValue ("@" + ARGFILE_FILE_NAME );
4240- } else {
4241- argfileFile = new File (javadocOutputDirectory , FILES_FILE_NAME );
4242- cmd .createArg ().setValue ("@" + FILES_FILE_NAME );
4243- }
4198+ argfileFile = new File (javadocOutputDirectory , ARGFILE_FILE_NAME );
4199+ cmd .createArg ().setValue ("@" + ARGFILE_FILE_NAME );
42444200
42454201 List <String > quotedFiles = new ArrayList <>(files .size ());
42464202 for (String file : files ) {
@@ -4378,20 +4334,15 @@ private void addJavadocOptions(
43784334
43794335 // all options in alphabetical order
43804336
4381- if (old && isJavaDocVersionAtLeast (SINCE_JAVADOC_1_4 )) {
4382- if (getLog ().isWarnEnabled ()) {
4383- getLog ().warn ("Javadoc 1.4+ doesn't support the -1.1 switch anymore. Ignore this option." );
4384- }
4385- } else {
4386- addArgIf (arguments , old , "-1.1" );
4337+ if (getLog ().isWarnEnabled ()) {
4338+ getLog ().warn ("Javadoc 1.4+ doesn't support the -1.1 switch anymore. Ignore this option." );
43874339 }
43884340
43894341 addArgIfNotEmpty (arguments , "-bootclasspath" , JavadocUtil .quotedPathArgument (getBootclassPath ()));
43904342
4391- if (isJavaDocVersionAtLeast ( SINCE_JAVADOC_1_5 ) ) {
4392- addArgIf (arguments , breakiterator , "-breakiterator" , SINCE_JAVADOC_1_5 );
4343+ if (breakiterator ) {
4344+ addArgIf (arguments , breakiterator , "-breakiterator" );
43934345 }
4394-
43954346 List <MavenProject > aggregatedProjects = reactorProjects ; // getAggregatedProjects();
43964347 Map <String , MavenProject > reactorKeys = new HashMap <>(aggregatedProjects .size ());
43974348 for (MavenProject reactorProject : aggregatedProjects ) {
@@ -4651,15 +4602,13 @@ private void addJavadocOptions(
46514602
46524603 arguments .add (getAccessLevel ());
46534604
4654- if (isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) {
4655- addArgIf (arguments , quiet , "-quiet" , SINCE_JAVADOC_1_5 );
4656- }
4605+ addArgIf (arguments , quiet , "-quiet" );
46574606
46584607 if (javadocRuntimeVersion .isAtLeast ("9" ) && release != null ) {
46594608 arguments .add ("--release" );
46604609 arguments .add (release );
46614610 } else {
4662- addArgIfNotEmpty (arguments , "-source" , JavadocUtil .quotedArgument (source ), SINCE_JAVADOC_1_4 );
4611+ addArgIfNotEmpty (arguments , "-source" , JavadocUtil .quotedArgument (source ));
46634612 }
46644613
46654614 if ((sourcepath == null || sourcepath .isEmpty ()) && (subpackages != null && !subpackages .isEmpty ())) {
@@ -4682,12 +4631,10 @@ private void addJavadocOptions(
46824631 arguments , "--module-source-path" , JavadocUtil .quotedPathArgument (moduleSourceDir .toString ()));
46834632 }
46844633
4685- if ((sourcepath != null && !sourcepath .isEmpty ()) && isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) {
4686- addArgIfNotEmpty (arguments , "-subpackages" , subpackages , SINCE_JAVADOC_1_5 );
4687- }
4634+ addArgIfNotEmpty (arguments , "-subpackages" , subpackages );
46884635
46894636 // [MJAVADOC-497] must be after sourcepath is recalculated, since getExcludedPackages() depends on it
4690- addArgIfNotEmpty (arguments , "-exclude" , getExcludedPackages (sourcePaths ), SINCE_JAVADOC_1_4 );
4637+ addArgIfNotEmpty (arguments , "-exclude" , getExcludedPackages (sourcePaths ));
46914638
46924639 addArgIf (arguments , verbose , "-verbose" );
46934640
@@ -4757,28 +4704,23 @@ private void addStandardDocletOptions(
47574704
47584705 addArgIfNotEmpty (arguments , "-bottom" , JavadocUtil .quotedArgument (getBottomText ()), false , false );
47594706
4760- if (!isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) {
4761- addArgIf (arguments , breakiterator , "-breakiterator" , SINCE_JAVADOC_1_4 );
4762- }
4707+ addArgIf (arguments , breakiterator , "-breakiterator" );
47634708
47644709 addArgIfNotEmpty (arguments , "-charset" , JavadocUtil .quotedArgument (getCharset ()));
47654710
47664711 addArgIfNotEmpty (arguments , "-d" , JavadocUtil .quotedPathArgument (javadocOutputDirectory .toString ()));
47674712
47684713 addArgIfNotEmpty (arguments , "-docencoding" , JavadocUtil .quotedArgument (getDocencoding ()));
47694714
4770- addArgIf (arguments , docfilessubdirs , "-docfilessubdirs" , SINCE_JAVADOC_1_4 );
4715+ addArgIf (arguments , docfilessubdirs , "-docfilessubdirs" );
47714716
47724717 addArgIf (arguments , (doclint != null && !doclint .isEmpty ()), "-Xdoclint:" + getDoclint (), SINCE_JAVADOC_1_8 );
47734718
47744719 addArgIfNotEmpty (arguments , "-doctitle" , JavadocUtil .quotedArgument (getDoctitle ()), false , false );
47754720
47764721 if (docfilessubdirs ) {
47774722 addArgIfNotEmpty (
4778- arguments ,
4779- "-excludedocfilessubdir" ,
4780- JavadocUtil .quotedPathArgument (excludedocfilessubdir ),
4781- SINCE_JAVADOC_1_4 );
4723+ arguments , "-excludedocfilessubdir" , JavadocUtil .quotedPathArgument (excludedocfilessubdir ));
47824724 }
47834725
47844726 addArgIfNotEmpty (arguments , "-footer" , JavadocUtil .quotedArgument (footer ), false , false );
@@ -4787,30 +4729,23 @@ private void addStandardDocletOptions(
47874729
47884730 addArgIfNotEmpty (arguments , "-header" , JavadocUtil .quotedArgument (header ), false , false );
47894731
4790- Optional <File > helpFile = getHelpFile (javadocOutputDirectory );
4791- if (helpFile .isPresent ()) {
4792- addArgIfNotEmpty (
4793- arguments ,
4794- "-helpfile" ,
4795- JavadocUtil .quotedPathArgument (helpFile .get ().getAbsolutePath ()));
4796- }
4732+ getHelpFile (javadocOutputDirectory )
4733+ .ifPresent (file -> addArgIfNotEmpty (
4734+ arguments , "-helpfile" , JavadocUtil .quotedPathArgument (file .getAbsolutePath ())));
47974735
4798- addArgIf (arguments , keywords , "-keywords" , SINCE_JAVADOC_1_4_2 );
4736+ addArgIf (arguments , keywords , "-keywords" );
47994737
48004738 addLinkArguments (arguments );
48014739
48024740 addLinkofflineArguments (arguments , offlineLinks );
48034741
4804- addArgIf (arguments , linksource , "-linksource" , SINCE_JAVADOC_1_4 );
4742+ addArgIf (arguments , linksource , "-linksource" );
48054743
48064744 if (sourcetab > 0 ) {
4807- if (javadocRuntimeVersion == SINCE_JAVADOC_1_4_2 ) {
4808- addArgIfNotEmpty (arguments , "-linksourcetab" , String .valueOf (sourcetab ));
4809- }
4810- addArgIfNotEmpty (arguments , "-sourcetab" , String .valueOf (sourcetab ), SINCE_JAVADOC_1_5 );
4745+ addArgIfNotEmpty (arguments , "-sourcetab" , String .valueOf (sourcetab ));
48114746 }
48124747
4813- addArgIf (arguments , nocomment , "-nocomment" , SINCE_JAVADOC_1_4 );
4748+ addArgIf (arguments , nocomment , "-nocomment" );
48144749
48154750 addArgIf (arguments , nodeprecated , "-nodeprecated" );
48164751
@@ -4824,7 +4759,7 @@ private void addStandardDocletOptions(
48244759
48254760 addArgIf (arguments , nooverview , "-nooverview" );
48264761
4827- addArgIfNotEmpty (arguments , "-noqualifier" , JavadocUtil .quotedArgument (noqualifier ), SINCE_JAVADOC_1_4 );
4762+ addArgIfNotEmpty (arguments , "-noqualifier" , JavadocUtil .quotedArgument (noqualifier ));
48284763
48294764 addArgIf (arguments , nosince , "-nosince" );
48304765
@@ -4834,44 +4769,34 @@ private void addStandardDocletOptions(
48344769 notimestamp = true ;
48354770 }
48364771
4837- addArgIf (arguments , notimestamp , "-notimestamp" , SINCE_JAVADOC_1_5 );
4772+ addArgIf (arguments , notimestamp , "-notimestamp" );
48384773
48394774 addArgIf (arguments , notree , "-notree" );
48404775
4841- addArgIfNotEmpty (arguments , "-packagesheader" , JavadocUtil .quotedArgument (packagesheader ), SINCE_JAVADOC_1_4_2 );
4776+ addArgIfNotEmpty (arguments , "-packagesheader" , JavadocUtil .quotedArgument (packagesheader ));
48424777
4843- if (!isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) // Sun bug: 4714350
4844- {
4845- addArgIf (arguments , quiet , "-quiet" , SINCE_JAVADOC_1_4 );
4846- }
4778+ addArgIf (arguments , quiet , "-quiet" );
48474779
48484780 addArgIf (arguments , serialwarn , "-serialwarn" );
48494781
48504782 addArgIf (arguments , splitindex , "-splitindex" );
48514783
4852- Optional <File > stylesheetfile = getStylesheetFile (javadocOutputDirectory );
4853-
4854- if (stylesheetfile .isPresent ()) {
4855- addArgIfNotEmpty (
4856- arguments ,
4857- "-stylesheetfile" ,
4858- JavadocUtil .quotedPathArgument (stylesheetfile .get ().getAbsolutePath ()));
4859- }
4784+ getStylesheetFile (javadocOutputDirectory )
4785+ .ifPresent (file -> addArgIfNotEmpty (
4786+ arguments , "-stylesheetfile" , JavadocUtil .quotedPathArgument (file .getAbsolutePath ())));
48604787
48614788 addAddStyleSheets (arguments );
48624789
4863- if ((sourcepath != null && !sourcepath .isEmpty ()) && !isJavaDocVersionAtLeast (SINCE_JAVADOC_1_5 )) {
4864- addArgIfNotEmpty (arguments , "-subpackages" , subpackages , SINCE_JAVADOC_1_4 );
4865- }
4790+ addArgIfNotEmpty (arguments , "-subpackages" , subpackages );
48664791
4867- addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (taglet ), SINCE_JAVADOC_1_4 );
4792+ addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (taglet ));
48684793 addTaglets (arguments );
48694794 addTagletsFromTagletArtifacts (arguments );
4870- addArgIfNotEmpty (arguments , "-tagletpath" , JavadocUtil .quotedPathArgument (getTagletPath ()), SINCE_JAVADOC_1_4 );
4795+ addArgIfNotEmpty (arguments , "-tagletpath" , JavadocUtil .quotedPathArgument (getTagletPath ()));
48714796
48724797 addTags (arguments );
48734798
4874- addArgIfNotEmpty (arguments , "-top" , JavadocUtil .quotedArgument (top ), false , false , SINCE_JAVADOC_1_6 );
4799+ addArgIfNotEmpty (arguments , "-top" , JavadocUtil .quotedArgument (top ), false , false );
48754800
48764801 addArgIf (arguments , use , "-use" );
48774802
@@ -4936,7 +4861,7 @@ private void addTags(List<String> arguments) throws MavenReportException {
49364861 }
49374862 }
49384863 value += "\" " ;
4939- addArgIfNotEmpty (arguments , "-tag" , value , SINCE_JAVADOC_1_4 );
4864+ addArgIfNotEmpty (arguments , "-tag" , value );
49404865 }
49414866 }
49424867 }
@@ -4957,8 +4882,7 @@ private void addTaglets(List<String> arguments) {
49574882 getLog ().warn ("A taglet option is empty. Ignore this option." );
49584883 }
49594884 } else {
4960- addArgIfNotEmpty (
4961- arguments , "-taglet" , JavadocUtil .quotedArgument (taglet1 .getTagletClass ()), SINCE_JAVADOC_1_4 );
4885+ addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (taglet1 .getTagletClass ()));
49624886 }
49634887 }
49644888 }
@@ -5056,7 +4980,7 @@ private void addTagletsFromTagletArtifacts(List<String> arguments) throws MavenR
50564980
50574981 if (tagletClasses != null && !tagletClasses .isEmpty ()) {
50584982 for (String tagletClass : tagletClasses ) {
5059- addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (tagletClass ), SINCE_JAVADOC_1_4 );
4983+ addArgIfNotEmpty (arguments , "-taglet" , JavadocUtil .quotedArgument (tagletClass ));
50604984 }
50614985 }
50624986 }
@@ -5603,7 +5527,7 @@ private List<String> getDependenciesLinks() {
56035527 url = getJavadocLink (artifactProject );
56045528 detected = true ;
56055529 } catch (ProjectBuildingException e ) {
5606- logError ("ProjectBuildingException for " + artifact . toString () + ": " + e .getMessage (), e );
5530+ logError ("ProjectBuildingException for " + artifact + ": " + e .getMessage (), e );
56075531 continue ;
56085532 }
56095533 }
0 commit comments