Skip to content

Commit 922fb79

Browse files
authored
Merge pull request #480 from ie3-institute/sp/#479-java-17
Switch to java 17
2 parents d6e16dc + ef9e7d7 commit 922fb79

File tree

16 files changed

+647
-626
lines changed

16 files changed

+647
-626
lines changed

Jenkinsfile

Lines changed: 596 additions & 562 deletions
Large diffs are not rendered by default.

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ plugins {
1515

1616
ext {
1717
//version (changing these should be considered thoroughly!)
18-
javaVersion = JavaVersion.VERSION_1_8
18+
javaVersion = JavaVersion.VERSION_17
1919
tscfgVersion = '0.9.9'
2020
testcontainersVersion = '1.16.2'
2121

@@ -74,7 +74,7 @@ dependencies {
7474

7575
// testing
7676
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
77-
testImplementation 'org.spockframework:spock-core:2.0-groovy-3.0'
77+
testImplementation 'org.spockframework:spock-core:2.1-M2-groovy-3.0'
7878
testImplementation 'org.objenesis:objenesis:3.2' // Mock creation with constructor parameters
7979

8080
// testcontainers (docker framework for testing)

gradle.properties

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@
88

99
# Specifies the JVM arguments used for the daemon process.
1010
# The setting is particularly useful for tweaking memory settings.
11-
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m
11+
12+
13+
# Workaround to make spotless work with java 17 -
14+
# see https://github.com/diffplug/spotless/tree/main/plugin-gradle#google-java-format and
15+
# https://github.com/ie3-institute/PowerSystemDataModel/issues/481 for details
16+
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m \
17+
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
18+
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
19+
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
20+
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
21+
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
1222

1323
# When configured, Gradle will run in incubating parallel mode.
1424
# This option should only be used with decoupled projects. More details, visit

gradle/scripts/jacoco.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// general configuration
55
jacoco {
6-
toolVersion = "0.8.4"
6+
toolVersion = "0.8.7"
77
reportsDir = file("$buildDir/reports/jacoco")
88
}
99

gradle/scripts/spotless.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ 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()
13+
googleJavaFormat('1.13.0')
1414
licenseHeader ie3LicHead
1515
}
1616

1717

1818
/* cf. https://github.com/diffplug/spotless/tree/master/plugin-gradle */
1919
groovy {
20-
licenseHeader ie3LicHead
21-
excludeJava() // excludes all Java sources within the Groovy source dirs from formatting
22-
20+
target '**.groovy', 'Jenkinsfile'
21+
licenseHeader "#!groovy\n\n" + ie3LicHead, "////////////////////////////////"
2322
// the Groovy Eclipse formatter extends the Java Eclipse formatter,
2423
// so it formats Java files by default (unless `excludeJava` is used).
2524
greclipse()
25+
indentWithSpaces 2
2626
}
2727

2828
groovyGradle {

src/main/java/edu/ie3/datamodel/io/connectors/CsvFileConnector.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,7 @@ public Optional<IndividualTimeSeriesMetaInformation> getIndividualTimeSeriesMeta
235235
*/
236236
private Map<UUID, CsvIndividualTimeSeriesMetaInformation>
237237
buildIndividualTimeSeriesMetaInformation() {
238-
return getIndividualTimeSeriesFilePaths()
239-
.parallelStream()
238+
return getIndividualTimeSeriesFilePaths().parallelStream()
240239
.map(
241240
filePath -> {
242241
/* Extract meta information from file path and enhance it with the file path itself */
@@ -260,8 +259,7 @@ public Optional<IndividualTimeSeriesMetaInformation> getIndividualTimeSeriesMeta
260259
*/
261260
public Map<ColumnScheme, Set<CsvIndividualTimeSeriesMetaInformation>>
262261
getCsvIndividualTimeSeriesMetaInformation(ColumnScheme... columnSchemes) {
263-
return getIndividualTimeSeriesFilePaths()
264-
.parallelStream()
262+
return getIndividualTimeSeriesFilePaths().parallelStream()
265263
.map(
266264
pathString -> {
267265
String filePathWithoutEnding = removeFileEnding(pathString);

src/main/java/edu/ie3/datamodel/io/processor/timeseries/TimeSeriesProcessor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ private SortedMap<String, FieldSourceToMethod> buildFieldToSource(
106106
Class<T> timeSeriesClass, Class<E> entryClass, Class<V> valueClass) {
107107
/* Get the mapping from field name to getter method ignoring the getter for returning all entries */
108108
Map<String, FieldSourceToMethod> timeSeriesMapping =
109-
mapFieldNameToGetter(timeSeriesClass, Arrays.asList("entries", "uuid", "type")).entrySet()
109+
mapFieldNameToGetter(timeSeriesClass, Arrays.asList("entries", "uuid", "type"))
110+
.entrySet()
110111
.stream()
111112
.collect(
112113
Collectors.toMap(
@@ -136,7 +137,8 @@ private SortedMap<String, FieldSourceToMethod> buildFieldToSource(
136137
mapFieldNameToGetter(
137138
valueClass,
138139
Arrays.asList("solarIrradiance", "temperature", "wind"))
139-
.entrySet().stream()
140+
.entrySet()
141+
.stream()
140142
.map(
141143
entry ->
142144
new AbstractMap.SimpleEntry<>(

src/main/java/edu/ie3/datamodel/io/source/csv/CsvDataSource.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,10 +393,7 @@ protected Stream<Map<String, String>> buildStreamWithFieldsToAttributesMap(
393393
Collection<Map<String, String>> allRows = csvRowFieldValueMapping(reader, headline);
394394

395395
return distinctRowsWithLog(
396-
allRows,
397-
fieldToValues -> fieldToValues.get("uuid"),
398-
entityClass.getSimpleName(),
399-
"UUID")
396+
allRows, fieldToValues -> fieldToValues.get("uuid"), entityClass.getSimpleName(), "UUID")
400397
.parallelStream();
401398
} catch (IOException e) {
402399
log.warn(
@@ -455,8 +452,7 @@ protected Set<Map<String, String>> distinctRowsWithLog(
455452

456453
/* Check for rows with the same key based on the provided key extractor function */
457454
Set<Map<String, String>> distinctIdSet =
458-
allRowsSet
459-
.parallelStream()
455+
allRowsSet.parallelStream()
460456
.filter(ValidationUtils.distinctByKey(keyExtractor))
461457
.collect(Collectors.toSet());
462458
if (distinctIdSet.size() != allRowsSet.size()) {

src/main/java/edu/ie3/datamodel/io/source/csv/CsvIdCoordinateSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected Stream<Map<String, String>> buildStreamWithFieldsToAttributesMap() {
123123
.get(factory.getLatField())
124124
.concat(fieldToValues.get(factory.getLonField()));
125125
return distinctRowsWithLog(
126-
withDistinctCoordinateId, coordinateExtractor, "coordinate id mapping", "coordinate")
126+
withDistinctCoordinateId, coordinateExtractor, "coordinate id mapping", "coordinate")
127127
.parallelStream();
128128
} catch (IOException e) {
129129
log.error("Cannot read the file for coordinate id to coordinate mapping.", e);

src/main/java/edu/ie3/datamodel/io/source/csv/CsvWeatherSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ protected Stream<Map<String, String>> buildStreamWithFieldsToAttributesMap(
253253
.get(weatherFactory.getTimeFieldString())
254254
.concat(fieldToValues.get(weatherFactory.getCoordinateIdFieldString()));
255255
return distinctRowsWithLog(
256-
allRows, timeCoordinateIdExtractor, entityClass.getSimpleName(), "UUID")
256+
allRows, timeCoordinateIdExtractor, entityClass.getSimpleName(), "UUID")
257257
.parallelStream();
258258

259259
} catch (IOException e) {

0 commit comments

Comments
 (0)