Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require Java 11 for plexus-compiler-eclipse an javac-errorprone and aspectj compilers #279

Merged
merged 1 commit into from
Apr 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plexus-compiler-its/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
<packaging>pom</packaging>

<name>Plexus Compiler It Tests</name>

<properties>
<junit.version>4.13.2</junit.version>
<maven.compiler.source>11</maven.compiler.source>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not using release?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

netbeans would show this as warning, assuming it can figure out the compiler plugin version :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to improve opening pr

<maven.compiler.target>11</maven.compiler.target>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

Expand Down
79 changes: 14 additions & 65 deletions plexus-compiler-its/src/main/it/error-prone-compiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,23 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>@maven.compiler.version@</version>
<configuration>
<target>8</target>
<source>8</source>
<target>11</target>
<source>11</source>
<encoding>UTF-8</encoding>
<fork>true</fork>
<compilerArgs>
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
Expand Down Expand Up @@ -85,67 +97,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>jdk8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<fork>true</fork>
<compilerArgs combine.children="append">
<arg>-J-Xbootclasspath/p:${settings.localRepository}/com/google/errorprone/javac/${javac.version}/javac-${javac.version}.jar</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>jdk16</id>
<activation>
<jdk>[16,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
<encoding>UTF-8</encoding>
<fork>true</fork>
<compilerArgs>
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>@errorprone.version@</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
5 changes: 5 additions & 0 deletions plexus-compilers/plexus-compiler-aspectj/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
<name>Plexus AspectJ Compiler</name>
<description>AspectJ Compiler support for Plexus Compiler component.</description>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Expand Down
29 changes: 6 additions & 23 deletions plexus-compilers/plexus-compiler-eclipse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
<name>Plexus Eclipse Compiler</name>
<description>Eclipse Compiler support for Plexus Compiler component.</description>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Expand All @@ -25,7 +30,7 @@
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>ecj</artifactId>
<version>3.32.0</version>
<version>3.33.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Expand Down Expand Up @@ -53,26 +58,4 @@
</dependency>
</dependencies>

<profiles>
<profile>
<id>1.7</id>
<activation>
<jdk>1.7</jdk>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipExec>true</skipExec>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>

</profiles>
</project>
55 changes: 28 additions & 27 deletions plexus-compilers/plexus-compiler-javac-errorprone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
<name>Plexus Javac+error-prone Component</name>
<description>Javac Compiler support for Plexus Compiler component,
with error-prone static analysis checks enabled.
See http://errorprone.info
See https://errorprone.info
</description>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Expand All @@ -37,30 +42,26 @@
</dependency>
</dependencies>

<profiles>
<profile>
<id>16+</id>
<activation>
<jdk>[16,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
<!-- <argLine>-->
<!-- &#45;&#45;add-modules java.se-->
<!-- &#45;&#45;add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED-->
<!-- &#45;&#45;add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED-->
<!-- &#45;&#45;add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED-->
<!-- </argLine>-->
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ public class JavacErrorProneCompilerTest
extends AbstractCompilerTest
{

protected boolean java8() {
return System.getProperty( "java.version" ).startsWith( "1.8" );
}

@Override
protected String getRoleHint()
{
Expand All @@ -22,11 +18,13 @@ protected String getRoleHint()
@Override
protected int expectedWarnings()
{
if ( java8() ) {
String javaVersion = getJavaVersion();
if (javaVersion.startsWith("1.8")) {
return 1;
}
else
{
} else {
if (javaVersion.contains("18") || javaVersion.contains("19") || javaVersion.contains("20")) {
return 5;
}
return 2;
}
}
Expand Down
23 changes: 22 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<project.build.outputTimestamp>2022-12-17T17:23:49Z</project.build.outputTimestamp>
<jupiter.version>5.9.2</jupiter.version>
<aspectj.version>1.9.9.1</aspectj.version>
<aspectj.version>1.9.19</aspectj.version>
<maven.version>3.2.5</maven.version>
<errorprone.version>2.18.0</errorprone.version>
<trimStackTrace>false</trimStackTrace>
Expand Down Expand Up @@ -197,6 +197,13 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.3.0</version>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>enforce-java</id>
Expand All @@ -212,6 +219,20 @@
</rules>
</configuration>
</execution>
<execution>
<id>enforce-bytecode-version</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<enforceBytecodeVersion>
<maxJdkVersion>${maven.compiler.target}</maxJdkVersion>
</enforceBytecodeVersion>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>

Expand Down