Raise the minimum supported version of Java to 17

Closes gh-749
This commit is contained in:
Andy Wilkinson
2021-09-28 12:12:50 +01:00
parent 1e96e3e71a
commit 68ff043fb3
13 changed files with 32 additions and 22 deletions

View File

@@ -39,8 +39,8 @@ subprojects { subproject ->
subproject.apply plugin: "io.spring.javaformat"
subproject.apply plugin: "checkstyle"
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
configurations {
internal {

View File

@@ -2,7 +2,7 @@ FROM ubuntu:focal-20210401
ADD setup.sh /setup.sh
ADD get-jdk-url.sh /get-jdk-url.sh
RUN ./setup.sh java8
RUN ./setup.sh java17
ENV JAVA_HOME /opt/openjdk
ENV PATH $JAVA_HOME/bin:$PATH

View File

@@ -2,8 +2,8 @@
set -e
case "$1" in
java8)
echo "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u292b10.tar.gz"
java17)
echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17%2B35/OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz"
;;
*)
echo $"Unknown java version"

View File

@@ -76,7 +76,7 @@ If you want to jump straight in, a number of sample applications are available:
Spring REST Docs has the following minimum requirements:
* Java 8
* Java 17
* Spring Framework 5 (5.0.2 or later)
Additionally, the `spring-restdocs-restassured` module requires REST Assured 4 (4.4 or later).

View File

@@ -16,8 +16,8 @@ repositories {
group = 'com.example'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
ext {
snippetsDir = file('build/generated-snippets')

View File

@@ -16,8 +16,8 @@ repositories {
group = 'com.example'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
ext {
snippetsDir = file('build/generated-snippets')

View File

@@ -15,8 +15,8 @@ repositories {
group = 'com.example'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
ext {
snippetsDir = file('build/generated-snippets')

View File

@@ -17,7 +17,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<java.version>17</java.version>
<spring-restdocs.version>3.0.0-SNAPSHOT</spring-restdocs.version>
</properties>

View File

@@ -16,8 +16,8 @@ repositories {
group = 'com.example'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
ext {
snippetsDir = file('build/generated-snippets')

View File

@@ -16,8 +16,8 @@ repositories {
group = 'com.example'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
ext {
snippetsDir = file('build/generated-snippets')

View File

@@ -14,8 +14,8 @@ repositories {
group = 'com.example'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
ext {
snippetsDir = file('build/generated-snippets')

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,6 +41,15 @@ public class OperationResponseFactory {
return this.create(status.value(), headers, content);
}
/**
* Creates a new {@link OperationResponse}. If the response has any content, the given
* {@code headers} will be augmented to ensure that they include a
* {@code Content-Length} header.
* @param status the status of the response
* @param headers the request's headers
* @param content the content of the request
* @return the {@code OperationResponse}
*/
public OperationResponse create(int status, HttpHeaders headers, byte[] content) {
return new StandardOperationResponse(status, augmentHeaders(headers, content), content);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2020 the original author or authors.
* Copyright 2014-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -110,7 +110,8 @@ class WebTestClientRequestConverter implements RequestConverter<ExchangeResult>
if (ClassUtils.isPresent(DEFAULT_PART_HTTP_MESSAGE_READER, getClass().getClassLoader())) {
try {
return (HttpMessageReader<Part>) Class
.forName(DEFAULT_PART_HTTP_MESSAGE_READER, true, getClass().getClassLoader()).newInstance();
.forName(DEFAULT_PART_HTTP_MESSAGE_READER, true, getClass().getClassLoader())
.getDeclaredConstructor().newInstance();
}
catch (Exception ex) {
// Continue