Skip to content

Commit

Permalink
Fix #4205: add "sun.*" as "JDK" package (#4226)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder authored Nov 28, 2023
1 parent 7d8692c commit 2874cf6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Project: jackson-databind

2.17.0 (not yet released)

#4205: Consider types in `sun.*` package(s) to be JDK (platform) types
for purposes of handling
#4209: Make `BeanDeserializerModifier`/`BeanSerializerModifier`
implement `java.io.Serializable`
(fix contributed by Muhammad K)
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/com/fasterxml/jackson/databind/util/ClassUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1146,20 +1146,24 @@ public static boolean isJacksonStdImpl(Class<?> implClass) {

/**
* Accessor for checking whether given {@code Class} is under Java package
* of {@code java.*} or {@code javax.*} (including all sub-packages).
* of {@code java.*} or {@code javax.*} (including all sub-packages), or
* (starting with Jackson 2.17), {@code sun.*}).
*<p>
* Added since some aspects of handling need to be changed for JDK types (and
* possibly some extensions under {@code javax.}?): for example, forcing of access
* will not work well for future JDKs (12 and later).
*<p>
* Note: in Jackson 2.11 only returned true for {@code java.*} (and not {@code javax.*});
* was changed in 2.12.
* was changed in 2.12. {@code sun.*} was added in 2.17.
*
* @since 2.11
*/
public static boolean isJDKClass(Class<?> rawType) {
final String clsName = rawType.getName();
return clsName.startsWith("java.") || clsName.startsWith("javax.");
return clsName.startsWith("java.")
|| clsName.startsWith("javax.")
|| clsName.startsWith("sun.")
;
}

/**
Expand Down

0 comments on commit 2874cf6

Please sign in to comment.