Skip to content

Commit

Permalink
JDK21 returns empty string in getSimpleName() for closures
Browse files Browse the repository at this point in the history
  • Loading branch information
theigl committed Oct 16, 2023
1 parent ed41af3 commit 0716fba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@
<target>${java.vm.specification.version}</target>
<compilerArgs>
<arg>-parameters</arg>
<arg>--enable-preview</arg>
<arg>--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED</arg>
<arg>--add-exports=java.base/sun.nio.ch=ALL-UNNAMED</arg>
</compilerArgs>
Expand Down
4 changes: 2 additions & 2 deletions src/com/esotericsoftware/kryo/Kryo.java
Original file line number Diff line number Diff line change
Expand Up @@ -1257,10 +1257,10 @@ public boolean isFinal (Class type) {
* the class {@link Registration}.
* <p>
* This can be overridden to support alternative closure implementations. The default implementation returns true if the
* specified type is synthetic and the type's simple name contains '/' (to detect a Java 8+ closure). */
* specified type is synthetic and the type's name contains '/' (to detect a Java 8+ closure). */
public boolean isClosure (Class type) {
if (type == null) throw new IllegalArgumentException("type cannot be null.");
return type.isSynthetic() && type.getSimpleName().indexOf('/') >= 0;
return type.isSynthetic() && type.getName().indexOf('/') >= 0;
}

/** Returns true if the specified type is a proxy. When true, Kryo uses {@link InvocationHandler} instead of the specified type
Expand Down

0 comments on commit 0716fba

Please sign in to comment.