Skip to content

Commit

Permalink
For jdk24 add @restricted to System.load() and loadLibrary
Browse files Browse the repository at this point in the history
Issue eclipse-openj9#20353

Signed-off-by: Peter Shipton <[email protected]>
  • Loading branch information
pshipton authored and rmnattas committed Oct 18, 2024
1 parent a17e2ba commit 44baf3d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 9 additions & 0 deletions jcl/src/java.base/share/classes/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
import java.lang.reflect.Method;
import java.lang.reflect.Constructor;

/*[IF JAVA_SPEC_VERSION >= 24]*/
import jdk.internal.javac.Restricted;
/*[ENDIF] JAVA_SPEC_VERSION >= 24 */
/*[IF JAVA_SPEC_VERSION >= 9]*/
import jdk.internal.misc.Unsafe;
/*[IF JAVA_SPEC_VERSION > 11]*/
Expand Down Expand Up @@ -1107,6 +1110,9 @@ public static int identityHashCode(Object anObject) {
* @param pathName the path of the file to be loaded
*/
@CallerSensitive
/*[IF JAVA_SPEC_VERSION >= 24]*/
@Restricted
/*[ENDIF] JAVA_SPEC_VERSION >= 24 */
public static void load(String pathName) {
@SuppressWarnings("removal")
SecurityManager smngr = System.getSecurityManager();
Expand Down Expand Up @@ -1138,6 +1144,9 @@ public static void load(String pathName) {
* @throws SecurityException if the library was not allowed to be loaded
*/
@CallerSensitive
/*[IF JAVA_SPEC_VERSION >= 24]*/
@Restricted
/*[ENDIF] JAVA_SPEC_VERSION >= 24 */
public static void loadLibrary(String libName) {
if (libName.indexOf(File.pathSeparator) >= 0) {
/*[MSG "K0B01", "Library name must not contain a file path: {0}"]*/
Expand Down
6 changes: 4 additions & 2 deletions jcl/src/openj9.cuda/share/classes/com/ibm/cuda/Cuda.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@
/**
* The {@code Cuda} class provides general CUDA utilities.
*/
/*[IF JAVA_SPEC_VERSION >= 17]*/
/*[IF JAVA_SPEC_VERSION >= 24]*/
@SuppressWarnings({"removal", "restricted"})
/*[ELSEIF JAVA_SPEC_VERSION >= 17]*/
@SuppressWarnings("removal")
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
/*[ENDIF] JAVA_SPEC_VERSION >= 24 */
public final class Cuda {

private static final class Cleaner implements Runnable {
Expand Down

0 comments on commit 44baf3d

Please sign in to comment.