Skip to content

Commit 8ce4cf9

Browse files
Allow to override useUnsharedTable compiler argument
fix #371
1 parent e9ae6e7 commit 8ce4cf9

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ public static String[] buildCompilerArguments(
433433
args.add(value);
434434
}
435435

436-
if (!config.isFork()) {
436+
if (!config.isFork() && !args.contains("-XDuseUnsharedTable=false")) {
437437
args.add("-XDuseUnsharedTable=true");
438438
}
439439

plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java

+23
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,29 @@ public void testMultipleAddExports() {
497497
internalTest(compilerConfiguration, expectedArguments, "1.8");
498498
}
499499

500+
@Test
501+
public void testWithGivenUnsharedTable() {
502+
List<String> expectedArguments = new ArrayList<>();
503+
504+
CompilerConfiguration compilerConfiguration = new CompilerConfiguration();
505+
506+
// outputLocation
507+
compilerConfiguration.setOutputLocation("/output");
508+
expectedArguments.add("-d");
509+
expectedArguments.add(new File("/output").getAbsolutePath());
510+
511+
// releaseVersion
512+
compilerConfiguration.setReleaseVersion("6");
513+
expectedArguments.add("--release");
514+
expectedArguments.add("6");
515+
516+
// unshared table
517+
compilerConfiguration.addCompilerCustomArgument("-XDuseUnsharedTable=false", null);
518+
expectedArguments.add("-XDuseUnsharedTable=false");
519+
520+
internalTest(compilerConfiguration, expectedArguments, "11.0.1");
521+
}
522+
500523
/* This test fails on Java 1.4. The multiple parameters of the same source file cause an error, as it is interpreted as a DuplicateClass
501524
* Setting the size of the array to 3 is fine, but does not exactly test what it is supposed to - disabling the test for now
502525
public void testCommandLineTooLongWhenForking()

0 commit comments

Comments
 (0)