Skip to content

Commit 68ff043

Browse files
committed
Raise the minimum supported version of Java to 17
Closes gh-749
1 parent 1e96e3e commit 68ff043

File tree

13 files changed

+32
-22
lines changed

13 files changed

+32
-22
lines changed

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ subprojects { subproject ->
3939
subproject.apply plugin: "io.spring.javaformat"
4040
subproject.apply plugin: "checkstyle"
4141

42-
sourceCompatibility = 1.8
43-
targetCompatibility = 1.8
42+
sourceCompatibility = 17
43+
targetCompatibility = 17
4444

4545
configurations {
4646
internal {

ci/images/ci-image/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM ubuntu:focal-20210401
22

33
ADD setup.sh /setup.sh
44
ADD get-jdk-url.sh /get-jdk-url.sh
5-
RUN ./setup.sh java8
5+
RUN ./setup.sh java17
66

77
ENV JAVA_HOME /opt/openjdk
88
ENV PATH $JAVA_HOME/bin:$PATH

ci/images/get-jdk-url.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
set -e
33

44
case "$1" in
5-
java8)
6-
echo "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u292b10.tar.gz"
5+
java17)
6+
echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17%2B35/OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz"
77
;;
88
*)
99
echo $"Unknown java version"

docs/src/docs/asciidoc/getting-started.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ If you want to jump straight in, a number of sample applications are available:
7676

7777
Spring REST Docs has the following minimum requirements:
7878

79-
* Java 8
79+
* Java 17
8080
* Spring Framework 5 (5.0.2 or later)
8181

8282
Additionally, the `spring-restdocs-restassured` module requires REST Assured 4 (4.4 or later).

samples/junit5/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ repositories {
1616

1717
group = 'com.example'
1818

19-
sourceCompatibility = 1.8
20-
targetCompatibility = 1.8
19+
sourceCompatibility = 17
20+
targetCompatibility = 17
2121

2222
ext {
2323
snippetsDir = file('build/generated-snippets')

samples/rest-assured/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ repositories {
1616

1717
group = 'com.example'
1818

19-
sourceCompatibility = 1.8
20-
targetCompatibility = 1.8
19+
sourceCompatibility = 17
20+
targetCompatibility = 17
2121

2222
ext {
2323
snippetsDir = file('build/generated-snippets')

samples/rest-notes-slate/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ repositories {
1515

1616
group = 'com.example'
1717

18-
sourceCompatibility = 1.8
19-
targetCompatibility = 1.8
18+
sourceCompatibility = 17
19+
targetCompatibility = 17
2020

2121
ext {
2222
snippetsDir = file('build/generated-snippets')

samples/rest-notes-spring-data-rest/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<properties>
1919
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20-
<java.version>1.8</java.version>
20+
<java.version>17</java.version>
2121
<spring-restdocs.version>3.0.0-SNAPSHOT</spring-restdocs.version>
2222
</properties>
2323

samples/rest-notes-spring-hateoas/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ repositories {
1616

1717
group = 'com.example'
1818

19-
sourceCompatibility = 1.8
20-
targetCompatibility = 1.8
19+
sourceCompatibility = 17
20+
targetCompatibility = 17
2121

2222
ext {
2323
snippetsDir = file('build/generated-snippets')

samples/testng/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ repositories {
1616

1717
group = 'com.example'
1818

19-
sourceCompatibility = 1.8
20-
targetCompatibility = 1.8
19+
sourceCompatibility = 17
20+
targetCompatibility = 17
2121

2222
ext {
2323
snippetsDir = file('build/generated-snippets')

samples/web-test-client/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ repositories {
1414

1515
group = 'com.example'
1616

17-
sourceCompatibility = 1.8
18-
targetCompatibility = 1.8
17+
sourceCompatibility = 17
18+
targetCompatibility = 17
1919

2020
ext {
2121
snippetsDir = file('build/generated-snippets')

spring-restdocs-core/src/main/java/org/springframework/restdocs/operation/OperationResponseFactory.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2021 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.
@@ -41,6 +41,15 @@ public OperationResponse create(HttpStatus status, HttpHeaders headers, byte[] c
4141
return this.create(status.value(), headers, content);
4242
}
4343

44+
/**
45+
* Creates a new {@link OperationResponse}. If the response has any content, the given
46+
* {@code headers} will be augmented to ensure that they include a
47+
* {@code Content-Length} header.
48+
* @param status the status of the response
49+
* @param headers the request's headers
50+
* @param content the content of the request
51+
* @return the {@code OperationResponse}
52+
*/
4453
public OperationResponse create(int status, HttpHeaders headers, byte[] content) {
4554
return new StandardOperationResponse(status, augmentHeaders(headers, content), content);
4655
}

spring-restdocs-webtestclient/src/main/java/org/springframework/restdocs/webtestclient/WebTestClientRequestConverter.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2020 the original author or authors.
2+
* Copyright 2014-2021 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.
@@ -110,7 +110,8 @@ private HttpMessageReader<Part> findPartHttpMessageReader() {
110110
if (ClassUtils.isPresent(DEFAULT_PART_HTTP_MESSAGE_READER, getClass().getClassLoader())) {
111111
try {
112112
return (HttpMessageReader<Part>) Class
113-
.forName(DEFAULT_PART_HTTP_MESSAGE_READER, true, getClass().getClassLoader()).newInstance();
113+
.forName(DEFAULT_PART_HTTP_MESSAGE_READER, true, getClass().getClassLoader())
114+
.getDeclaredConstructor().newInstance();
114115
}
115116
catch (Exception ex) {
116117
// Continue

0 commit comments

Comments
 (0)