Remove reflection hints workarounds for GraalVM issues

This commit removes the previously introduced reflection hints that were
working around known issues in GraalVM.
Spring Framework 6.1 will require recent maintenance versions of GraalVM
and should not contribute such hints anymore.

Closes gh-30394
This commit is contained in:
Brian Clozel
2023-10-03 13:37:26 +02:00
parent 1fd54912d2
commit 14c5228288
4 changed files with 0 additions and 88 deletions

View File

@@ -16,8 +16,6 @@
package org.springframework.beans.factory.aot;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.Type;
import java.util.Map;
import javax.lang.model.element.Modifier;
@@ -32,12 +30,10 @@ import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.ReflectionHints;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.core.ResolvableType;
import org.springframework.javapoet.ClassName;
import org.springframework.javapoet.CodeBlock;
import org.springframework.javapoet.MethodSpec;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
/**
* AOT contribution from a {@link BeanRegistrationsAotProcessor} used to
@@ -128,21 +124,6 @@ class BeanRegistrationsAotContribution
}
currentClass = currentClass.getSuperclass();
}
// Workaround for https://github.com/oracle/graal/issues/6510
if (beanClass.isRecord()) {
hints.registerType(beanClass, MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_DECLARED_METHODS);
}
// Workaround for https://github.com/oracle/graal/issues/6529
ReflectionUtils.doWithMethods(beanClass, method -> {
for (Type type : method.getGenericParameterTypes()) {
if (type instanceof GenericArrayType) {
Class<?> clazz = ResolvableType.forType(type).resolve();
if (clazz != null) {
hints.registerType(clazz);
}
}
}
});
});
}