Skip to content

Commit 9a3a443

Browse files
committed
Update supported JDK version from 11 to 17
Closes gh-398
1 parent f4ac97d commit 9a3a443

File tree

29 files changed

+65
-65
lines changed

29 files changed

+65
-65
lines changed

CONTRIBUTING.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ should also work without issue.
2929

3030

3131
=== Building From Source
32-
To build the source you will need to install JDK 11.
32+
To build the source you will need to install JDK 17.
3333

3434

3535

@@ -206,9 +206,9 @@ Under `spring-javaformat` the following projects are defined:
206206
* `spring-javaformat-formatter-shader` - Shader support classes
207207
* `spring-javaformat-formatter-shaded` - A shaded version of the formatter with all dependencies included
208208
* `spring-javaformat-formatter-eclipse-jdk8` - The eclipse JDK 8 formatter (repackaged and slightly adapted)
209-
* `spring-javaformat-formatter-eclipse-jdk11` - The eclipse JDK 11 formatter (repackaged and slightly adapted)
209+
* `spring-javaformat-formatter-eclipse-jdk17` - The eclipse JDK 17 formatter (repackaged and slightly adapted)
210210
* `spring-javaformat-formatter-eclipse-jdt-jdk8` - The eclipse JDT import for JDK 8
211-
* `spring-javaformat-formatter-eclipse-jdt-jdk11` - The eclipse JDT import for JDK 8
211+
* `spring-javaformat-formatter-eclipse-jdt-jdk17` - The eclipse JDT import for JDK 17
212212
* `spring-javaformat-formatter-eclipse-rewriter` - Internal utility used to modify eclipse code
213213
* `spring-javaformat-formatter-eclipse-runtime` - Eclipse runtime JAR for use when running outside of Eclipse
214214

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Your `checkstyle.xml` file should look then like this:
192192

193193

194194
=== Java 8 Support
195-
By default, the formatter requires Java 11.
195+
By default, the formatter requires Java 17.
196196
If you are working on an older project, you can use a variation of the formatter based off Eclipse 2021-03 (the latest Eclipse JDT version built with Java 8).
197197

198198
To use the Java 8 version, add a file called `.springjavaformatconfig` to the root of your project with the following content:

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3333
<java.version>1.8</java.version>
3434
<eclipse.jdk8.repository>https://download.eclipse.org/releases/2021-03/202103171000/</eclipse.jdk8.repository>
35-
<eclipse.jdk11.repository>https://download.eclipse.org/releases/2022-12/202212071000/</eclipse.jdk11.repository>
35+
<eclipse.jdk17.repository>https://download.eclipse.org/releases/2022-12/202212071000/</eclipse.jdk17.repository>
3636
<eclipse.checkstyle.repository>https://checkstyle.org/eclipse-cs-update-site/</eclipse.checkstyle.repository>
3737
<tycho.disableP2Mirrors>true</tycho.disableP2Mirrors>
3838
<ant.version>1.8.1</ant.version>

spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/src/io/spring/javaformat/eclipse/projectsettings/ProjectSettingsFilesLocatorTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 the original author or authors.
2+
* Copyright 2017-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -84,7 +84,7 @@ void jdtCorePrefsFormatterWhenDefaultUsesTabs() throws IOException {
8484
Properties properties = new Properties();
8585
properties.load(content);
8686
assertThat(properties.get("org.eclipse.jdt.core.javaFormatter"))
87-
.isEqualTo("io.spring.javaformat.eclipse.formatter.jdk11.tabs");
87+
.isEqualTo("io.spring.javaformat.eclipse.formatter.jdk17.tabs");
8888
}
8989
}
9090

spring-javaformat-eclipse/io.spring.javaformat.eclipse/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ Bundle-ClassPath: .,
2121
lib/spring-javaformat-config.jar,
2222
lib/spring-javaformat-formatter.jar,
2323
lib/spring-javaformat-checkstyle.jar,
24-
lib/spring-javaformat-formatter-eclipse-jdt-jdk11.jar,
24+
lib/spring-javaformat-formatter-eclipse-jdt-jdk17.jar,
2525
lib/spring-javaformat-formatter-eclipse-jdt-jdk8.jar
2626
Bundle-ActivationPolicy: lazy

spring-javaformat-eclipse/io.spring.javaformat.eclipse/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ bin.includes = META-INF/,\
66
lib/spring-javaformat-checkstyle.jar,\
77
lib/spring-javaformat-config.jar,\
88
lib/spring-javaformat-formatter.jar,\
9-
lib/spring-javaformat-formatter-eclipse-jdt-jdk11.jar,\
9+
lib/spring-javaformat-formatter-eclipse-jdt-jdk17.jar,\
1010
lib/spring-javaformat-formatter-eclipse-jdt-jdk8.jar

