Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "org.springframework.aot.hint.AbstractTypeReference.getCanonicalName()" is null at org.springframework.aot.hint.AbstractTypeReference.equals(AbstractTypeReference.java:93) at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1206)

After checking the code, the clazz pointed to by ReflectionTypeReference is com.google.gson.FieldNamingPolicy$1 which is an anonymous class,

So, getCanonicalName() return null. Then, AbstractTypeReference's equals() function throw NPE.

return getCanonicalName().equals(otherReference.getCanonicalName());

because equals() fail, Map.computIfAbsent() fail

ReflectionHints's registerType function fail

public ReflectionHints registerType(TypeReference type, Consumer<TypeHint.Builder> typeHint) {
        Builder builder = this.types.computeIfAbsent(type, TypeHint.Builder::new);
        typeHint.accept(builder);
        return this;
    }

process-aot abnormal termination


after re-check my code,i found I incorrectly included a Gson instance in the entity data class, caused the above exception

But I still think this part of logic is problematic, shouldSkipType() seems to filter out anonymous classes

Comment From: bclozel

Duplicates #29774