Skip to content

Commit b5b68fb

Browse files
committed
Generate jdk-internal signature only till Java 23, later versions need to be administered manually (or removed when unsafe is gone)
1 parent 86729a1 commit b5b68fb

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1-
# This file contains API signatures that are marked as internal in Java.
2-
# It is provided here for reference, but can easily regenerated by executing from the source folder of forbidden-apis:
3-
# $ ant generate-internal
1+
# (C) Copyright Uwe Schindler (Generics Policeman) and others.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
414

5-
# This file contains all internal packages listed in Security.getProperty("package.access") of Java version 24 (extracted from build 24).
15+
# This file is no longer autogenerated starting from Java 24 because SecurityManager was removed
16+
# and therefore relevant system properties used to generate the package list.
617

718
@defaultMessage non-public internal runtime class in Java 24
819

20+
sun.misc.**
21+
sun.reflect.**

src/tools/java/de/thetaphi/forbiddenapis/InternalApiGen.java

+8
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ public final class InternalApiGen {
5353
.append("@defaultMessage non-public internal runtime class in Java ").append(javaVersion).append(NL)
5454
.append(NL)
5555
.toString();
56+
try {
57+
int v = Integer.parseInt(javaVersion);
58+
if (v >= 24) {
59+
throw new IllegalArgumentException("InternalApiGen only works till Java 23, for later versions use the generated file from Java 23.");
60+
}
61+
} catch (NumberFormatException nfe) {
62+
// pass
63+
}
5664
}
5765

5866
private void parsePackages(String packagesStr, Set<String> packages) {

0 commit comments

Comments
 (0)