Skip to content

Commit 7b93974

Browse files
committed
feat: migrate to java 17
changes: - update maven-compiler-plugin to latest 3.14.1 - update maven-javadoc-plugin to latest 3.12.0 - update jacoco-maven-plugin to latest 0.8.14 - set maven.compiler.release to 17 - set source to 17 and update link to javadoc for maven-javadoc-plugin configuration - set java-version to 17 in github workflows - set java version to 17 in swagger-gradle-plugin - replace String.format with "str".formatted - replace casts with pattern variables - add @serial to serialVersionUID fields - replace regular string literals with text blocks in tests - replace Paths.get with Path.of - replace new Integer with Integer.valueOf
1 parent b313104 commit 7b93974

122 files changed

Lines changed: 11767 additions & 11228 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Set up Java
3838
uses: actions/setup-java@v1
3939
with:
40-
java-version: 11
40+
java-version: 17
4141
# Initializes the CodeQL tools for scanning.
4242
- name: Initialize CodeQL
4343
uses: github/codeql-action/init@v3

.github/workflows/maven-pulls.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
java: [ 11, 17 ]
13+
java: [ 17, 25 ]
1414

1515
steps:
1616
- uses: actions/checkout@v4

.github/workflows/maven.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
java: [ 11, 17 ]
13+
java: [ 17, 25 ]
1414

1515
steps:
1616
- uses: actions/checkout@v4
@@ -41,7 +41,7 @@ jobs:
4141
cd ../..
4242
export MY_JAVA_VERSION=`java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1`
4343
echo "JAVA VERSION" ${MY_JAVA_VERSION}
44-
if [[ ${MY_JAVA_VERSION} == "11" ]];
44+
if [[ ${MY_JAVA_VERSION} == "17" ]];
4545
then
4646
export MY_POM_VERSION=`./mvnw -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
4747
echo "POM VERSION" ${MY_POM_VERSION}

.github/workflows/prepare-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
uses: actions/setup-python@v4
2121
with:
2222
python-version: '3.10'
23-
- name: Set up Java 11
23+
- name: Set up Java 17
2424
uses: actions/setup-java@v4
2525
with:
26-
java-version: 11
26+
java-version: 17
2727
distribution: temurin
2828
server-id: central
2929
server-username: MAVEN_USERNAME

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
uses: actions/setup-python@v4
2121
with:
2222
python-version: '3.10'
23-
- name: Set up Java 11
23+
- name: Set up Java 17
2424
uses: actions/setup-java@v4
2525
with:
26-
java-version: 11
26+
java-version: 17
2727
distribution: temurin
2828
server-id: central
2929
server-username: MAVEN_USERNAME

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ If you're interested in the change history of swagger and the Swagger Core frame
129129
### Prerequisites
130130
You need the following installed and available in your $PATH:
131131

132-
* Java 11
132+
* Java 17
133133
* Apache maven 3.0.4 or greater
134134
* Jackson 2.4.5 or greater
135135

modules/swagger-core/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
<dependency>
5656
<groupId>jakarta.xml.bind</groupId>
5757
<artifactId>jakarta.xml.bind-api</artifactId>
58-
<version>2.3.3</version>
5958
</dependency>
6059
<dependency>
6160
<groupId>org.apache.commons</groupId>
@@ -121,6 +120,12 @@
121120
<artifactId>logback-core</artifactId>
122121
<scope>provided</scope>
123122
</dependency>
123+
<dependency>
124+
<groupId>jakarta.annotation</groupId>
125+
<artifactId>jakarta.annotation-api</artifactId>
126+
<version>1.3.5</version>
127+
<scope>provided</scope>
128+
</dependency>
124129
<dependency>
125130
<groupId>jakarta.validation</groupId>
126131
<artifactId>jakarta.validation-api</artifactId>

modules/swagger-core/src/main/java/io/swagger/v3/core/converter/ModelConverterContextImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void defineModel(String name, Schema model, Type type, String prevName) {
5555
@Override
5656
public void defineModel(String name, Schema model, AnnotatedType type, String prevName) {
5757
if (LOGGER.isTraceEnabled()) {
58-
LOGGER.trace(String.format("defineModel %s %s", name, model));
58+
LOGGER.trace("defineModel %s %s".formatted(name, model));
5959
}
6060
modelByName.put(name, model);
6161

@@ -87,7 +87,7 @@ public Schema resolve(AnnotatedType type) {
8787
processedTypes.add(type);
8888
}
8989
if (LOGGER.isDebugEnabled()) {
90-
LOGGER.debug(String.format("resolve %s", type.getType()));
90+
LOGGER.debug("resolve %s".formatted(type.getType()));
9191
}
9292
Iterator<ModelConverter> converters = this.getConverters();
9393
Schema resolved = null;

modules/swagger-core/src/main/java/io/swagger/v3/core/filter/SpecFilter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,9 @@ private void addSchemaRef(Schema schema, Set<String> referencedDefinitions) {
330330
}
331331
}
332332

333-
if (schema instanceof ArraySchema &&
334-
((ArraySchema) schema).getItems() != null) {
335-
addSchemaRef(((ArraySchema) schema).getItems(), referencedDefinitions);
333+
if (schema instanceof ArraySchema arraySchema &&
334+
arraySchema.getItems() != null) {
335+
addSchemaRef(arraySchema.getItems(), referencedDefinitions);
336336
} else if (schema.getTypes() != null && schema.getTypes().contains("array") && schema.getItems() != null) {
337337
addSchemaRef(schema.getItems(), referencedDefinitions);
338338
} else {

modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ExampleSerializer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public ExampleSerializer(JsonSerializer<Object> serializer) {
1919

2020
@Override
2121
public void resolve(SerializerProvider serializerProvider) throws JsonMappingException {
22-
if (defaultSerializer instanceof ResolvableSerializer) {
23-
((ResolvableSerializer) defaultSerializer).resolve(serializerProvider);
22+
if (defaultSerializer instanceof ResolvableSerializer serializer) {
23+
serializer.resolve(serializerProvider);
2424
}
2525
}
2626

0 commit comments

Comments
 (0)