Skip to content

Commit bf2b411

Browse files
committed
fix jdk14 build, upgrade eclipse compiler version
Signed-off-by: olivier lamy <[email protected]>
1 parent 848e57a commit bf2b411

File tree

7 files changed

+32
-20
lines changed

7 files changed

+32
-20
lines changed

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
matrix:
2727
os: [ubuntu-latest,windows-latest, macOS-latest]
28-
java: [8, 11]
28+
java: [8, 11, 14]
2929
fail-fast: false
3030

3131
runs-on: ${{ matrix.os }}

plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void testCompilingSources()
135135
}
136136

137137
assertEquals( "Wrong number of compilation errors (" + numCompilerErrors + "/" + expectedErrors //
138-
+ ") : " + errors, expectedErrors, numCompilerErrors );
138+
+ ") : " + displayLines( errors ), expectedErrors, numCompilerErrors );
139139
}
140140

141141
int expectedWarnings = expectedWarnings();
@@ -157,13 +157,25 @@ public void testCompilingSources()
157157
warnings.add( error.getMessage() );
158158
}
159159

160-
assertEquals( "Wrong number (" + numCompilerWarnings + "/" + expectedWarnings + ") of compilation warnings: " + warnings, //
161-
expectedWarnings, numCompilerWarnings );
160+
assertEquals( "Wrong number (" + numCompilerWarnings + "/"
161+
+ expectedWarnings + ") of compilation warnings: " + displayLines( warnings ), //
162+
expectedWarnings, numCompilerWarnings);
162163
}
163164

164165
assertEquals( new TreeSet<>( normalizePaths( expectedOutputFiles() ) ), files );
165166
}
166167

168+
protected String displayLines( List<String> warnings)
169+
{
170+
// with java8 could be as simple as String.join(System.lineSeparator(), warnings)
171+
StringBuilder sb = new StringBuilder( System.lineSeparator() );
172+
for ( String warning : warnings )
173+
{
174+
sb.append( '-' ).append( warning ).append( System.lineSeparator() );
175+
}
176+
return sb.toString();
177+
}
178+
167179
private List<CompilerConfiguration> getCompilerConfigurations()
168180
throws Exception
169181
{

plexus-compilers/plexus-compiler-eclipse/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<dependency>
2222
<groupId>org.eclipse.jdt</groupId>
2323
<artifactId>ecj</artifactId>
24-
<version>3.15.1</version>
24+
<version>3.22.0</version>
2525
</dependency>
2626
</dependencies>
2727

plexus-compilers/plexus-compiler-j2objc/src/main/java/org/codehaus/plexus/compiler/j2objc/J2ObjCCompiler.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,7 @@ private List<CompilerMessage> compileOutOfProcess( File workingDirectory, File t
293293

294294
messages = parseCompilerOutput( new BufferedReader( new StringReader( stringWriter.toString() ) ) );
295295
}
296-
catch ( CommandLineException e )
297-
{
298-
throw new CompilerException( "Error while executing the external compiler.", e );
299-
}
300-
catch ( IOException e )
296+
catch ( CommandLineException | IOException e )
301297
{
302298
throw new CompilerException( "Error while executing the external compiler.", e );
303299
}

plexus-compilers/plexus-compiler-j2objc/src/test/java/org/codehaus/plexus/compiler/j2objc/J2ObjCCompilerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* SOFTWARE.
2525
*/
2626

27-
import junit.framework.Assert;
27+
import org.junit.Assert;
2828
import junit.framework.TestCase;
2929
import org.codehaus.plexus.compiler.CompilerConfiguration;
3030
import org.codehaus.plexus.compiler.CompilerException;
@@ -47,7 +47,7 @@ public void testJ2ObjCCompiler()
4747
throws IOException
4848
{
4949
J2ObjCCompiler comp = new J2ObjCCompiler();
50-
Map<String, String> customCompilerArguments = new HashMap<String, String>();
50+
Map<String, String> customCompilerArguments = new HashMap<>();
5151
customCompilerArguments.put( "-use-arc", null );
5252
customCompilerArguments.put( "-sourcepath", "src/test/resources" );
5353
CompilerConfiguration cc = new CompilerConfiguration();

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected String getRoleHint()
6161
protected int expectedErrors()
6262
{
6363
String javaVersion = getJavaVersion();
64-
if (javaVersion.contains("9.0")||javaVersion.contains("11")){
64+
if (Arrays.asList("9.0","11", "14").contains( javaVersion )){
6565
// lots of new warnings about obsoletions for future releases
6666
return 5;
6767
}
@@ -80,7 +80,7 @@ protected int expectedErrors()
8080
protected int expectedWarnings()
8181
{
8282
String javaVersion = getJavaVersion();
83-
if (javaVersion.contains("11")){
83+
if (Arrays.asList("11", "14").contains( javaVersion )){
8484
return 1;
8585
}
8686
if (javaVersion.contains("9.0")){
@@ -122,13 +122,16 @@ public String getTargetVersion()
122122
public String getSourceVersion()
123123
{
124124
String javaVersion = getJavaVersion();
125-
if (javaVersion.contains("9.0")){
125+
if (javaVersion.contains("9.0"))
126+
{
126127
return "1.7";
127128
}
128-
if (javaVersion.contains("11")){
129+
if (javaVersion.contains("11"))
130+
{
129131
return "11";
130132
}
131-
if (javaVersion.contains("14")){
133+
if (javaVersion.contains("14"))
134+
{
132135
return "14";
133136
}
134137
return super.getTargetVersion();
@@ -137,7 +140,8 @@ public String getSourceVersion()
137140
protected Collection<String> expectedOutputFiles()
138141
{
139142
String javaVersion = getJavaVersion();
140-
if (javaVersion.contains("9.0")||javaVersion.contains("11")){
143+
if (Arrays.asList( "9.0", "11", "14").contains( javaVersion ))
144+
{
141145
return Arrays.asList( new String[]{ "org/codehaus/foo/Deprecation.class", "org/codehaus/foo/ExternalDeps.class",
142146
"org/codehaus/foo/Person.class"} );
143147
}

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<plugin>
8787
<groupId>org.apache.maven.plugins</groupId>
8888
<artifactId>maven-surefire-plugin</artifactId>
89-
<version>2.22.1</version>
89+
<version>3.0.0-M5</version>
9090
<configuration>
9191
<redirectTestOutputToFile>${redirectTestOutputToFile}</redirectTestOutputToFile>
9292
</configuration>
@@ -160,7 +160,7 @@
160160
<plugin>
161161
<groupId>org.apache.maven.plugins</groupId>
162162
<artifactId>maven-enforcer-plugin</artifactId>
163-
<version>3.0.0-M2</version>
163+
<version>3.0.0-M3</version>
164164
<executions>
165165
<execution>
166166
<id>enforce-java</id>

0 commit comments

Comments
 (0)