Skip to content

Commit 086201a

Browse files
Merge pull request #608 from ie3-institute/df/#607-java-21
Updated to Java 21 and Gradle 9.1.0
2 parents 5ae97e4 + 30ade2e commit 086201a

File tree

11 files changed

+32
-21
lines changed

11 files changed

+32
-21
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
uses: actions/setup-java@v4
3636
with:
3737
distribution: 'temurin'
38-
java-version: 17
38+
java-version: 21
3939

4040
- name: Setup Gradle
4141
uses: gradle/actions/setup-gradle@v4
@@ -71,8 +71,7 @@ jobs:
7171

7272
- name: Run Tests
7373
run: |
74-
./gradlew pmdMain pmdTest spotbugsMain spotbugsTest test jacocoTestReport jacocoTestCoverageVerification \
75-
reportScoverage checkScoverage
74+
./gradlew pmdMain pmdTest spotbugsMain spotbugsTest test jacocoTestReport jacocoTestCoverageVerification reportScoverage
7675
7776
- name: Build Scala-Docs
7877
run: ./gradlew scaladoc

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020

2121
### Changed
2222
- Bumped scala to 3.7.0 [#561](https://github.com/ie3-institute/PowerSystemUtils/pull/561)
23+
- Updated to Java 21 and Gradle 9.1.0 [#607](https://github.com/ie3-institute/PowerSystemUtils/issue/607)
2324

2425
### Fixed
2526
- Fixed missing scala sources in releases [#549](https://github.com/ie3-institute/PowerSystemUtils/issues/549)

build.gradle

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ plugins {
1515
}
1616

1717
ext {
18-
javaVersion = JavaVersion.VERSION_17
18+
javaVersion = JavaVersion.VERSION_21
1919
scalaVersion = '3'
2020
scalaBinaryVersion = '3.7.3'
2121
scriptsLocation = 'gradle' + File.separator + 'scripts' + File.separator //location of script plugins
@@ -45,6 +45,11 @@ repositories {
4545
mavenCentral()
4646
}
4747

48+
49+
pmd {
50+
toolVersion = '7.8.0' // PMD >7.x supports Java 21
51+
}
52+
4853
dependencies {
4954
// logging
5055
implementation 'org.slf4j:slf4j-api:2.0.17' // slf4j wrapper
@@ -74,6 +79,9 @@ dependencies {
7479

7580
// testing
7681
testImplementation 'org.spockframework:spock-core:2.3-groovy-4.0'
82+
testImplementation 'org.apache.groovy:groovy:4.0.26'
83+
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
84+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.10.0'
7785

7886
/* --- Scala libs --- */
7987
// CORE Scala //
@@ -89,3 +97,7 @@ dependencies {
8997
tasks.withType(JavaCompile) {
9098
options.encoding = 'UTF-8'
9199
}
100+
101+
tasks.test {
102+
useJUnitPlatform() // Gradle using JUnit Platform
103+
}

gradle/scripts/scoverage.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
scoverage {
66
scoverageVersion = "2.3.0"
7+
scoverageScalaVersion //= scalaBinaryVersion
78
coverageOutputHTML = false
89
coverageOutputXML = true
910
coverageOutputCobertura = false

gradle/scripts/spotless.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spotless {
1010
//sets a license header, removes unused imports and formats conforming to the google java format
1111
java {
1212
removeUnusedImports() // removes any unused imports
13-
googleJavaFormat('1.13.0')
13+
googleJavaFormat('1.28.0')
1414
licenseHeader ie3LicHead
1515
}
1616

@@ -21,7 +21,7 @@ spotless {
2121
// the Groovy Eclipse formatter extends the Java Eclipse formatter,
2222
// so it formats Java files by default (unless `excludeJava` is used).
2323
greclipse()
24-
indentWithSpaces 2
24+
leadingTabsToSpaces(2)
2525
}
2626

2727
groovyGradle {
@@ -40,13 +40,13 @@ spotless {
4040
format 'misc', {
4141
target '**/*.gradle', '**/.gitignore', 'configs/**'
4242
trimTrailingWhitespace()
43-
indentWithTabs()
43+
leadingSpacesToTabs()
4444
endWithNewline()
4545
}
4646

4747
format 'markdown', {
4848
target '**/*.md'
49-
indentWithSpaces(2)
49+
leadingTabsToSpaces(2)
5050
endWithNewline()
5151
}
5252
}

gradle/wrapper/gradle-wrapper.jar

1.71 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
#
4-
# Copyright © 2015-2021 the original authors.
4+
# Copyright © 2015 the original authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -114,7 +114,6 @@ case "$( uname )" in #(
114114
NONSTOP* ) nonstop=true ;;
115115
esac
116116

117-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118117

119118

120119
# Determine the Java command to use to start the JVM.
@@ -172,7 +171,6 @@ fi
172171
# For Cygwin or MSYS, switch paths to Windows format before running java
173172
if "$cygwin" || "$msys" ; then
174173
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
175-
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
176174

177175
JAVACMD=$( cygpath --unix "$JAVACMD" )
178176

@@ -212,8 +210,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
212210

213211
set -- \
214212
"-Dorg.gradle.appname=$APP_BASE_NAME" \
215-
-classpath "$CLASSPATH" \
216-
org.gradle.wrapper.GradleWrapperMain \
213+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217214
"$@"
218215

219216
# Stop when "xargs" is not available.

gradlew.bat

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,10 @@ goto fail
7070
:execute
7171
@rem Setup the command line
7272

73-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7473

7574

7675
@rem Execute Gradle
77-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
7877

7978
:end
8079
@rem End local scope for the variables with windows NT shell

src/main/java/edu/ie3/util/interval/Interval.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ abstract class Interval<T extends Comparable<? super T> & Serializable> implemen
2626
*
2727
* @param u The desired upper boundary.
2828
*/
29-
void setUpperBound(T u) {
29+
protected final void setUpperBound(T u) {
3030
if (u == null) throw new NullPointerException("Bound must not be null");
3131
if (lower == null) {
3232
lower = u;
@@ -44,7 +44,7 @@ void setUpperBound(T u) {
4444
*
4545
* @param l The desired lower boundary.
4646
*/
47-
void setLowerBound(T l) {
47+
protected final void setLowerBound(T l) {
4848
if (l == null) throw new NullPointerException("Bound must not be null");
4949
if (lower == null) {
5050
lower = l;
@@ -69,7 +69,7 @@ void setLowerBound(T l) {
6969
*
7070
* @return The lower boundary
7171
*/
72-
public T getLower() {
72+
protected final T getLower() {
7373
return lower;
7474
}
7575

@@ -78,7 +78,7 @@ public T getLower() {
7878
*
7979
* @return The upper boundary.
8080
*/
81-
public T getUpper() {
81+
protected final T getUpper() {
8282
return upper;
8383
}
8484

0 commit comments

Comments
 (0)