Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/test/java/org/kohsuke/github/AotIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,20 @@ public void testIfAllRequiredClassesAreRegisteredForAot() throws IOException {
Stream<String> generatedAotConfigClassNames = Stream.concat(generatedReflectConfigStreamOfClassNames,
generatedSerializationStreamOfNames);

generatedAotConfigClassNames.forEach(generatedReflectionConfigClassName -> {
List<String> missingClasses = generatedAotConfigClassNames
.filter(name -> !providedReflectionAndNoReflectionConfigNames.contains(name))
.collect(Collectors.toList());

if (!missingClasses.isEmpty()) {
try {
if (!providedReflectionAndNoReflectionConfigNames.contains(generatedReflectionConfigClassName)) {
fail(String.format(
Files.readString(
Path.of("./target/test-classes/reflection-and-serialization-test-error-message")),
generatedReflectionConfigClassName));
}
String errorTemplate = Files
.readString(Path.of("./target/test-classes/reflection-and-serialization-test-error-message"));
String classList = missingClasses.stream().map(name -> " - " + name).collect(Collectors.joining("\n"));
fail(String.format(errorTemplate, classList));
} catch (IOException e) {
throw new RuntimeException(e);
}
});
}

}

Expand Down
22 changes: 12 additions & 10 deletions src/test/resources/reflection-and-serialization-test-error-message
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
The class "%1$s" needs to be configured or excluded for reflection / serialization and was not mentioned in one of the following resources:
The following classes need to be configured or excluded for reflection / serialization:

Please do one of the following:
1. add "%1$s" to serialization.json and / or reflect-config.json
2. add "%1$s" to no-reflect-and-serialization-list
%1$s

DO NOT do both.
For each class, please do one of the following:
1. add it to serialization.json and / or reflect-config.json
2. add it to no-reflect-and-serialization-list

DO NOT do both.

Option 1:
The class is serialized or reflected over. Includes "GH*" classes the are populated using Jackson.
Does not include Builders and other classes that are only used locally.
The class is serialized or reflected over. Includes "GH*" classes that are populated using Jackson.
Does not include Builders and other classes that are only used locally.

src/main/resources/META-INF/reflect-config.json - example:

{
"name": "%1$s",
"name": "org.kohsuke.github.GHExample",
"allPublicFields": true,
"allDeclaredFields": true,
"queryAllPublicConstructors": true,
Expand All @@ -31,15 +33,15 @@ src/main/resources/META-INF/reflect-config.json - example:
src/main/resources/META-INF/serialization.json - example:

{
"name": "%1$s"
"name": "org.kohsuke.github.GHExample"
}

Option 2:
The class is not serialized or reflected over. This is less common.

src/test/resources/no-reflect-and-serialization-list - example:

%1$s
org.kohsuke.github.GHExample



Loading