Skip to content

Commit

Permalink
Add Java 21 signatures support
Browse files Browse the repository at this point in the history
  • Loading branch information
uschindler committed Oct 1, 2023
1 parent 615e13a commit c32bcc7
Show file tree
Hide file tree
Showing 5 changed files with 701 additions and 4 deletions.
19 changes: 16 additions & 3 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<equals arg1="${-cleaned.specification.version}" arg2="18"/>
<equals arg1="${-cleaned.specification.version}" arg2="19"/>
<equals arg1="${-cleaned.specification.version}" arg2="20"/>
<equals arg1="${-cleaned.specification.version}" arg2="21"/>
</or>
</condition>

Expand Down Expand Up @@ -168,7 +169,15 @@
<equals arg1="${build.java.runtime}" arg2="17"/>
<equals arg1="${build.java.runtime}" arg2="18"/>
<equals arg1="${build.java.runtime}" arg2="19"/>
<!-- Java 20 for testing is no longer supported as Java 7 support was removed as compile target -->
<!-- Java 20+ for testing is no longer supported as Java 7 support was removed as compile target -->
</or>
</condition>

<condition property="forbiddenchecks.supported">
<or>
<isset property="tests.supported"/>
<equals arg1="${build.java.runtime}" arg2="20"/>
<equals arg1="${build.java.runtime}" arg2="21"/>
</or>
</condition>

Expand Down Expand Up @@ -532,7 +541,7 @@

<target name="test" depends="-check-myself,-check-bundled-signatures,test-junit,-test-antunit,test-gradle,-runtime-unsupported" description="Run tests"/>

<target name="check-bundled-signatures" depends="-check-bundled-signatures,-runtime-unsupported"
<target name="check-bundled-signatures" depends="-check-bundled-signatures,-forbiddenchecks-unsupported"
description="Checks bundled signatures file corresponding to the current JVM. Run after every update!"/>

<target name="-install-forbiddenapi-task" depends="compile" unless="installed.forbiddenapi-task">
Expand All @@ -557,7 +566,7 @@
</forbiddenapis>
</target>

<target name="-check-bundled-signatures" depends="-install-forbiddenapi-task" if="tests.supported">
<target name="-check-bundled-signatures" depends="-install-forbiddenapi-task" if="forbiddenchecks.supported">
<forbiddenapis failOnUnsupportedJava="true" ignoreEmptyFileset="true" targetVersion="${build.java.runtime}">
<signatures>
<bundled name="jdk-unsafe"/>
Expand Down Expand Up @@ -697,6 +706,10 @@
<echo level="warn" message="Test suite / bundled signatures checker was not executed, because the used JVM version is unsupported: ${build.java.info}"/>
</target>

<target name="-forbiddenchecks-unsupported" unless="forbiddenchecks.supported">
<echo level="warn" message="Bundled signatures checker was not executed, because the used JVM version is unsupported: ${build.java.info}"/>
</target>

<target name="generate-deprecated" depends="compile-tools,-install-tasks" description="Generates deprecated API signature lists for current JDK">
<mkdir dir="${signatures.dir}"/>
<property name="deprecated.output.file" location="${signatures.dir}/jdk-deprecated-${build.java.runtime}.txt"/>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/thetaphi/forbiddenapis/AsmUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private static byte[] readStream(final InputStream in) throws IOException {
@SuppressWarnings("unused")
public static ClassReader readAndPatchClass(InputStream in) throws IOException {
final byte[] bytecode = readStream(in);
if (false) patchClassMajorVersion(bytecode, Opcodes.V21 + 1, Opcodes.V21);
if (false) patchClassMajorVersion(bytecode, Opcodes.V22 + 1, Opcodes.V22);
return new ClassReader(bytecode);
}

Expand Down
Loading

0 comments on commit c32bcc7

Please sign in to comment.