spring-javaformat-eclipse/io.spring.javaformat.eclipse/plugin.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<plugin>
44
<extension point="org.eclipse.jdt.core.javaFormatter">
55
<javaFormatter
6-
class="io.spring.javaformat.eclipse.formatter.SpringCodeFormatterJdk11Tabs"
7-
id="io.spring.javaformat.eclipse.formatter.jdk11.tabs"
6+
class="io.spring.javaformat.eclipse.formatter.SpringCodeFormatterJdk17Tabs"
7+
id="io.spring.javaformat.eclipse.formatter.jdk17.tabs"
88
name="Spring (tabs)">
99
</javaFormatter>
1010
<javaFormatter
11-
class="io.spring.javaformat.eclipse.formatter.SpringCodeFormatterJdk11Spaces"
12-
id="io.spring.javaformat.eclipse.formatter.jdk11.spaces"
11+
class="io.spring.javaformat.eclipse.formatter.SpringCodeFormatterJdk17Spaces"
12+
id="io.spring.javaformat.eclipse.formatter.jdk17.spaces"
1313
name="Spring (spaces)">
1414
</javaFormatter>
1515
<javaFormatter

spring-javaformat-eclipse/io.spring.javaformat.eclipse/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
</additionalDependency>
6161
<additionalDependency>
6262
<groupId>io.spring.javaformat</groupId>
63-
<artifactId>spring-javaformat-formatter-eclipse-jdt-jdk11</artifactId>
63+
<artifactId>spring-javaformat-formatter-eclipse-jdt-jdk17</artifactId>
6464
<version>${project.version}</version>
6565
</additionalDependency>
6666
</additionalDependencies>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2021 the original author or authors.
2+
* Copyright 2017-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,10 +27,10 @@
2727
*
2828
* @author Phillip Webb
2929
*/
30-
public class SpringCodeFormatterJdk11Spaces extends SpringCodeFormatter {
30+
public class SpringCodeFormatterJdk17Spaces extends SpringCodeFormatter {
3131

32-
public SpringCodeFormatterJdk11Spaces() {
33-
super(JavaFormatConfig.of(JavaBaseline.V11, IndentationStyle.SPACES));
32+
public SpringCodeFormatterJdk17Spaces() {
33+
super(JavaFormatConfig.of(JavaBaseline.V17, IndentationStyle.SPACES));
3434
}
3535

3636
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2021 the original author or authors.
2+
* Copyright 2017-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,10 +27,10 @@
2727
*
2828
* @author Phillip Webb
2929
*/
30-
public class SpringCodeFormatterJdk11Tabs extends SpringCodeFormatter {
30+
public class SpringCodeFormatterJdk17Tabs extends SpringCodeFormatter {
3131

32-
public SpringCodeFormatterJdk11Tabs() {
33-
super(JavaFormatConfig.of(JavaBaseline.V11, IndentationStyle.TABS));
32+
public SpringCodeFormatterJdk17Tabs() {
33+
super(JavaFormatConfig.of(JavaBaseline.V17, IndentationStyle.TABS));
3434
}
3535

3636
}

spring-javaformat-eclipse/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
</properties>
1818
<repositories>
1919
<repository>
20-
<id>eclipse-jdk11</id>
20+
<id>eclipse-jdk17</id>
2121
<layout>p2</layout>
22-
<url>${eclipse.jdk11.repository}</url>
22+
<url>${eclipse.jdk17.repository}</url>
2323
</repository>
2424
<repository>
2525
<id>eclipse-checkstyle</id>

spring-javaformat/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
<module>spring-javaformat-formatter-tests</module>
3939
<module>spring-javaformat-formatter-eclipse-rewriter</module>
4040
<module>spring-javaformat-formatter-eclipse-jdk8</module>
41-
<module>spring-javaformat-formatter-eclipse-jdk11</module>
41+
<module>spring-javaformat-formatter-eclipse-jdk17</module>
4242
<module>spring-javaformat-formatter-eclipse-jdt-jdk8</module>
43-
<module>spring-javaformat-formatter-eclipse-jdt-jdk11</module>
43+
<module>spring-javaformat-formatter-eclipse-jdt-jdk17</module>
4444
<module>spring-javaformat-formatter-eclipse-runtime</module>
4545
<module>spring-javaformat-formatter-shader</module>
4646
<module>spring-javaformat-formatter-shaded</module>

spring-javaformat/spring-javaformat-config/src/main/java/io/spring/javaformat/config/JavaBaseline.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2021 the original author or authors.
2+
* Copyright 2017-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,8 +29,8 @@ public enum JavaBaseline {
2929
V8,
3030

3131
/**
32-
* Use JDK 11+ or higher compatible formatter.
32+
* Use JDK 17+ or higher compatible formatter.
3333
*/
34-
V11
34+
V17
3535

3636
}

spring-javaformat/spring-javaformat-config/src/main/java/io/spring/javaformat/config/JavaFormatConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2021 the original author or authors.
2+
* Copyright 2017-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ public interface JavaFormatConfig {
3232
/**
3333
* The default {@link JavaFormatConfig}.
3434
*/
35-
JavaFormatConfig DEFAULT = of(JavaBaseline.V11, IndentationStyle.TABS);
35+
JavaFormatConfig DEFAULT = of(JavaBaseline.V17, IndentationStyle.TABS);
3636

3737
/**
3838
* Java JDK baseline version expected be used when formatting.

spring-javaformat/spring-javaformat-config/src/test/java/io/spring/javaformat/config/PropertiesJavaFormatConfigTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2020 the original author or authors.
2+
* Copyright 2017-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ class PropertiesJavaFormatConfigTests {
3333
void getJavaBaselineWhenNoPropertyReturnsJava11() {
3434
Properties properties = new Properties();
3535
PropertiesJavaFormatConfig config = new PropertiesJavaFormatConfig(properties);
36-
assertThat(config.getJavaBaseline()).isEqualTo(JavaBaseline.V11);
36+
assertThat(config.getJavaBaseline()).isEqualTo(JavaBaseline.V17);
3737
}
3838

3939
@Test

spring-javaformat/spring-javaformat-formatter-eclipse-jdk11/META-INF/MANIFEST.MF renamed to spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/META-INF/MANIFEST.MF

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
3-
Bundle-Name: Spring Formatter Eclipse Runtime JDK11
4-
Bundle-SymbolicName: spring-javaformat-formatter-eclipse-jdk11
3+
Bundle-Name: Spring Formatter Eclipse Runtime JDK17
4+
Bundle-SymbolicName: spring-javaformat-formatter-eclipse-jdk17
55
Bundle-Version: 0.0.42.qualifier
66
Require-Bundle: org.eclipse.jdt.core;bundle-version="[1.0.0,10.0.0)",
77
org.eclipse.jface;bundle-version="[1.0.0,10.0.0)",

spring-javaformat/spring-javaformat-formatter-eclipse-jdk11/pom.xml renamed to spring-javaformat/spring-javaformat-formatter-eclipse-jdk17/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
<artifactId>spring-javaformat</artifactId>
99
<version>0.0.42-SNAPSHOT</version>
1010
</parent>
11-
<artifactId>spring-javaformat-formatter-eclipse-jdk11</artifactId>
11+
<artifactId>spring-javaformat-formatter-eclipse-jdk17</artifactId>
1212
<packaging>eclipse-plugin</packaging>
13-
<name>Spring JavaFormat Eclipse JDK-11</name>
13+
<name>Spring JavaFormat Eclipse JDK-17</name>
1414
<properties>
1515
<main.basedir>${basedir}/../..</main.basedir>
1616
<sourceartifacts>org.eclipse.jdt.core.source,org.eclipse.jface.source,org.eclipse.text.source</sourceartifacts>
@@ -23,9 +23,9 @@
2323
</licenses>
2424
<repositories>
2525
<repository>
26-
<id>eclipse-jdk11</id>
26+
<id>eclipse-jdk17</id>
2727
<layout>p2</layout>
28-
<url>${eclipse.jdk11.repository}</url>
28+
<url>${eclipse.jdk17.repository}</url>
2929
</repository>
3030
</repositories>
3131
<build>

spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk11/pom.xml renamed to spring-javaformat/spring-javaformat-formatter-eclipse-jdt-jdk17/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
<artifactId>spring-javaformat</artifactId>
99
<version>0.0.42-SNAPSHOT</version>
1010
</parent>
11-
<artifactId>spring-javaformat-formatter-eclipse-jdt-jdk11</artifactId>
12-
<name>Spring JavaFormat Eclipse JDT JDK-11</name>
11+
<artifactId>spring-javaformat-formatter-eclipse-jdt-jdk17</artifactId>
12+
<name>Spring JavaFormat Eclipse JDT JDK-17</name>
1313
<properties>
1414
<main.basedir>${basedir}/../..</main.basedir>
1515
</properties>
1616
<dependencies>
1717
<dependency>
1818
<groupId>io.spring.javaformat</groupId>
19-
<artifactId>spring-javaformat-formatter-eclipse-jdk11</artifactId>
19+
<artifactId>spring-javaformat-formatter-eclipse-jdk17</artifactId>
2020
<version>${project.version}</version>
2121
<optional>true</optional>
2222
</dependency>
@@ -48,7 +48,7 @@
4848
<configuration>
4949
<filters>
5050
<filter>
51-
<artifact>io.spring.javaformat:spring-javaformat-formatter-eclipse-jdk11</artifact>
51+
<artifact>io.spring.javaformat:spring-javaformat-formatter-eclipse-jdk17</artifact>
5252
<includes>
5353
<include>org/eclipse/jdt/**</include>
5454
</includes>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 the original author or authors.
2+
* Copyright 2017-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2021 the original author or authors.
2+
* Copyright 2017-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-javaformat/spring-javaformat-formatter-tests/src/test/java/io/spring/javaformat/formatter/FormatterIntegrationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 the original author or authors.
2+
* Copyright 2017-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -54,16 +54,16 @@ void formatCodeWithV8BaselineCanFormatOnAllVersions(String version) throws Excep
5454
}
5555

5656
@ParameterizedTest
57-
@ValueSource(strings = { "11", "17" })
57+
@ValueSource(strings = { "17" })
5858
void formatCodeWithV11BaselineCanFormatOn11OrHigher(String version) throws Exception {
59-
runFormatter(JavaBaseline.V11, version);
59+
runFormatter(JavaBaseline.V17, version);
6060
}
6161

6262
@ParameterizedTest
6363
@ValueSource(strings = "8")
6464
void formatCodeWithV11BaselineCannotFormatOn8(String version) throws Exception {
6565
assertThatExceptionOfType(ContainerLaunchException.class)
66-
.isThrownBy(() -> runFormatter(JavaBaseline.V11, version));
66+
.isThrownBy(() -> runFormatter(JavaBaseline.V17, version));
6767
}
6868

6969
private void runFormatter(JavaBaseline baseline, String version) throws IOException, Exception {

spring-javaformat/spring-javaformat-formatter/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</dependency>
2828
<dependency>
2929
<groupId>io.spring.javaformat</groupId>
30-
<artifactId>spring-javaformat-formatter-eclipse-jdt-jdk11</artifactId>
30+
<artifactId>spring-javaformat-formatter-eclipse-jdt-jdk17</artifactId>
3131
<version>${project.version}</version>
3232
</dependency>
3333
<!-- Provided -->

spring-javaformat/spring-javaformat-formatter/src/main/java/io/spring/javaformat/formatter/Formatter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 the original author or authors.
2+
* Copyright 2017-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
2424
import io.spring.javaformat.config.JavaBaseline;
2525
import io.spring.javaformat.config.JavaFormatConfig;
2626
import io.spring.javaformat.formatter.eclipse.EclipseCodeFormatter;
27-
import io.spring.javaformat.formatter.jdk11.eclipse.EclipseJdk11CodeFormatter;
27+
import io.spring.javaformat.formatter.jdk17.eclipse.EclipseJdk17CodeFormatter;
2828
import io.spring.javaformat.formatter.jdk8.eclipse.EclipseJdk8CodeFormatter;
2929

3030
/**
@@ -76,7 +76,7 @@ public Formatter() {
7676
*/
7777
public Formatter(JavaFormatConfig javaFormatConfig) {
7878
this.delegate = javaFormatConfig.getJavaBaseline() == JavaBaseline.V8
79-
? new EclipseJdk8CodeFormatter(javaFormatConfig) : new EclipseJdk11CodeFormatter(javaFormatConfig);
79+
? new EclipseJdk8CodeFormatter(javaFormatConfig) : new EclipseJdk17CodeFormatter(javaFormatConfig);
8080
}
8181

8282
/**
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 the original author or authors.
2+
* Copyright 2017-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package io.spring.javaformat.formatter.jdk11.eclipse;
17+
package io.spring.javaformat.formatter.jdk17.eclipse;
1818

1919
import io.spring.javaformat.eclipse.jdt.jdk11.core.dom.ASTNode;
2020
import io.spring.javaformat.eclipse.jdt.jdk11.core.dom.ASTVisitor;

0 commit comments

Comments
 (0)