Skip to content

Commit a5775b2

Browse files
committed
Require Java 11 for plexus-compiler-eclipse an javac-errorprone and aspectj
1 parent 0f53ad7 commit a5775b2

File tree

7 files changed

+84
-125
lines changed

7 files changed

+84
-125
lines changed

plexus-compiler-its/pom.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
<packaging>pom</packaging>
1313

1414
<name>Plexus Compiler It Tests</name>
15-
15+
1616
<properties>
1717
<junit.version>4.13.2</junit.version>
18+
<maven.compiler.source>11</maven.compiler.source>
19+
<maven.compiler.target>11</maven.compiler.target>
1820
<maven.deploy.skip>true</maven.deploy.skip>
1921
</properties>
2022

plexus-compiler-its/src/main/it/error-prone-compiler/pom.xml

Lines changed: 14 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,23 @@
5151
<artifactId>maven-compiler-plugin</artifactId>
5252
<version>@maven.compiler.version@</version>
5353
<configuration>
54-
<target>8</target>
55-
<source>8</source>
54+
<target>11</target>
55+
<source>11</source>
56+
<encoding>UTF-8</encoding>
57+
<fork>true</fork>
5658
<compilerArgs>
5759
<arg>-XDcompilePolicy=simple</arg>
5860
<arg>-Xplugin:ErrorProne</arg>
61+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
62+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
63+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
64+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
65+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
66+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
67+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
68+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
69+
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
70+
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
5971
</compilerArgs>
6072
<annotationProcessorPaths>
6173
<path>
@@ -85,67 +97,4 @@
8597
</plugin>
8698
</plugins>
8799
</build>
88-
<profiles>
89-
<profile>
90-
<id>jdk8</id>
91-
<activation>
92-
<jdk>1.8</jdk>
93-
</activation>
94-
<build>
95-
<plugins>
96-
<plugin>
97-
<groupId>org.apache.maven.plugins</groupId>
98-
<artifactId>maven-compiler-plugin</artifactId>
99-
<configuration>
100-
<fork>true</fork>
101-
<compilerArgs combine.children="append">
102-
<arg>-J-Xbootclasspath/p:${settings.localRepository}/com/google/errorprone/javac/${javac.version}/javac-${javac.version}.jar</arg>
103-
</compilerArgs>
104-
</configuration>
105-
</plugin>
106-
</plugins>
107-
</build>
108-
</profile>
109-
<profile>
110-
<id>jdk16</id>
111-
<activation>
112-
<jdk>[16,)</jdk>
113-
</activation>
114-
<build>
115-
<plugins>
116-
<plugin>
117-
<groupId>org.apache.maven.plugins</groupId>
118-
<artifactId>maven-compiler-plugin</artifactId>
119-
<configuration>
120-
<source>8</source>
121-
<target>8</target>
122-
<encoding>UTF-8</encoding>
123-
<fork>true</fork>
124-
<compilerArgs>
125-
<arg>-XDcompilePolicy=simple</arg>
126-
<arg>-Xplugin:ErrorProne</arg>
127-
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
128-
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
129-
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
130-
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
131-
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
132-
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
133-
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
134-
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
135-
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
136-
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
137-
</compilerArgs>
138-
<annotationProcessorPaths>
139-
<path>
140-
<groupId>com.google.errorprone</groupId>
141-
<artifactId>error_prone_core</artifactId>
142-
<version>@errorprone.version@</version>
143-
</path>
144-
</annotationProcessorPaths>
145-
</configuration>
146-
</plugin>
147-
</plugins>
148-
</build>
149-
</profile>
150-
</profiles>
151100
</project>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
<name>Plexus AspectJ Compiler</name>
1414
<description>AspectJ Compiler support for Plexus Compiler component.</description>
1515

16+
<properties>
17+
<maven.compiler.source>11</maven.compiler.source>
18+
<maven.compiler.target>11</maven.compiler.target>
19+
</properties>
20+
1621
<dependencies>
1722
<dependency>
1823
<groupId>org.codehaus.plexus</groupId>

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

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
<name>Plexus Eclipse Compiler</name>
1414
<description>Eclipse Compiler support for Plexus Compiler component.</description>
1515

16+
<properties>
17+
<maven.compiler.source>11</maven.compiler.source>
18+
<maven.compiler.target>11</maven.compiler.target>
19+
</properties>
20+
1621
<dependencies>
1722
<dependency>
1823
<groupId>org.codehaus.plexus</groupId>
@@ -25,7 +30,7 @@
2530
<dependency>
2631
<groupId>org.eclipse.jdt</groupId>
2732
<artifactId>ecj</artifactId>
28-
<version>3.32.0</version>
33+
<version>3.33.0</version>
2934
</dependency>
3035
<dependency>
3136
<groupId>org.codehaus.plexus</groupId>
@@ -53,26 +58,4 @@
5358
</dependency>
5459
</dependencies>
5560

