File: auto-adjust-language-level.patch

package info (click to toggle)
maven-javadoc-plugin 3.4.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,176 kB
  • sloc: java: 16,707; xml: 9,530; jsp: 5; makefile: 2; sh: 1
file content (34 lines) | stat: -rw-r--r-- 1,525 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Description: Adjust the source/release level automatically for building with recent JDKs
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -158,6 +158,8 @@
 public abstract class AbstractJavadocMojo
     extends AbstractMojo
 {
+    private List<String> unsupportedLanguageLevels = java.util.Arrays.asList(new String[]{"1.1", "1.2", "1.3", "1.4", "1.5", "5", "1.6", "6"});
+
     /**
      * Classifier used in the name of the javadoc-options XML file, and in the resources bundle
      * artifact that gets attached to the project. This one is used for non-test javadocs.
@@ -2028,6 +2030,19 @@
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
+	String defaultLevel = "7";
+        if ( unsupportedLanguageLevels.contains( release ) )
+        {
+            System.err.println( "Use of release " + release + " is no longer supported, switching to " + defaultLevel );
+            release = defaultLevel;
+        }
+
+        if ( unsupportedLanguageLevels.contains( source ) )
+        {
+            System.err.println( "Use of source " + source + " is no longer supported, switching to " + defaultLevel );
+            source = defaultLevel;
+        }
+
         verifyRemovedParameter( "aggregator" );
         verifyRemovedParameter( "proxyHost" );
         verifyRemovedParameter( "proxyPort" );