diff --git 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 index 5aa4e0d7..bbad6260 100644 --- 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 @@ -443,6 +443,11 @@ else if ( !suppressSource( config ) ) args.add( value ); } + if ( !config.isFork() ) + { + args.add( "-XDuseUnsharedTable=true" ); + } + return args.toArray( new String[0] ); } diff --git a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java index dcbfc7ca..cfccb28a 100644 --- a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java +++ b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java @@ -326,6 +326,9 @@ public void testJRuntimeArguments() expectedArguments.add( "-source" ); expectedArguments.add( "1.3" ); + // unshared table + expectedArguments.add( "-XDuseUnsharedTable=true" ); + // customCompilerArguments Map customCompilerArguments = new LinkedHashMap<>(); customCompilerArguments.put( "-J-Duser.language=en_us", null ); @@ -367,6 +370,9 @@ public void testModulePathAnnotations() throws Exception expectedArguments.add( "--release" ); expectedArguments.add( "9" ); + // unshared table + expectedArguments.add( "-XDuseUnsharedTable=true" ); + internalTest( compilerConfiguration, expectedArguments, source); } @@ -395,6 +401,9 @@ public void testModulePath() throws Exception expectedArguments.add( "-source" ); expectedArguments.add( "1.3" ); + // unshared table + expectedArguments.add( "-XDuseUnsharedTable=true" ); + internalTest( compilerConfiguration, expectedArguments ); } @@ -421,6 +430,9 @@ public void testModuleVersion() expectedArguments.add( "--module-version" ); expectedArguments.add( "1.2.0-SNAPSHOT" ); + // unshared table + expectedArguments.add( "-XDuseUnsharedTable=true" ); + internalTest( compilerConfiguration, expectedArguments ); } @@ -440,7 +452,10 @@ public void testReleaseVersion() compilerConfiguration.setReleaseVersion( "6" ); expectedArguments.add( "--release" ); expectedArguments.add( "6" ); - + + // unshared table + expectedArguments.add( "-XDuseUnsharedTable=true" ); + internalTest( compilerConfiguration, expectedArguments ); } @@ -465,7 +480,10 @@ public void testFailOnWarning() expectedArguments.add( "1.1" ); expectedArguments.add( "-source" ); expectedArguments.add( "1.3" ); - + + // unshared table + expectedArguments.add( "-XDuseUnsharedTable=true" ); + internalTest( compilerConfiguration, expectedArguments ); } @@ -494,7 +512,10 @@ public void testMultipleAddExports() compilerConfiguration.addCompilerCustomArgument( "--add-exports", "FROM-MOD/package2=OTHER-MOD" ); expectedArguments.add( "--add-exports" ); expectedArguments.add( "FROM-MOD/package2=OTHER-MOD" ); - + + // unshared table + expectedArguments.add( "-XDuseUnsharedTable=true" ); + internalTest( compilerConfiguration, expectedArguments ); } @@ -639,5 +660,7 @@ private void populateArguments( CompilerConfiguration compilerConfiguration, Lis expectedArguments.add( "foo" ); expectedArguments.add( "bar" ); + + expectedArguments.add( "-XDuseUnsharedTable=true" ); } }