Skip to content

Commit 2874cf6

Browse files
authored
Fix #4205: add "sun.*" as "JDK" package (#4226)
1 parent 7d8692c commit 2874cf6

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

release-notes/VERSION-2.x

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Project: jackson-databind
66

77
2.17.0 (not yet released)
88

9+
#4205: Consider types in `sun.*` package(s) to be JDK (platform) types
10+
for purposes of handling
911
#4209: Make `BeanDeserializerModifier`/`BeanSerializerModifier`
1012
implement `java.io.Serializable`
1113
(fix contributed by Muhammad K)

src/main/java/com/fasterxml/jackson/databind/util/ClassUtil.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -1146,20 +1146,24 @@ public static boolean isJacksonStdImpl(Class<?> implClass) {
11461146

11471147
/**
11481148
* Accessor for checking whether given {@code Class} is under Java package
1149-
* of {@code java.*} or {@code javax.*} (including all sub-packages).
1149+
* of {@code java.*} or {@code javax.*} (including all sub-packages), or
1150+
* (starting with Jackson 2.17), {@code sun.*}).
11501151
*<p>
11511152
* Added since some aspects of handling need to be changed for JDK types (and
11521153
* possibly some extensions under {@code javax.}?): for example, forcing of access
11531154
* will not work well for future JDKs (12 and later).
11541155
*<p>
11551156
* Note: in Jackson 2.11 only returned true for {@code java.*} (and not {@code javax.*});
1156-
* was changed in 2.12.
1157+
* was changed in 2.12. {@code sun.*} was added in 2.17.
11571158
*
11581159
* @since 2.11
11591160
*/
11601161
public static boolean isJDKClass(Class<?> rawType) {
11611162
final String clsName = rawType.getName();
1162-
return clsName.startsWith("java.") || clsName.startsWith("javax.");
1163+
return clsName.startsWith("java.")
1164+
|| clsName.startsWith("javax.")
1165+
|| clsName.startsWith("sun.")
1166+
;
11631167
}
11641168

11651169
/**

0 commit comments

Comments
 (0)