Skip to content

Commit

Permalink
Test against JDK21 (#1017)
Browse files Browse the repository at this point in the history
* Test against JDK21

* Add PR workflow for JDK21

* JDK21 returns empty string in `getSimpleName()` for closures
  • Loading branch information
theigl committed Oct 16, 2023
1 parent fc955c0 commit 13c9b4a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-workflow.yml
Expand Up @@ -47,8 +47,8 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
- name: Test with JDK 20
java-version: 21
- name: Test with JDK 21
run: mvn -v && mvn -B test

- name: Set up settings.xml for Sonatype
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/pr-workflow.yml
Expand Up @@ -37,3 +37,10 @@ jobs:
java-version: 17
- name: Test with JDK 17
run: mvn -v && mvn -B test

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 21
- name: Test with JDK 21
run: mvn -v && mvn -B test
1 change: 0 additions & 1 deletion pom.xml
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
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 13c9b4a

Please sign in to comment.