Repository: victools/jsonschema-generator
Pull request #477 (2024-09-23 03:12:25)

#438 Upgrade to support jdk17
try to build with JDK17 since it's LTS version and widely used in organizations


Patch:
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 8904bf6..5adcd9d 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -27,8 +27,14 @@ jobs:
       with:
           languages: java
 
+    - name: Setup Java 17
+      uses: actions/setup-java@v1
+      with:
+        java-version: 17
+
     - name: Autobuild
       uses: github/codeql-action/autobuild@v2
 
+
     - name: Perform CodeQL Analysis
       uses: github/codeql-action/analyze@v2
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index dc92e31..7dd94f8 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -17,7 +17,7 @@ jobs:
 
     strategy:
       matrix:
-        java-version: ['11', '17']
+        java-version: ['17']
 
     steps:
     - uses: actions/checkout@v3
@@ -37,7 +37,7 @@ jobs:
 
     strategy:
       matrix:
-        java-version: ['11', '17']
+        java-version: ['17']
 
     steps:
     - uses: actions/checkout@v3
@@ -57,10 +57,10 @@ jobs:
 
     steps:
     - uses: actions/checkout@v3
-    - name: Set up JDK 11
+    - name: Set up JDK 17
       uses: actions/setup-java@v1
       with:
-        java-version: 11
+        java-version: 17
     - name: Checkstyle
       run: mvn verify -DskipTests=true -Dmaven.javadoc.skip=true -B
       env:
@@ -73,10 +73,10 @@ jobs:
 
     steps:
     - uses: actions/checkout@v3
-    - name: Set up JDK 11
+    - name: Set up JDK 17
       uses: actions/setup-java@v1
       with:
-        java-version: 11
+        java-version: 17
     - name: Generate JavaDoc
       run: mvn verify -DskipTests=true -Dcheckstyle.skip=true -B
       env:
diff --git a/jsonschema-generator-bom/pom.xml b/jsonschema-generator-bom/pom.xml
index d8fcc05..dc0ce23 100644
--- a/jsonschema-generator-bom/pom.xml
+++ b/jsonschema-generator-bom/pom.xml
@@ -12,6 +12,7 @@
     <packaging>pom</packaging>
 
     <properties>
+    <maven.compiler.release>17</maven.compiler.release>
         <signAndStage.skip>true</signAndStage.skip>
     </properties>
 
diff --git a/jsonschema-generator-parent/pom.xml b/jsonschema-generator-parent/pom.xml
index dda23f6..0817a61 100644
--- a/jsonschema-generator-parent/pom.xml
+++ b/jsonschema-generator-parent/pom.xml
@@ -142,8 +142,8 @@
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <file.encoding>UTF-8</file.encoding>
-        <maven.compiler.source>1.8</maven.compiler.source>
-        <maven.compiler.target>1.8</maven.compiler.target>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
         <!-- maven plugins -->
         <maven.plugin.version.checkstyle>3.6.0</maven.plugin.version.checkstyle>
         <version.checkstyle>10.19.0</version.checkstyle>
@@ -285,9 +285,8 @@
                     <artifactId>maven-compiler-plugin</artifactId>
                     <version>${maven.plugin.version.compiler}</version>
                     <configuration>
-                        <source>${maven.compiler.source}</source>
-                        <target>${maven.compiler.target}</target>
                         <showDeprecation>true</showDeprecation>
+            <release>17</release>
                     </configuration>
                 </plugin>
                 <plugin>
