Skip to content

Commit

Permalink
Add support for Java 20 (#224)
Browse files Browse the repository at this point in the history
uschindler authored Mar 27, 2023
1 parent 0267abf commit c8cc5d5
Showing 7 changed files with 692 additions and 5 deletions.
2 changes: 2 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@
<equals arg1="${-cleaned.specification.version}" arg2="17"/>
<equals arg1="${-cleaned.specification.version}" arg2="18"/>
<equals arg1="${-cleaned.specification.version}" arg2="19"/>
<equals arg1="${-cleaned.specification.version}" arg2="20"/>
</or>
</condition>

@@ -165,6 +166,7 @@
<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 -->
</or>
</condition>

2 changes: 1 addition & 1 deletion ivy.xml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
<!DOCTYPE ivy-module [
<!ENTITY maven.version "2.0">
<!ENTITY gradle.version "3.4">
<!ENTITY asm.version "9.4">
<!ENTITY asm.version "9.5">
<!ENTITY jarjar.asm.version "5.2">
]>
<ivy-module version="2.0">
6 changes: 3 additions & 3 deletions src/main/docs/bundled-signatures.html
Original file line number Diff line number Diff line change
@@ -29,14 +29,14 @@ <h1>Bundled Signatures Documentation</h1>
<li><strong><tt>jdk-unsafe-*</tt>:</strong> Signatures
of &quot;unsafe&quot; methods that use default charset, default locale, or default timezone. For server applications it is very
stupid to call those methods, as the results will definitely not what the user wants
(for Java <tt>*</tt> = 1.7, 1.8, 9,..., 19; Ant / Maven / Gradle automatically add the compile Java version).</li>
(for Java <tt>*</tt> = 1.7, 1.8, 9,..., 20; Ant / Maven / Gradle automatically add the compile Java version).</li>

<li><strong><tt>jdk-deprecated-*</tt>:</strong> This disallows all deprecated
methods from the JDK (for Java <tt>*</tt> = 1.7, 1.8, 9,..., 19; Ant / Maven / Gradle automatically add the compile Java version).</li>
methods from the JDK (for Java <tt>*</tt> = 1.7, 1.8, 9,..., 20; Ant / Maven / Gradle automatically add the compile Java version).</li>

<li><strong><tt>jdk-internal-*</tt>:</strong> Lists all internal packages of the JDK as of <code>Security.getProperty(&quot;package.access&quot;)</code>.
Calling those methods will always trigger security manager and is completely forbidden from Java 9 on
(for Java <tt>*</tt> = 1.7, 1.8, 9,..., 19; Ant / Maven / Gradle automatically add the compile Java version, <em>since forbiddenapis v2.1</em>).</li>
(for Java <tt>*</tt> = 1.7, 1.8, 9,..., 20; Ant / Maven / Gradle automatically add the compile Java version, <em>since forbiddenapis v2.1</em>).</li>

<li><strong><tt>jdk-non-portable</tt>:</strong> Signatures of all non-portable (like <code>com.sun.management.HotSpotDiagnosticMXBean</code>)
or internal runtime APIs (like <code>sun.misc.Unsafe</code>). This is a superset of <tt>jdk-internal</tt>.<br>
2 changes: 1 addition & 1 deletion src/main/java/de/thetaphi/forbiddenapis/AsmUtils.java
Original file line number Diff line number Diff line change
@@ -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.V19 + 1, Opcodes.V19);
if (false) patchClassMajorVersion(bytecode, Opcodes.V21 + 1, Opcodes.V21);
return new ClassReader(bytecode);
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file contains API signatures that are marked as internal in Java.
# It is provided here for reference, but can easily regenerated by executing from the source folder of forbidden-apis:
# $ ant generate-internal

# This file contains all internal packages listed in Security.getProperty("package.access") of Java version 20 (extracted from build 20).

@defaultMessage non-public internal runtime class in Java 20

sun.misc.**
sun.reflect.**
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# (C) Copyright Uwe Schindler (Generics Policeman) and others.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# These methods and classes should not be used by server classes (unsafe, no charset, no locale,...):

# We only include 19 for now.
# TODO: Scan Java 20 API for additional locale/charset/... violations!
@includeBundled jdk-unsafe-19

0 comments on commit c8cc5d5

Please sign in to comment.