Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* @author Josh Long
* @author Christian Tzolov
* @author Mark Pollack
* @author Fu Jian
*/
public abstract class AiRuntimeHints {

Expand Down Expand Up @@ -100,12 +101,11 @@ public static Set<TypeReference> findClassesInPackage(String packageName, TypeFi
}

private static boolean hasJacksonAnnotations(Class<?> type) {
var hasAnnotation = false;
var annotationsToFind = Set.of(JsonProperty.class, JsonInclude.class);
for (var annotationToFind : annotationsToFind) {

if (type.isAnnotationPresent(annotationToFind)) {
hasAnnotation = true;
return true;
}

var executables = new HashSet<Executable>();
Expand All @@ -114,35 +114,33 @@ private static boolean hasJacksonAnnotations(Class<?> type) {
executables.addAll(Set.of(type.getDeclaredConstructors()));

for (var executable : executables) {
//
if (executable.isAnnotationPresent(annotationToFind)) {
hasAnnotation = true;
return true;
}

///
for (var p : executable.getParameters()) {
if (p.isAnnotationPresent(annotationToFind)) {
hasAnnotation = true;
return true;
}
}
}

if (type.getRecordComponents() != null) {
for (var r : type.getRecordComponents()) {
if (r.isAnnotationPresent(annotationToFind)) {
hasAnnotation = true;
return true;
}
}
}

for (var f : type.getFields()) {
if (f.isAnnotationPresent(annotationToFind)) {
hasAnnotation = true;
return true;
}
}
}

return hasAnnotation;
return false;
}

private static Set<Class<?>> discoverJacksonAnnotatedTypesFromRootType(Class<?> type) {
Expand Down