Hi Tiago, Le 14/04/2018 à 03:11, Tiago Daitx a écrit :
> Please review the new debdiff attached in this email. Thank you fo the update. I'm attaching the revised patch since it wasn't sent to the bug log. I suggest also setting the -release parameter when the VM is forked. Since the plexus-compiler package is only used to build Debian packages with the default JDK there is no risk of calling a JDK that doesn't support the new parameter. Also no need to print the deprecation message for the source/target parameters, this is Debian specific and we aren't going to reconfigure all upstream projects ourself anyway. Emmanuel Bourg
diff -Nru plexus-compiler-2.8.2/debian/changelog plexus-compiler-2.8.2/debian/changelog --- plexus-compiler-2.8.2/debian/changelog 2017-09-18 10:31:35.000000000 -0300 +++ plexus-compiler-2.8.2/debian/changelog 2018-04-12 11:35:44.000000000 -0300 @@ -1,3 +1,10 @@ +plexus-compiler (2.8.2-6) UNRELEASED; urgency=medium + + * Use a default --release instead of defaults -source/-target in order to + have the right bootclasspath set as per JEP 247. (Closes: #895619) + + -- Tiago Stürmer Daitx <tiago.da...@ubuntu.com> Thu, 12 Apr 2018 14:35:44 +0000 + plexus-compiler (2.8.2-5) unstable; urgency=medium * Team upload. diff -Nru plexus-compiler-2.8.2/debian/patches/auto-adjust-language-level.patch plexus-compiler-2.8.2/debian/patches/auto-adjust-language-level.patch --- plexus-compiler-2.8.2/debian/patches/auto-adjust-language-level.patch 2017-07-04 03:58:08.000000000 -0300 +++ plexus-compiler-2.8.2/debian/patches/auto-adjust-language-level.patch 2018-04-12 11:35:44.000000000 -0300 @@ -3,40 +3,114 @@ 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 @@ +@@ -100,6 +100,16 @@ public class JavacCompiler + + private static final String JAVAC_CLASSNAME = "com.sun.tools.javac.Main"; + ++ private static final String JAVA_CLASS_VERSION = System.getProperty( "java.class.version", "0" ); ++ ++ private static final java.util.List<String> unsupportedLanguageLevels = java.util.Collections.unmodifiableList(java.util.Arrays.asList(new String[]{"1.1", "1.2", "1.3", "1.4", "1.5", "5"})); ++ ++ private static final String DEFAULT_SOURCE_VERSION = "1.7"; ++ ++ private static final String DEFAULT_TARGET_VERSION = "1.7"; ++ ++ private static final String DEFAULT_RELEASE_VERSION = "7"; ++ + private static volatile Class<?> JAVAC_CLASS; + + private List<Class<?>> javaccClasses = new CopyOnWriteArrayList<Class<?>>(); +@@ -195,6 +205,23 @@ public class JavacCompiler + } + } + ++ protected static boolean supportsReleaseFlag() ++ { ++ return getCurrentJvmClassVersion() >= 53; ++ } ++ ++ protected static int getCurrentJvmClassVersion() ++ { ++ try ++ { ++ return Float.valueOf( JAVA_CLASS_VERSION ).intValue(); ++ } ++ catch (Exception e) ++ { ++ return 0; ++ } ++ } ++ + public String[] createCommandLine( CompilerConfiguration config ) + throws CompilerException + { +@@ -339,30 +366,55 @@ public class JavacCompiler } else { -+ List<String> unsupportedLanguageLevels = java.util.Arrays.asList(new String[]{"1.1", "1.2", "1.3", "1.4", "1.5", "5"}); ++ boolean useDefaultSource = true; ++ boolean useDefaultTarget = true; + // TODO: this could be much improved - if ( StringUtils.isEmpty( config.getTargetVersion() ) ) +- 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" ); +- } +- else ++ if ( !StringUtils.isEmpty( config.getTargetVersion() ) && !unsupportedLanguageLevels.contains( config.getTargetVersion() ) ) { - // Required, or it defaults to the target of your JDK (eg 1.5) ++ if ( supportsReleaseFlag() ) ++ { ++ System.err.println( "Use of maven-compiler-plugin's 'target' option is no longer recommended, consider using 'release' instead" ); ++ } ++ useDefaultTarget = false; 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" ); + args.add( config.getTargetVersion() ); ++ } - else - { -@@ -356,7 +364,13 @@ + +- if ( !suppressSource( config ) && StringUtils.isEmpty( config.getSourceVersion() ) ) ++ if ( !suppressSource( config ) && !StringUtils.isEmpty( config.getSourceVersion() ) && !unsupportedLanguageLevels.contains( config.getSourceVersion() ) ) { - // If omitted, later JDKs complain about a 1.1 target +- // If omitted, later JDKs complain about a 1.1 target ++ if ( supportsReleaseFlag() ) ++ { ++ System.err.println( "Use of maven-compiler-plugin's 'source' option is no longer recommended, consider using 'release' instead" ); ++ } ++ useDefaultSource = false; 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" ); ++ args.add( config.getSourceVersion() ); } - else if ( !suppressSource( config ) ) +- else if ( !suppressSource( config ) ) ++ ++ // when forking we can't tell javac's version so it's better ++ // to avoid replacing -source/target with --release ++ if ( !config.isFork() && useDefaultTarget && useDefaultSource && supportsReleaseFlag() ) { +- args.add( "-source" ); +- args.add( config.getSourceVersion() ); +- } ++ args.add( "--release" ); ++ args.add( DEFAULT_RELEASE_VERSION ); ++ } ++ else ++ { ++ if ( useDefaultTarget ) ++ { ++ System.err.println( "Use of target " + config.getTargetVersion() + " is no longer supported, switching to " + DEFAULT_TARGET_VERSION ); ++ args.add( "-target" ); ++ args.add( DEFAULT_TARGET_VERSION ); ++ } ++ if ( useDefaultSource ) ++ { ++ System.err.println( "Use of source " + config.getSourceVersion() + " is no longer supported, switching to " + DEFAULT_SOURCE_VERSION ); ++ args.add( "-source" ); ++ args.add( DEFAULT_SOURCE_VERSION ); ++ } ++ } + } + +