Skip to content

Commit

Permalink
58: Java 21 (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
skapral authored Oct 26, 2023
1 parent 0d3e69a commit d0cba06
Show file tree
Hide file tree
Showing 68 changed files with 1,562 additions and 301 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2.3.1
with:
java-version: '11'
java-version: '20'
distribution: adopt
gpg-private-key: ${{secrets.GPG_SIGN}}
gpg-passphrase: GPG_PASSPHRASE
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '11', '17' ]
java: [ '11', '17', '20' ]
name: Testing on Java ${{ matrix.Java }}
steps:
- uses: actions/checkout@v2
Expand Down
7 changes: 7 additions & 0 deletions build-tools/checkstyle/src/main/resources/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">

<module name="Checker">
<!-- WA for suppressing fail on module-info -->
<!-- taken from here https://github.com/checkstyle/eclipse-cs/issues/359 -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value=".*(Example|Test|module-info)(\$.*)?"/>
</module>
<!-- WA end -->
<module name="JavadocPackage"/>
<module name="FileTabCharacter"/>

Expand Down
130 changes: 127 additions & 3 deletions build-tools/parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
<packaging>pom</packaging>

<profiles>

<profile>
<id>multi-release-java9</id>
<activation>
<file>
<exists>src/main/java9</exists>
</file>
<jdk>[9, 99)</jdk>
</activation>
<build>
<plugins>
Expand All @@ -41,6 +41,116 @@
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
<execution>
<id>testcompile-java9</id>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<release>9</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/test/java9</compileSourceRoot>
</compileSourceRoots>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>multi-release-java16</id>
<activation>
<file>
<exists>src/main/java16</exists>
</file>
<jdk>[16, 99)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compile-java16</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>16</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java16</compileSourceRoot>
</compileSourceRoots>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
<execution>
<id>testcompile-java16</id>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<release>16</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/test/java16</compileSourceRoot>
</compileSourceRoots>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>multi-release-java17</id>
<activation>
<file>
<exists>src/main/java17</exists>
</file>
<jdk>[17, 99)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compile-java17</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>17</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java17</compileSourceRoot>
</compileSourceRoots>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand Down Expand Up @@ -91,7 +201,8 @@
</systemPropertyVariables>
<trimStackTrace>false</trimStackTrace>
<reportFormat>plain</reportFormat>
<statelessTestsetInfoReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporterUnicode"/>
<statelessTestsetInfoReporter
implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporterUnicode"/>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -162,6 +273,13 @@
<goals>
<goal>report</goal>
</goals>
<configuration>
<excludes>
<!-- Multi-Release structures coverage workaround -->
<!-- https://github.com/jacoco/jacoco/issues/407#issuecomment-442106170 -->
<exclude>META-INF/**</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -308,9 +426,15 @@
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<sourceDirectories>
<sourceDirectory>src/main/java</sourceDirectory>
<sourceDirectory>src/main/java9</sourceDirectory>
<sourceDirectory>src/main/java16</sourceDirectory>
<sourceDirectory>src/main/java17</sourceDirectory>
</sourceDirectories>
<testSourceDirectories>
<testSourceDirectory>src/test/java</testSourceDirectory>
<testSourceDirectory>src/test/java9</testSourceDirectory>
<testSourceDirectory>src/test/java16</testSourceDirectory>
<testSourceDirectory>src/test/java17</testSourceDirectory>
</testSourceDirectories>
<configLocation>checkstyle.xml</configLocation>
<logViolationsToConsole>true</logViolationsToConsole>
Expand Down Expand Up @@ -412,4 +536,4 @@
</build>
</profile>
</profiles>
</project>
</project>
3 changes: 0 additions & 3 deletions build-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@
<packaging>pom</packaging>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.release>8</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>


<dependencyManagement>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,46 +29,41 @@
import net.bytebuddy.dynamic.ClassFileLocator;

/**
* {@link CflsCompound} inference;
* Source for a combined {@link ClassFileLocator}, consisting of provided parts
*
* @author Kapralov Sergey
*/
class CflsCompoundInference implements ClassFileLocatorSource.Inference {
private final List<ClassFileLocatorSource> parts;
public class CflsCompound extends CflsInferred implements ClassFileLocatorSource {
private static class Inference implements ClassFileLocatorSource.Inference {
private final List<ClassFileLocatorSource> parts;

/**
* Ctor.
*
* @param parts Parts to combine
*/
public CflsCompoundInference(final List<ClassFileLocatorSource> parts) {
this.parts = parts;
}
/**
* Ctor.
*
* @param parts Parts to combine
*/
public Inference(final List<ClassFileLocatorSource> parts) {
this.parts = parts;
}

@Override
public final ClassFileLocatorSource classFileLocatorSource() {
return new CflsExplicit(
parts
.map(ClassFileLocatorSource::classFileLocator)
.transform(cflsl -> new ClassFileLocator.Compound(cflsl.toJavaList()))
);
@Override
public final ClassFileLocatorSource classFileLocatorSource() {
return new CflsExplicit(
parts
.map(ClassFileLocatorSource::classFileLocator)
.transform(cflsl -> new ClassFileLocator.Compound(cflsl.toJavaList()))
);
}
}
}

/**
* Source for a combined {@link ClassFileLocator}, consisting of provided parts
*
* @author Kapralov Sergey
*/
public class CflsCompound extends CflsInferred implements ClassFileLocatorSource {
/**
* Ctor.
*
* @param parts Parts to combine
*/
public CflsCompound(List<ClassFileLocatorSource> parts) {
super(
new CflsCompoundInference(
new Inference(
parts
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,44 +28,39 @@
import com.pragmaticobjects.oo.equivalence.codegen.cp.ClassPath;

/**
* {@link CflsFromClassPath} inference.
* {@link ClassFileLocatorSource} which looks for classes in certain {@link ClassPath}
*
* @author Kapralov Sergey
*/
class CflsFromClassPathInference implements ClassFileLocatorSource.Inference {
private final ClassPath classPath;
public class CflsFromClassPath extends CflsInferred implements ClassFileLocatorSource {
private static class Inference implements ClassFileLocatorSource.Inference {
private final ClassPath classPath;

/**
* Ctor.
*
* @param classPath {@link ClassPath} instance
*/
public CflsFromClassPathInference(final ClassPath classPath) {
this.classPath = classPath;
}
/**
* Ctor.
*
* @param classPath {@link ClassPath} instance
*/
public Inference(final ClassPath classPath) {
this.classPath = classPath;
}

@Override
public final ClassFileLocatorSource classFileLocatorSource() {
return new CflsFromPaths(
classPath.paths()
);
@Override
public final ClassFileLocatorSource classFileLocatorSource() {
return new CflsFromPaths(
classPath.paths()
);
}
}
}

/**
* {@link ClassFileLocatorSource} which looks for classes in certain {@link ClassPath}
*
* @author Kapralov Sergey
*/
public class CflsFromClassPath extends CflsInferred implements ClassFileLocatorSource {
/**
* Ctor.
*
* @param cp {@link ClassPath} instance
*/
public CflsFromClassPath(final ClassPath cp) {
super(
new CflsFromClassPathInference(
new Inference(
cp
)
);
Expand Down
Loading

0 comments on commit d0cba06

Please sign in to comment.