[plexus-compiler] 01/01: Automatically adjust the source/target to 1.7 if a lower level is specified

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Tue Jul 4 07:15:41 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository plexus-compiler.

commit 467641cd667a21e893a9aa1481a1e52319f0c66d
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Tue Jul 4 09:15:26 2017 +0200

    Automatically adjust the source/target to 1.7 if a lower level is specified
---
 debian/changelog                                |  7 +++++
 debian/patches/auto-adjust-language-level.patch | 42 +++++++++++++++++++++++++
 debian/patches/series                           |  1 +
 3 files changed, 50 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index ca57b18..379c62e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+plexus-compiler (2.8.2-2) unstable; urgency=medium
+
+  * Team upload.
+  * Automatically adjust the source/target to 1.7 if a lower level is specified
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Tue, 04 Jul 2017 09:15:04 +0200
+
 plexus-compiler (2.8.2-1) unstable; urgency=medium
 
   * Team upload.
diff --git a/debian/patches/auto-adjust-language-level.patch b/debian/patches/auto-adjust-language-level.patch
new file mode 100644
index 0000000..431f1c3
--- /dev/null
+++ b/debian/patches/auto-adjust-language-level.patch
@@ -0,0 +1,42 @@
+Description: Adjust the source/target level automatically for building with recent JDKs
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: not-needed
+--- a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java
++++ b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java
+@@ -339,12 +339,20 @@
+         }
+         else
+         {
++            List<String> unsupportedLanguageLevels = java.util.Arrays.asList(new String[]{"1.1", "1.2", "1.3", "1.4", "1.5", "5"});
++
+             // TODO: this could be much improved
+             if ( StringUtils.isEmpty( config.getTargetVersion() ) )
+             {
+                 // Required, or it defaults to the target of your JDK (eg 1.5)
+                 args.add( "-target" );
+-                args.add( "1.1" );
++                args.add( "1.7" );
++            }
++            else if ( unsupportedLanguageLevels.contains( config.getTargetVersion() ) )
++            {
++                System.err.println( "Use of target " + config.getTargetVersion() + " is no longer supported, switching to 1.7" );
++                args.add( "-target" );
++                args.add( "1.7" );
+             }
+             else
+             {
+@@ -356,7 +364,13 @@
+             {
+                 // If omitted, later JDKs complain about a 1.1 target
+                 args.add( "-source" );
+-                args.add( "1.3" );
++                args.add( "1.7" );
++            }
++            else if ( !suppressSource( config ) && unsupportedLanguageLevels.contains( config.getSourceVersion() ) )
++            {
++                 System.err.println( "Use of source " + config.getSourceVersion() + " is no longer supported, switching to 1.7" );
++                args.add( "-source" );
++                args.add( "1.7" );
+             }
+             else if ( !suppressSource( config ) )
+             {
diff --git a/debian/patches/series b/debian/patches/series
index 9935f49..30ad069 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 fix_test_classpath.patch
+auto-adjust-language-level.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/plexus-compiler.git



More information about the pkg-java-commits mailing list