Skip to content

Commit 78f28fd

Browse files
committed
Merge branch '6.2.x'
2 parents 810da11 + 13df905 commit 78f28fd

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

spring-core/src/main/java/org/springframework/aot/hint/MemberCategory.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ public enum MemberCategory {
166166
* when {@link ReflectionHints#registerType(Class, MemberCategory...) adding a reflection hint for a type}.
167167
*/
168168
@Deprecated(since = "7.0", forRemoval = true)
169-
DECLARED_CLASSES
169+
DECLARED_CLASSES,
170+
171+
/**
172+
* A category that represents the need for
173+
* {@link sun.misc.Unsafe#allocateInstance(Class) unsafe allocation}
174+
* for this type.
175+
* @since 6.2.1
176+
*/
177+
UNSAFE_ALLOCATED
170178

171179
}

spring-core/src/main/java/org/springframework/aot/nativex/ReflectionHintsAttributes.java

+3
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ private void handleCategories(Map<String, Object> attributes, Set<MemberCategory
129129
case INVOKE_PUBLIC_METHODS -> attributes.put("allPublicMethods", true);
130130
case INVOKE_DECLARED_METHODS ->
131131
attributes.put("allDeclaredMethods", true);
132+
case PUBLIC_CLASSES -> attributes.put("allPublicClasses", true);
133+
case DECLARED_CLASSES -> attributes.put("allDeclaredClasses", true);
134+
case UNSAFE_ALLOCATED -> attributes.put("unsafeAllocated", true);
132135
}
133136
}
134137
);

spring-core/src/test/java/org/springframework/aot/nativex/RuntimeHintsWriterTests.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ void one() throws JSONException {
8484
.onReachableType(String.class)
8585
.withMembers(MemberCategory.INVOKE_PUBLIC_FIELDS, MemberCategory.INVOKE_DECLARED_FIELDS,
8686
MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
87-
MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_DECLARED_METHODS)
87+
MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_DECLARED_METHODS,
88+
MemberCategory.UNSAFE_ALLOCATED)
8889
.withField("DEFAULT_CHARSET")
8990
.withField("defaultCharset")
9091
.withField("aScore")
@@ -101,6 +102,7 @@ void one() throws JSONException {
101102
"allDeclaredConstructors": true,
102103
"allPublicMethods": true,
103104
"allDeclaredMethods": true,
105+
"unsafeAllocated": true,
104106
"fields": [
105107
{ "name": "aScore" },
106108
{ "name": "DEFAULT_CHARSET" },

0 commit comments

Comments
 (0)