Skip to content

Commit

Permalink
Merge pull request #361 from vincent4vx/chore-java-17
Browse files Browse the repository at this point in the history
chore: update dependencies for java 17 (close #359)
  • Loading branch information
vincent4vx authored Jul 27, 2024
2 parents bee02a4 + cdf4f46 commit 3a6525b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 79 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ jobs:
FLUSH PRIVILEGES;
EOF
- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '8'
java-version: '17'
distribution: 'adopt'

- name: Build with Maven
run: mvn --batch-mode --update-snapshots -P '!checkerframework,!checkerframework-jdk8,!checkerframework-jdk9orlater' verify
run: mvn --batch-mode --update-snapshots -P '!checkerframework' verify

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand All @@ -54,7 +54,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java_version: [8, 11, 14, 17]
java_version: [17, 21]
fail-fast: false

steps:
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
distribution: 'adopt'

- name: Run tests
run: mvn --batch-mode -Djacoco.skip=true -P '!checkerframework,!checkerframework-jdk8,!checkerframework-jdk9orlater' test
run: mvn --batch-mode -Djacoco.skip=true -P '!checkerframework' test

static_analysis:
runs-on: ubuntu-latest
Expand All @@ -102,10 +102,10 @@ jobs:
with:
timezoneLinux: "Europe/Paris"

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: 11
java-version: 17
distribution: 'adopt'

- name: Run tests
Expand Down
86 changes: 16 additions & 70 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@
<modelVersion>4.0.0</modelVersion>

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

<errorProneJavac>${com.google.errorprone:javac:jar}</errorProneJavac>
<!-- TODO: Performance issue for > 4.42. See https://github.com/typetools/checker-framework/issues/6623 -->
<checkerframework.version>3.42.0</checkerframework.version>
</properties>

<groupId>fr.quatrevieux.araknemu</groupId>
<artifactId>araknemu</artifactId>
<version>0.12-alpha</version>
<version>0.13-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
Expand All @@ -55,7 +54,7 @@
<dependency>
<groupId>args4j</groupId>
<artifactId>args4j</artifactId>
<version>2.33</version>
<version>2.37</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
Expand Down Expand Up @@ -105,7 +104,7 @@
<dependency>
<groupId>io.github.cdimascio</groupId>
<artifactId>dotenv-java</artifactId>
<version>2.3.2</version>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
Expand Down Expand Up @@ -139,7 +138,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.11.0</version>
<version>5.12.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -276,7 +275,7 @@
<profile>
<id>checkerframework</id>
<activation>
<jdk>[1.8,)</jdk>
<jdk>[17,)</jdk>
</activation>
<build>
<plugins>
Expand All @@ -297,69 +296,9 @@
<annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
<annotationProcessor>org.checkerframework.checker.index.IndexChecker</annotationProcessor>
</annotationProcessors>
<compilerArgs>
<compilerArgs combine.children="append">
<!-- <arg>-Awarns</arg>-->
<arg>-AskipDefs=(Test|BaseCase|DataSet|TestCase|PacketWithParser|OtherPacket|DummyGenerator|Accessors)$</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker</artifactId>
<version>${checkerframework.version}</version>
</dependency>
</dependencies>
</profile>

<profile>
<id>checkerframework-jdk8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<!-- using github.com/google/error-prone-javac is required when running on JDK 8 -->
<properties>
<javac.version>9+181-r4173-1</javac.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>javac</artifactId>
<version>9+181-r4173-1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<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>checkerframework-jdk9orlater</id>
<activation>
<jdk>[9,)</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--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
Expand All @@ -374,6 +313,13 @@
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker</artifactId>
<version>${checkerframework.version}</version>
</dependency>
</dependencies>
<properties>
<!-- Needed for animal-sniffer-maven-plugin version 1.19 (version 1.20 is fixed). -->
<animal.sniffer.skip>true</animal.sniffer.skip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ public static <F extends FighterData> CastTargets<F> resolveFromEffect(F caster,
/**
* Perform resolution from effect target and effect area
*/
@SuppressWarnings("cast.unsafe") // @Nullable cast cause a compiler crash on java 8
@SuppressWarnings("unchecked")
private static <F extends FighterData> CastTargets<F> resolveFromEffectArea(F caster, BattlefieldCell from, BattlefieldCell target, SpellEffect effect) {
// Do not use stream API to optimise memory allocations
final CastTargets.Builder<F> builder = new CastTargets.Builder<>();

for (BattlefieldCell cell : effect.area().resolve(target, from)) {
final @Nullable F resolvedTarget = (/*@Nullable*/ F) cell.fighter();
final @Nullable F resolvedTarget = (@Nullable F) cell.fighter();

if (resolvedTarget == null || !effect.target().test(caster, resolvedTarget)) {
continue;
Expand Down

0 comments on commit 3a6525b

Please sign in to comment.