diff --git a/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/MethodScope.java b/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/MethodScope.java
index 2631dae..fbd1316 100644
--- a/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/MethodScope.java
+++ b/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/MethodScope.java
@@ -246,7 +246,7 @@ public class MethodScope extends MemberScope<ResolvedMethod, Method> {
                 .map(prefix -> methodName.substring(prefix.length()))
                 .filter(name -> !name.isEmpty())
                 .findFirst();
-        if (!possibleFieldName.isPresent()) {
+        if (possibleFieldName.isEmpty()) {
             return methodName + "()";
         }
         String methodNameWithoutPrefix = possibleFieldName.get();
diff --git a/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/TypeContext.java b/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/TypeContext.java
index e066143..36ca52a 100644
--- a/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/TypeContext.java
+++ b/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/TypeContext.java
@@ -73,9 +73,9 @@ public class TypeContext {
      */
     public TypeContext(AnnotationConfiguration annotationConfig, SchemaGeneratorConfig generatorConfig) {
         this(annotationConfig, generatorConfig.shouldDeriveFieldsFromArgumentFreeMethods());
-        if (annotationConfig instanceof AnnotationConfiguration.StdConfiguration) {
+        if (annotationConfig instanceof AnnotationConfiguration.StdConfiguration configuration) {
             generatorConfig.getAnnotationInclusionOverrides()
-                    .forEach(((AnnotationConfiguration.StdConfiguration) annotationConfig)::setInclusion);
+                    .forEach(configuration::setInclusion);
         }
     }
 
@@ -327,8 +327,8 @@ public class TypeContext {
      * @since 4.30.0
      */
     public Stream<Annotation> getTypeParameterAnnotations(AnnotatedType annotatedContainerType, Integer containerItemIndex) {
-        if (annotatedContainerType instanceof AnnotatedParameterizedType) {
-            AnnotatedType[] typeArguments = ((AnnotatedParameterizedType) annotatedContainerType).getAnnotatedActualTypeArguments();
+        if (annotatedContainerType instanceof AnnotatedParameterizedType type) {
+            AnnotatedType[] typeArguments = type.getAnnotatedActualTypeArguments();
             int itemIndex = containerItemIndex == null ? 0 : containerItemIndex;
             if (typeArguments.length > itemIndex) {
                 return Stream.of(typeArguments[itemIndex].getAnnotations());
@@ -478,10 +478,10 @@ public class TypeContext {
     public <R> R performActionOnMember(MemberScope<?, ?> member, Function<FieldScope, R> fieldAction,
             Function<MethodScope, R> methodAction) {
         R result;
-        if (member instanceof FieldScope) {
-            result = fieldAction.apply((FieldScope) member);
-        } else if (member instanceof MethodScope) {
-            result = methodAction.apply((MethodScope) member);
+        if (member instanceof FieldScope scope) {
+            result = fieldAction.apply(scope);
+        } else if (member instanceof MethodScope scope) {
+            result = methodAction.apply(scope);
         } else {
             throw new IllegalStateException("Unsupported member scope of type: " + member.getClass());
         }
diff --git a/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/AttributeCollector.java b/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/AttributeCollector.java
index 22a8e80..6f406da 100644
--- a/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/AttributeCollector.java
+++ b/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/AttributeCollector.java
@@ -379,21 +379,21 @@ public class AttributeCollector {
 
     private void addRawPropertyValue(ObjectNode node, String propertyName, Object value) {
         // need to specifically add simple/primitive values by type
-        if (value instanceof String) {
+        if (value instanceof String string) {
             // explicit inclusion as string results in wrapping quote symbols
-            node.put(propertyName, (String) value);
-        } else if (value instanceof BigDecimal) {
-            node.put(propertyName, (BigDecimal) value);
-        } else if (value instanceof BigInteger) {
-            node.put(propertyName, (BigInteger) value);
-        } else if (value instanceof Boolean) {
-            node.put(propertyName, (Boolean) value);
-        } else if (value instanceof Double) {
-            node.put(propertyName, (Double) value);
-        } else if (value instanceof Float) {
-            node.put(propertyName, (Float) value);
-        } else if (value instanceof Integer) {
-            node.put(propertyName, (Integer) value);
+            node.put(propertyName, string);
+        } else if (value instanceof BigDecimal decimal) {
+            node.put(propertyName, decimal);
+        } else if (value instanceof BigInteger integer) {
+            node.put(propertyName, integer);
+        } else if (value instanceof Boolean boolean1) {
+            node.put(propertyName, boolean1);
+        } else if (value instanceof Double double1) {
+            node.put(propertyName, double1);
+        } else if (value instanceof Float float1) {
+            node.put(propertyName, float1);
+        } else if (value instanceof Integer integer) {
+            node.put(propertyName, integer);
         } else {
             // everything else is simply forwarded as-is to the JSON Schema, it's up to the configurator to ensure the value's correctness
             node.putPOJO(propertyName, value);
@@ -402,21 +402,21 @@ public class AttributeCollector {
 
     private void addRawArrayItem(ArrayNode node, Object value) {
         // need to specifically add simple/primitive values by type
-        if (value instanceof String) {
+        if (value instanceof String string) {
             // explicit inclusion as string results in wrapping quote symbols
-            node.add((String) value);
-        } else if (value instanceof BigDecimal) {
-            node.add((BigDecimal) value);
-        } else if (value instanceof BigInteger) {
-            node.add((BigInteger) value);
-        } else if (value instanceof Boolean) {
-            node.add((Boolean) value);
-        } else if (value instanceof Double) {
-            node.add((Double) value);
-        } else if (value instanceof Float) {
-            node.add((Float) value);
-        } else if (value instanceof Integer) {
-            node.add((Integer) value);
+            node.add(string);
+        } else if (value instanceof BigDecimal decimal) {
+            node.add(decimal);
+        } else if (value instanceof BigInteger integer) {
+            node.add(integer);
+        } else if (value instanceof Boolean boolean1) {
+            node.add(boolean1);
+        } else if (value instanceof Double double1) {
+            node.add(double1);
+        } else if (value instanceof Float float1) {
+            node.add(float1);
+        } else if (value instanceof Integer integer) {
+            node.add(integer);
         } else {
             // everything else is simply forwarded as-is to the JSON Schema, it's up to the configurator to ensure the value's correctness
             node.addPOJO(value);
diff --git a/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaCleanUpUtils.java b/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaCleanUpUtils.java
index 4b81153..1d6c7cc 100644
--- a/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaCleanUpUtils.java
+++ b/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaCleanUpUtils.java
@@ -191,8 +191,8 @@ public class SchemaCleanUpUtils {
     private void finaliseSchemaParts(List<ObjectNode> schemaNodes, Consumer<ObjectNode> performCleanUpOnSingleSchemaNode) {
         List<ObjectNode> nextNodesToCheck = new ArrayList<>(schemaNodes);
         Consumer<JsonNode> addNodeToCheck = node -> {
-            if (node instanceof ObjectNode) {
-                nextNodesToCheck.add((ObjectNode) node);
+            if (node instanceof ObjectNode objectNode) {
+                nextNodesToCheck.add(objectNode);
             }
         };
 
diff --git a/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaGenerationContextImpl.java b/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaGenerationContextImpl.java
index 331ccd2..42a6eba 100644
--- a/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaGenerationContextImpl.java
+++ b/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaGenerationContextImpl.java
@@ -435,11 +435,11 @@ public class SchemaGenerationContextImpl implements SchemaGenerationContext {
     }
 
     private JsonNode populateItemMemberSchema(TypeScope targetScope) {
-        if (targetScope instanceof FieldScope && !((FieldScope) targetScope).isFakeContainerItemScope()) {
-            return this.populateFieldSchema(((FieldScope) targetScope).asFakeContainerItemScope());
+        if (targetScope instanceof FieldScope scope && !scope.isFakeContainerItemScope()) {
+            return this.populateFieldSchema(scope.asFakeContainerItemScope());
         }
-        if (targetScope instanceof MethodScope && !((MethodScope) targetScope).isFakeContainerItemScope()) {
-            return this.populateMethodSchema(((MethodScope) targetScope).asFakeContainerItemScope());
+        if (targetScope instanceof MethodScope scope && !scope.isFakeContainerItemScope()) {
+            return this.populateMethodSchema(scope.asFakeContainerItemScope());
         }
         ObjectNode arrayItemDefinition = this.generatorConfig.createObjectNode();
         this.traverseGenericType(targetScope.getContainerItemType(), arrayItemDefinition);
@@ -710,9 +710,8 @@ public class SchemaGenerationContextImpl implements SchemaGenerationContext {
     private static void extendTypeDeclarationToIncludeNull(ObjectNode node, SchemaGeneratorConfig config) {
         JsonNode fixedJsonSchemaType = node.get(config.getKeyword(SchemaKeyword.TAG_TYPE));
         final String nullTypeName = config.getKeyword(SchemaKeyword.TAG_TYPE_NULL);
-        if (fixedJsonSchemaType instanceof ArrayNode) {
+        if (fixedJsonSchemaType instanceof ArrayNode arrayOfTypes) {
             // there are already multiple "type" values
-            ArrayNode arrayOfTypes = (ArrayNode) fixedJsonSchemaType;
             // one of the existing "type" values could be null
             for (JsonNode arrayEntry : arrayOfTypes) {
                 if (nullTypeName.equals(arrayEntry.textValue())) {
diff --git a/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaGeneratorConfigImpl.java b/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaGeneratorConfigImpl.java
index f255128..b802d1d 100644
--- a/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaGeneratorConfigImpl.java
+++ b/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaGeneratorConfigImpl.java
@@ -238,11 +238,11 @@ public class SchemaGeneratorConfigImpl implements SchemaGeneratorConfig {
     public <M extends MemberScope<?, ?>> CustomPropertyDefinition getCustomDefinition(M scope, SchemaGenerationContext context,
             CustomPropertyDefinitionProvider<M> ignoredDefinitionProvider) {
         CustomPropertyDefinition result;
-        if (scope instanceof FieldScope) {
-            result = this.getCustomDefinition(this.fieldConfigPart, (FieldScope) scope, context,
+        if (scope instanceof FieldScope fieldScope) {
+            result = this.getCustomDefinition(this.fieldConfigPart, fieldScope, context,
                     (CustomPropertyDefinitionProvider<FieldScope>) ignoredDefinitionProvider);
-        } else if (scope instanceof MethodScope) {
-            result = this.getCustomDefinition(this.methodConfigPart, (MethodScope) scope, context,
+        } else if (scope instanceof MethodScope methodScope) {
+            result = this.getCustomDefinition(this.methodConfigPart, methodScope, context,
                     (CustomPropertyDefinitionProvider<MethodScope>) ignoredDefinitionProvider);
         } else {
             throw new IllegalArgumentException("Unexpected member scope: " + (scope == null ? null : scope.getClass().getName()));
diff --git a/jsonschema-maven-plugin/src/main/java/com/github/victools/jsonschema/plugin/maven/SchemaGeneratorMojo.java b/jsonschema-maven-plugin/src/main/java/com/github/victools/jsonschema/plugin/maven/SchemaGeneratorMojo.java
index 272bfa6..31a9e1a 100644
--- a/jsonschema-maven-plugin/src/main/java/com/github/victools/jsonschema/plugin/maven/SchemaGeneratorMojo.java
+++ b/jsonschema-maven-plugin/src/main/java/com/github/victools/jsonschema/plugin/maven/SchemaGeneratorMojo.java
@@ -523,8 +523,10 @@ public class SchemaGeneratorMojo extends AbstractMojo {
             configBuilder.with(new Swagger2Module());
             break;
         default:
-            throw new MojoExecutionException("Error: Module does not have a name in "
-                    + "['Jackson', 'JakartaValidation', 'JavaxValidation', 'Swagger15', 'Swagger2'] or does not have a custom classname.");
+            throw new MojoExecutionException("""
+                    Error: Module does not have a name in \
+                    ['Jackson', 'JakartaValidation', 'JavaxValidation', 'Swagger15', 'Swagger2'] or does not have a custom classname.\
+                    """);
         }
     }
 
diff --git a/jsonschema-module-jackson/src/main/java/com/github/victools/jsonschema/module/jackson/JsonPropertySorter.java b/jsonschema-module-jackson/src/main/java/com/github/victools/jsonschema/module/jackson/JsonPropertySorter.java
index 42d38b0..fe2553d 100644
--- a/jsonschema-module-jackson/src/main/java/com/github/victools/jsonschema/module/jackson/JsonPropertySorter.java
+++ b/jsonschema-module-jackson/src/main/java/com/github/victools/jsonschema/module/jackson/JsonPropertySorter.java
@@ -75,8 +75,8 @@ public class JsonPropertySorter implements Comparator<MemberScope<?, ?>> {
         List<String> sortedProperties = this.propertyOrderPerDeclaringType
                 .computeIfAbsent(topMostHierarchyType.getErasedType(), this::getAnnotatedPropertyOrder);
         String fieldName;
-        if (property instanceof MethodScope) {
-            fieldName = Optional.<MemberScope>ofNullable(((MethodScope) property).findGetterField())
+        if (property instanceof MethodScope scope) {
+            fieldName = Optional.<MemberScope>ofNullable(scope.findGetterField())
                     // since 4.33.1: fall-back on method's property name if no getter can be found
                     .orElse(property)
                     .getSchemaPropertyName();
diff --git a/jsonschema-module-jackson/src/main/java/com/github/victools/jsonschema/module/jackson/JsonSubTypesResolver.java b/jsonschema-module-jackson/src/main/java/com/github/victools/jsonschema/module/jackson/JsonSubTypesResolver.java
index a0ea27b..c2ee5db 100644
--- a/jsonschema-module-jackson/src/main/java/com/github/victools/jsonschema/module/jackson/JsonSubTypesResolver.java
+++ b/jsonschema-module-jackson/src/main/java/com/github/victools/jsonschema/module/jackson/JsonSubTypesResolver.java
@@ -395,10 +395,10 @@ public class JsonSubTypesResolver implements SubtypeResolver, CustomDefinitionPr
 
     private ObjectNode getAttributesToInclude(TypeScope scope, SchemaGenerationContext context) {
         ObjectNode attributesToInclude;
-        if (scope instanceof FieldScope) {
-            attributesToInclude = AttributeCollector.collectFieldAttributes((FieldScope) scope, context);
-        } else if (scope instanceof MethodScope) {
-            attributesToInclude = AttributeCollector.collectMethodAttributes((MethodScope) scope, context);
+        if (scope instanceof FieldScope fieldScope) {
+            attributesToInclude = AttributeCollector.collectFieldAttributes(fieldScope, context);
+        } else if (scope instanceof MethodScope methodScope) {
+            attributesToInclude = AttributeCollector.collectMethodAttributes(methodScope, context);
         } else {
             attributesToInclude = null;
         }
diff --git a/jsonschema-module-jackson/src/main/java/com/github/victools/jsonschema/module/jackson/JsonUnwrappedDefinitionProvider.java b/jsonschema-module-jackson/src/main/java/com/github/victools/jsonschema/module/jackson/JsonUnwrappedDefinitionProvider.java
index 48cc245..1600e15 100644
--- a/jsonschema-module-jackson/src/main/java/com/github/victools/jsonschema/module/jackson/JsonUnwrappedDefinitionProvider.java
+++ b/jsonschema-module-jackson/src/main/java/com/github/victools/jsonschema/module/jackson/JsonUnwrappedDefinitionProvider.java
@@ -109,12 +109,12 @@ public class JsonUnwrappedDefinitionProvider implements CustomDefinitionProvider
      */
     private void applyPrefixAndSuffixToPropertyNames(JsonNode definition, String prefix, String suffix, SchemaGenerationContext context) {
         JsonNode properties = definition.get(context.getKeyword(SchemaKeyword.TAG_PROPERTIES));
-        if (properties instanceof ObjectNode && !properties.isEmpty()) {
+        if (properties instanceof ObjectNode node && !properties.isEmpty()) {
             List<String> fieldNames = new ArrayList<>();
             properties.fieldNames().forEachRemaining(fieldNames::add);
             for (String fieldName : fieldNames) {
-                JsonNode propertySchema = ((ObjectNode) properties).remove(fieldName);
-                ((ObjectNode) properties).set(prefix + fieldName + suffix, propertySchema);
+                JsonNode propertySchema = node.remove(fieldName);
+                node.set(prefix + fieldName + suffix, propertySchema);
             }
         }
         JsonNode allOf = definition.get(context.getKeyword(SchemaKeyword.TAG_ALLOF));
diff --git a/jsonschema-module-swagger-2/src/main/java/com/github/victools/jsonschema/module/swagger2/Swagger2Module.java b/jsonschema-module-swagger-2/src/main/java/com/github/victools/jsonschema/module/swagger2/Swagger2Module.java
index 103d20a..13d12e0 100644
--- a/jsonschema-module-swagger-2/src/main/java/com/github/victools/jsonschema/module/swagger2/Swagger2Module.java
+++ b/jsonschema-module-swagger-2/src/main/java/com/github/victools/jsonschema/module/swagger2/Swagger2Module.java
@@ -418,7 +418,7 @@ public class Swagger2Module implements Module {
      */
     protected CustomPropertyDefinition provideCustomSchemaDefinition(MemberScope<?, ?> scope, SchemaGenerationContext context) {
         Optional<String> externalReference = this.getSchemaAnnotationValue(scope, Schema::ref, ref -> !ref.isEmpty());
-        if (!externalReference.isPresent()) {
+        if (externalReference.isEmpty()) {
             return null;
         }
         // in Draft 6 and Draft 7, no other keywords are allowed besides a "$ref"
diff --git a/pom.xml b/pom.xml
index 719964f..46316da 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,6 +9,9 @@
     <name>Java JSON Schema Generator (Reactor)</name>
     <description>Java JSON Schema Generator + Modules – creating a JSON Schema from your Java classes</description>
     <url>https://github.com/victools/jsonschema-generator</url>
+  <properties>
+    <maven.compiler.release>17</maven.compiler.release>
+  </properties>
 
     <!-- For list of contributors, refer to jsonschema-generator-parent/pom.xml -->
 


Test patch:
diff --git a/jsonschema-examples/src/test/java/com/github/victools/jsonschema/examples/ExampleTest.java b/jsonschema-examples/src/test/java/com/github/victools/jsonschema/examples/ExampleTest.java
index 594653c..a923d0f 100644
--- a/jsonschema-examples/src/test/java/com/github/victools/jsonschema/examples/ExampleTest.java
+++ b/jsonschema-examples/src/test/java/com/github/victools/jsonschema/examples/ExampleTest.java
@@ -59,7 +59,7 @@ public class ExampleTest {
     private static String loadResource(String resourcePath) throws IOException {
         StringBuilder stringBuilder = new StringBuilder();
         try (InputStream inputStream = Objects.requireNonNull(ExampleTest.class.getResourceAsStream(resourcePath));
-             Scanner scanner = new Scanner(inputStream, StandardCharsets.UTF_8.name())) {
+             Scanner scanner = new Scanner(inputStream, StandardCharsets.UTF_8)) {
             while (scanner.hasNext()) {
                 stringBuilder.append(scanner.nextLine()).append('\n');
             }
diff --git a/jsonschema-generator/src/test/java/com/github/victools/jsonschema/generator/SchemaGeneratorAllOfCleanUpTest.java b/jsonschema-generator/src/test/java/com/github/victools/jsonschema/generator/SchemaGeneratorAllOfCleanUpTest.java
index 1cb3d4a..90944c4 100644
--- a/jsonschema-generator/src/test/java/com/github/victools/jsonschema/generator/SchemaGeneratorAllOfCleanUpTest.java
+++ b/jsonschema-generator/src/test/java/com/github/victools/jsonschema/generator/SchemaGeneratorAllOfCleanUpTest.java
@@ -37,10 +37,14 @@ public class SchemaGeneratorAllOfCleanUpTest {
     static Stream<Arguments> parametersForTestAllOfCleanUp() {
         String differentValueInMainSchema = "{ \"type\":\"object\", \"title\":\"main schema\", \"allOf\":[{ \"title\":\"different title\" }, {}] }";
         String differentValueInAllOfPart = "{ \"type\":\"object\", \"allOf\":[{ \"title\":\"title X\" }, { \"title\":\"title Y\" }] }";
-        String equalIfTagInMainSchema = "{ \"type\":\"object\", \"if\":{ \"const\": 1 }, \"then\":{}, "
-                + "\"allOf\":[{ \"if\":{ \"const\": 1 }, \"then\":{}, \"else\": { \"title\": \"otherwise...\" } }, {}] }";
-        String equalIfTagInAllOfPart = "{ \"type\":\"object\", \"allOf\":[{ \"if\":{ \"const\": 1 }, \"then\":{} }, "
-                + "{ \"if\":{ \"const\": 1 }, \"then\":{}, \"else\": { \"title\": \"otherwise...\" } }] }";
+        String equalIfTagInMainSchema = """
+                { "type":"object", "if":{ "const": 1 }, "then":{}, \
+                "allOf":[{ "if":{ "const": 1 }, "then":{}, "else": { "title": "otherwise..." } }, {}] }\
+                """;
+        String equalIfTagInAllOfPart = """
+                { "type":"object", "allOf":[{ "if":{ "const": 1 }, "then":{} }, \
+                { "if":{ "const": 1 }, "then":{}, "else": { "title": "otherwise..." } }] }\
+                """;
         List<Arguments> testCases = EnumSet.allOf(SchemaVersion.class).stream()
                 .flatMap(schemaVersion -> Stream.of(
                     Arguments.of(schemaVersion, differentValueInMainSchema, differentValueInMainSchema),
@@ -48,8 +52,10 @@ public class SchemaGeneratorAllOfCleanUpTest {
                     Arguments.of(schemaVersion, equalIfTagInMainSchema, equalIfTagInMainSchema),
                     Arguments.of(schemaVersion, equalIfTagInAllOfPart, equalIfTagInAllOfPart),
                     Arguments.of(schemaVersion,
-                        "{ \"type\": \"object\", \"title\":\"same in all three\", "
-                                + "\"allOf\": [{ \"title\":\"same in all three\" }, { \"title\":\"same in all three\" }] }",
+                        """
+                        { "type": "object", "title":"same in all three", \
+                        "allOf": [{ "title":"same in all three" }, { "title":"same in all three" }] }\
+                        """,
                         "{ \"type\": \"object\", \"title\":\"same in all three\" }"),
                     Arguments.of(schemaVersion,
                         "{ \"type\": \"object\", \"allOf\": [{ \"title\":\"from allOf[0]\" }, { \"description\":\"from allOf[1]\" }] }",
diff --git a/jsonschema-generator/src/test/java/com/github/victools/jsonschema/generator/impl/SchemaGenerationContextImplTest.java b/jsonschema-generator/src/test/java/com/github/victools/jsonschema/generator/impl/SchemaGenerationContextImplTest.java
index 9a4282c..fdeaec7 100644
--- a/jsonschema-generator/src/test/java/com/github/victools/jsonschema/generator/impl/SchemaGenerationContextImplTest.java
+++ b/jsonschema-generator/src/test/java/com/github/victools/jsonschema/generator/impl/SchemaGenerationContextImplTest.java
@@ -287,11 +287,13 @@ public class SchemaGenerationContextImplTest extends AbstractTypeAwareTest {
     public void testCreateStandardDefinition() {
         ResolvedType type = this.contextImpl.getTypeContext().resolve(TestClass.class);
         ObjectNode result = this.contextImpl.createStandardDefinition(type, null);
-        Assertions.assertEquals("{\"type\":\"object\",\"properties\":{"
-                        + "\"booleanField\":{\"allOf\":[{},{\"title\":\"Field Title\"}]},"
-                        + "\"isBooleanField()\":{\"allOf\":[{},{\"title\":\"Method Title\"}]}},"
-                        + "\"dependentRequired\":{\"booleanField\":[\"isBooleanField()\"],\"isBooleanField()\":[\"booleanField\"]}," +
-                        "\"description\":\"Type Description\"}",
+        Assertions.assertEquals("""
+                        {"type":"object","properties":{\
+                        "booleanField":{"allOf":[{},{"title":"Field Title"}]},\
+                        "isBooleanField()":{"allOf":[{},{"title":"Method Title"}]}},\
+                        "dependentRequired":{"booleanField":["isBooleanField()"],"isBooleanField()":["booleanField"]},\
+                        "description":"Type Description"}\
+                        """,
                 result.toString());
     }
 
diff --git a/jsonschema-maven-plugin/src/test/java/com/github/victools/jsonschema/plugin/maven/SchemaGeneratorMojoTest.java b/jsonschema-maven-plugin/src/test/java/com/github/victools/jsonschema/plugin/maven/SchemaGeneratorMojoTest.java
index 010ea79..3664b5a 100644
--- a/jsonschema-maven-plugin/src/test/java/com/github/victools/jsonschema/plugin/maven/SchemaGeneratorMojoTest.java
+++ b/jsonschema-maven-plugin/src/test/java/com/github/victools/jsonschema/plugin/maven/SchemaGeneratorMojoTest.java
@@ -203,8 +203,10 @@ public class SchemaGeneratorMojoTest extends AbstractMojoTestCase {
     @Test
     public void testFileNamePattern() throws Exception {
         File testCaseLocation = new File("src/test/resources/reference-test-cases");
-        File generationLocation = new File("target/generated-test-sources/SchemaFileName/schemas/"+
-                "com/github/victools/jsonschema/plugin/maven/testpackage");
+        File generationLocation = new File("""
+                target/generated-test-sources/SchemaFileName/schemas/\
+                com/github/victools/jsonschema/plugin/maven/testpackage\
+                """);
 
         // Execute the pom
         executePom(new File("src/test/resources/reference-test-cases/SchemaFileName-pom.xml"));
diff --git a/jsonschema-module-jackson/src/test/java/com/github/victools/jsonschema/module/jackson/JsonSubTypesResolverCustomDefinitionsTest.java b/jsonschema-module-jackson/src/test/java/com/github/victools/jsonschema/module/jackson/JsonSubTypesResolverCustomDefinitionsTest.java
index 215c28c..079498c 100644
--- a/jsonschema-module-jackson/src/test/java/com/github/victools/jsonschema/module/jackson/JsonSubTypesResolverCustomDefinitionsTest.java
+++ b/jsonschema-module-jackson/src/test/java/com/github/victools/jsonschema/module/jackson/JsonSubTypesResolverCustomDefinitionsTest.java
@@ -77,8 +77,10 @@ public class JsonSubTypesResolverCustomDefinitionsTest extends AbstractTypeAware
         return Stream.of(
             Arguments.of(TestClassWithSuperTypeReferences.class, null),
             Arguments.of(TestSuperClassWithNameProperty.class, null),
-            Arguments.of(TestSubClass1.class, "{\"allOf\":[{},"
-                + "{\"type\":\"object\",\"properties\":{\"@type\":{\"const\":\"SUB_CLASS_1\"}},\"required\":[\"@type\"]}]}")
+            Arguments.of(TestSubClass1.class, """
+                {"allOf":[{},\
+                {"type":"object","properties":{"@type":{"const":"SUB_CLASS_1"}},"required":["@type"]}]}\
+                """)
         );
     }
 
@@ -97,36 +99,50 @@ public class JsonSubTypesResolverCustomDefinitionsTest extends AbstractTypeAware
             Arguments.of("superTypeNoAnnotation", TestSubClass2.class, null),
             Arguments.of("superTypeWithAnnotationOnField", null, null),
             Arguments.of("superTypeWithAnnotationOnField", TestSubClass1.class,
-                "{\"allOf\":[{},{\"title\":\"property attribute\",\"type\":\"object\",\"properties\":{\"fullClass\":{\"const\":"
-                + "\"com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass1\"}},"
-                + "\"required\":[\"fullClass\"]}]}"),
+                """
+                {"allOf":[{},{"title":"property attribute","type":"object","properties":{"fullClass":{"const":\
+                "com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass1"}},\
+                "required":["fullClass"]}]}\
+                """),
             Arguments.of("superTypeWithAnnotationOnField", TestSubClass2.class,
-                "{\"allOf\":[{},{\"type\":\"object\",\"properties\":{\"fullClass\":{\"const\":"
-                + "\"com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass2\"}},"
-                + "\"required\":[\"fullClass\"]}]}"),
+                """
+                {"allOf":[{},{"type":"object","properties":{"fullClass":{"const":\
+                "com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass2"}},\
+                "required":["fullClass"]}]}\
+                """),
             Arguments.of("superTypeWithAnnotationOnGetter", null, null),
             Arguments.of("superTypeWithAnnotationOnGetter", TestSubClass1.class,
-                "{\"allOf\":[{},{\"title\":\"property attribute\",\"type\":\"object\","
-                + "\"properties\":{\"@type\":{\"const\":\"SUB_CLASS_1\"}},\"required\":[\"@type\"]}]}"),
+                """
+                {"allOf":[{},{"title":"property attribute","type":"object",\
+                "properties":{"@type":{"const":"SUB_CLASS_1"}},"required":["@type"]}]}\
+                """),
             Arguments.of("superTypeWithAnnotationOnGetter", TestSubClass2.class,
                 "{\"allOf\":[{},{\"type\":\"object\",\"properties\":{\"@type\":{\"const\":\"SUB_CLASS_2\"}},\"required\":[\"@type\"]}]}"),
             Arguments.of("superTypeWithAnnotationOnFieldAndGetter", null, null),
             Arguments.of("superTypeWithAnnotationOnFieldAndGetter", TestSubClass1.class,
-                "{\"type\":\"array\",\"prefixItems\":[{\"type\":\"string\",\"const\":"
-                + "\"com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass1\"},"
-                + "{\"allOf\":[{},{\"title\":\"property attribute\"}]}]}"),
+                """
+                {"type":"array","prefixItems":[{"type":"string","const":\
+                "com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass1"},\
+                {"allOf":[{},{"title":"property attribute"}]}]}\
+                """),
             Arguments.of("superTypeWithAnnotationOnFieldAndGetter", TestSubClass2.class,
-                "{\"type\":\"array\",\"prefixItems\":[{\"type\":\"string\",\"const\":"
-                + "\"com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass2\"},{}]}"),
+                """
+                {"type":"array","prefixItems":[{"type":"string","const":\
+                "com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass2"},{}]}\
+                """),
             Arguments.of("superInterfaceWithAnnotationOnField", null, null),
             Arguments.of("superInterfaceWithAnnotationOnField", TestSubClass3.class,
-                "{\"allOf\":[{},{\"type\":\"object\",\"properties\":{\"fullClass\":{\"const\":"
-                + "\"com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass3\"}},"
-                + "\"required\":[\"fullClass\"]}]}"),
+                """
+                {"allOf":[{},{"type":"object","properties":{"fullClass":{"const":\
+                "com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass3"}},\
+                "required":["fullClass"]}]}\
+                """),
             Arguments.of("superInterfaceWithAnnotationOnField", TestSubClass4.class,
-                "{\"allOf\":[{},{\"type\":\"object\",\"properties\":{\"fullClass\":{\"const\":"
-                + "\"com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass4\"}},"
-                + "\"required\":[\"fullClass\"]}]}")
+                """
+                {"allOf":[{},{"type":"object","properties":{"fullClass":{"const":\
+                "com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass4"}},\
+                "required":["fullClass"]}]}\
+                """)
         );
     }
 
@@ -149,23 +165,31 @@ public class JsonSubTypesResolverCustomDefinitionsTest extends AbstractTypeAware
             Arguments.of("getSuperTypeNoAnnotation", TestSubClass2.class, null),
             Arguments.of("getSuperTypeWithAnnotationOnField", null, null),
             Arguments.of("getSuperTypeWithAnnotationOnField", TestSubClass1.class,
-                "{\"allOf\":[{},{\"title\":\"property attribute\",\"type\":\"object\",\"properties\":{\"fullClass\":{\"const\":"
-                + "\"com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass1\"}},"
-                + "\"required\":[\"fullClass\"]}]}"),
+                """
+                {"allOf":[{},{"title":"property attribute","type":"object","properties":{"fullClass":{"const":\
+                "com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass1"}},\
+                "required":["fullClass"]}]}\
+                """),
             Arguments.of("getSuperTypeWithAnnotationOnField", TestSubClass2.class,
-                "{\"allOf\":[{},{\"type\":\"object\",\"properties\":{\"fullClass\":{\"const\":"
-                + "\"com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass2\"}},"
-                + "\"required\":[\"fullClass\"]}]}"),
+                """
+                {"allOf":[{},{"type":"object","properties":{"fullClass":{"const":\
+                "com.github.victools.jsonschema.module.jackson.JsonSubTypesResolverCustomDefinitionsTest$TestSubClass2"}},\
+                "required":["fullClass"]}]}\
+                """),
             Arguments.of("getSuperTypeWithAnnotationOnGetter", null, null),
             Arguments.of("getSuperTypeWithAnnotationOnGetter", TestSubClass1.class,
-                "{\"allOf\":[{},{\"title\":\"property attribute\",\"type\":\"object\","
-                + "\"properties\":{\"@type\":{\"const\":\"SUB_CLASS_1\"}},\"required\":[\"@type\"]}]}"),
+                """
+                {"allOf":[{},{"title":"property attribute","type":"object",\
+                "properties":{"@type":{"const":"SUB_CLASS_1"}},"required":["@type"]}]}\
+                """),
             Arguments.of("getSuperTypeWithAnnotationOnGetter", TestSubClass2.class,
                 "{\"allOf\":[{},{\"type\":\"object\",\"properties\":{\"@type\":{\"const\":\"SUB_CLASS_2\"}},\"required\":[\"@type\"]}]}"),
             Arguments.of("getSuperTypeWithAnnotationOnFieldAndGetter", null, null),
             Arguments.of("getSuperTypeWithAnnotationOnFieldAndGetter", TestSubClass1.class,
-                "{\"type\":\"object\",\"properties\":{\"SUB_CLASS_1\":{\"allOf\":[{},{\"title\":\"property attribute\"}]}},"
-                + "\"required\":[\"SUB_CLASS_1\"]}"),
+                """
+                {"type":"object","properties":{"SUB_CLASS_1":{"allOf":[{},{"title":"property attribute"}]}},\
+                "required":["SUB_CLASS_1"]}\
+                """),
             Arguments.of("getSuperTypeWithAnnotationOnFieldAndGetter", TestSubClass2.class,
                 "{\"type\":\"object\",\"properties\":{\"SUB_CLASS_2\":{}},\"required\":[\"SUB_CLASS_2\"]}")
         );