56-
<profiles>
57-
<profile>
58-
<id>1.7</id>
59-
<activation>
60-
<jdk>1.7</jdk>
61-
</activation>
62-
<build>
63-
<pluginManagement>
64-
<plugins>
65-
<plugin>
66-
<groupId>org.apache.maven.plugins</groupId>
67-
<artifactId>maven-surefire-plugin</artifactId>
68-
<configuration>
69-
<skipExec>true</skipExec>
70-
</configuration>
71-
</plugin>
72-
</plugins>
73-
</pluginManagement>
74-
</build>
75-
</profile>
76-
77-
</profiles>
7861
</project>

plexus-compilers/plexus-compiler-javac-errorprone/pom.xml

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@
1313
<name>Plexus Javac+error-prone Component</name>
1414
<description>Javac Compiler support for Plexus Compiler component,
1515
with error-prone static analysis checks enabled.
16-
See http://errorprone.info
16+
See https://errorprone.info
1717
</description>
1818

19+
<properties>
20+
<maven.compiler.source>11</maven.compiler.source>
21+
<maven.compiler.target>11</maven.compiler.target>
22+
</properties>
23+
1924
<dependencies>
2025
<dependency>
2126
<groupId>org.codehaus.plexus</groupId>
@@ -37,30 +42,26 @@
3742
</dependency>
3843
</dependencies>
3944

40-
<profiles>
41-
<profile>
42-
<id>16+</id>
43-
<activation>
44-
<jdk>[16,)</jdk>
45-
</activation>
46-
<build>
47-
<plugins>
48-
<plugin>
49-
<groupId>org.apache.maven.plugins</groupId>
50-
<artifactId>maven-surefire-plugin</artifactId>
51-
<configuration>
52-
<skip>true</skip>
53-
<!-- <argLine>-->
54-
<!-- &#45;&#45;add-modules java.se-->
55-
<!-- &#45;&#45;add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED-->
56-
<!-- &#45;&#45;add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED-->
57-
<!-- &#45;&#45;add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED-->
58-
<!-- </argLine>-->
59-
</configuration>
60-
</plugin>
61-
</plugins>
62-
</build>
63-
</profile>
64-
</profiles>
65-
45+
<build>
46+
<plugins>
47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-surefire-plugin</artifactId>
50+
<configuration>
51+
<argLine>
52+
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
53+
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
54+
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
55+
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
56+
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
57+
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
58+
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
59+
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
60+
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
61+
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
62+
</argLine>
63+
</configuration>
64+
</plugin>
65+
</plugins>
66+
</build>
6667
</project>

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ public class JavacErrorProneCompilerTest
99
extends AbstractCompilerTest
1010
{
1111

12-
protected boolean java8() {
13-
return System.getProperty( "java.version" ).startsWith( "1.8" );
14-
}
15-
1612
@Override
1713
protected String getRoleHint()
1814
{
@@ -22,11 +18,13 @@ protected String getRoleHint()
2218
@Override
2319
protected int expectedWarnings()
2420
{
25-
if ( java8() ) {
21+
String javaVersion = getJavaVersion();
22+
if (javaVersion.startsWith("1.8")) {
2623
return 1;
27-
}
28-
else
29-
{
24+
} else {
25+
if (javaVersion.contains("18") || javaVersion.contains("19") || javaVersion.contains("20")) {
26+
return 5;
27+
}
3028
return 2;
3129
}
3230
}

pom.xml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<redirectTestOutputToFile>true</redirectTestOutputToFile>
5050
<project.build.outputTimestamp>2022-12-17T17:23:49Z</project.build.outputTimestamp>
5151
<jupiter.version>5.9.2</jupiter.version>
52-
<aspectj.version>1.9.9.1</aspectj.version>
52+
<aspectj.version>1.9.19</aspectj.version>
5353
<maven.version>3.2.5</maven.version>
5454
<errorprone.version>2.18.0</errorprone.version>
5555
<trimStackTrace>false</trimStackTrace>
@@ -197,6 +197,13 @@
197197
<groupId>org.apache.maven.plugins</groupId>
198198
<artifactId>maven-enforcer-plugin</artifactId>
199199
<version>3.3.0</version>
200+
<dependencies>
201+
<dependency>
202+
<groupId>org.codehaus.mojo</groupId>
203+
<artifactId>extra-enforcer-rules</artifactId>
204+
<version>1.6.1</version>
205+
</dependency>
206+
</dependencies>
200207
<executions>
201208
<execution>
202209
<id>enforce-java</id>
@@ -212,6 +219,20 @@
212219
</rules>
213220
</configuration>
214221
</execution>
222+
<execution>
223+
<id>enforce-bytecode-version</id>
224+
<goals>
225+
<goal>enforce</goal>
226+
</goals>
227+
<configuration>
228+
<rules>
229+
<enforceBytecodeVersion>
230+
<maxJdkVersion>${maven.compiler.target}</maxJdkVersion>
231+
</enforceBytecodeVersion>
232+
</rules>
233+
<fail>true</fail>
234+
</configuration>
235+
</execution>
215236
</executions>
216237
</plugin>
217238

0 commit comments

Comments
 (0)