Skip to content

Commit af5db51

Browse files
author
Roger Riggs
committed
8353641: Deprecate core library permission classes for removal
Reviewed-by: mullan, iris
1 parent 60f3d60 commit af5db51

File tree

17 files changed

+46
-28
lines changed

17 files changed

+46
-28
lines changed

src/java.base/share/classes/java/io/FilePermission.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,7 @@
6767
* <P>
6868
* The actions string is converted to lowercase before processing.
6969
*
70-
* @apiNote
70+
* @deprecated
7171
* This permission cannot be used for controlling access to resources
7272
* as the Security Manager is no longer supported.
7373
*
@@ -83,6 +83,7 @@
8383
* @serial exclude
8484
*/
8585

86+
@Deprecated(since="25", forRemoval=true)
8687
public final class FilePermission extends Permission implements Serializable {
8788

8889
/**
@@ -1115,6 +1116,7 @@ public FilePermissionCollection() {
11151116
* has been marked readonly
11161117
*/
11171118
@Override
1119+
@SuppressWarnings("removal")
11181120
public void add(Permission permission) {
11191121
if (! (permission instanceof FilePermission fp))
11201122
throw new IllegalArgumentException("invalid permission: "+
@@ -1152,6 +1154,7 @@ public void add(Permission permission) {
11521154
* the set, false if not.
11531155
*/
11541156
@Override
1157+
@SuppressWarnings("removal")
11551158
public boolean implies(Permission permission) {
11561159
if (! (permission instanceof FilePermission fperm))
11571160
return false;
@@ -1180,6 +1183,7 @@ public boolean implies(Permission permission) {
11801183
* @return an enumeration of all the FilePermission objects.
11811184
*/
11821185
@Override
1186+
@SuppressWarnings("removal")
11831187
public Enumeration<Permission> elements() {
11841188
return perms.elements();
11851189
}

src/java.base/share/classes/java/io/ObjectStreamConstants.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -186,6 +186,7 @@ public interface ObjectStreamConstants {
186186
* @see java.io.ObjectInputStream#enableResolveObject(boolean)
187187
* @since 1.2
188188
*/
189+
@SuppressWarnings("removal")
189190
static final SerializablePermission SUBSTITUTION_PERMISSION =
190191
new SerializablePermission("enableSubstitution");
191192

@@ -196,6 +197,7 @@ public interface ObjectStreamConstants {
196197
* @see java.io.ObjectInputStream#readObjectOverride()
197198
* @since 1.2
198199
*/
200+
@SuppressWarnings("removal")
199201
static final SerializablePermission SUBCLASS_IMPLEMENTATION_PERMISSION =
200202
new SerializablePermission("enableSubclassImplementation");
201203

@@ -205,6 +207,7 @@ public interface ObjectStreamConstants {
205207
* @see java.io.ObjectInputFilter.Config#setSerialFilter(ObjectInputFilter)
206208
* @since 9
207209
*/
210+
@SuppressWarnings("removal")
208211
static final SerializablePermission SERIAL_FILTER_PERMISSION =
209212
new SerializablePermission("serialFilter");
210213

src/java.base/share/classes/java/io/SerializablePermission.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
3636
* no actions list; you either have the named permission
3737
* or you don't.
3838
*
39-
* @apiNote
39+
* @deprecated
4040
* This permission cannot be used for controlling access to resources
4141
* as the Security Manager is no longer supported.
4242
*
@@ -51,6 +51,7 @@
5151

5252
/* code was borrowed originally from java.lang.RuntimePermission. */
5353

54+
@Deprecated(since="25", forRemoval=true)
5455
public final class SerializablePermission extends BasicPermission {
5556

5657
@java.io.Serial

src/java.base/share/classes/java/lang/RuntimePermission.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
3838
* An asterisk may appear at the end of the name, following a ".",
3939
* or by itself, to signify a wildcard match. For example: "loadLibrary.*"
4040
* and "*" signify a wildcard match, while "*loadLibrary" and "a*b" do not.
41-
* @apiNote
41+
* @deprecated
4242
* This permission cannot be used for controlling access to resources
4343
* as the Security Manager is no longer supported.
4444
*
@@ -53,6 +53,7 @@
5353
* @since 1.2
5454
*/
5555

56+
@Deprecated(since="25", forRemoval=true)
5657
public final class RuntimePermission extends BasicPermission {
5758

5859
@java.io.Serial

src/java.base/share/classes/java/lang/reflect/ReflectPermission.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
2828
/**
2929
* The Permission class for reflective operations.
3030
*
31-
* @apiNote
31+
* @deprecated
3232
* This permission cannot be used for controlling access to resources
3333
* as the Security Manager is no longer supported.
3434
*
@@ -38,6 +38,7 @@
3838
*
3939
* @since 1.2
4040
*/
41+
@Deprecated(since="25", forRemoval=true)
4142
public final
4243
class ReflectPermission extends java.security.BasicPermission {
4344

src/java.base/share/classes/java/nio/file/LinkPermission.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -30,12 +30,13 @@
3030
/**
3131
* The {@code Permission} class for link creation operations.
3232
*
33-
* @apiNote
33+
* @deprecated
3434
* This permission cannot be used for controlling access to resources
3535
* as the Security Manager is no longer supported.
3636
*
3737
* @since 1.7
3838
*/
39+
@Deprecated(since="25", forRemoval=true)
3940
public final class LinkPermission extends BasicPermission {
4041
@java.io.Serial
4142
static final long serialVersionUID = -1441492453772213220L;

src/java.base/share/classes/java/util/PropertyPermission.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -54,7 +54,7 @@
5454
* <P>
5555
* The actions string is converted to lowercase before processing.
5656
*
57-
* @apiNote
57+
* @deprecated
5858
* This permission cannot be used for controlling access to resources
5959
* as the Security Manager is no longer supported.
6060
*
@@ -70,6 +70,7 @@
7070
* @serial exclude
7171
*/
7272

73+
@Deprecated(since="25", forRemoval=true)
7374
public final class PropertyPermission extends BasicPermission {
7475

7576
/**
@@ -412,6 +413,7 @@ final class PropertyPermissionCollection extends PermissionCollection
412413
* Key is property name; value is PropertyPermission.
413414
* Not serialized; see serialization section at end of class.
414415
*/
416+
@SuppressWarnings("removal")
415417
private transient ConcurrentHashMap<String, PropertyPermission> perms;
416418

417419
/**
@@ -443,6 +445,7 @@ public PropertyPermissionCollection() {
443445
* object has been marked readonly
444446
*/
445447
@Override
448+
@SuppressWarnings("removal")
446449
public void add(Permission permission) {
447450
if (! (permission instanceof PropertyPermission pp))
448451
throw new IllegalArgumentException("invalid permission: "+
@@ -487,6 +490,7 @@ public void add(Permission permission) {
487490
* the set, false if not.
488491
*/
489492
@Override
493+
@SuppressWarnings("removal")
490494
public boolean implies(Permission permission) {
491495
if (! (permission instanceof PropertyPermission pp))
492496
return false;
@@ -613,6 +617,7 @@ private void writeObject(ObjectOutputStream out) throws IOException {
613617
* perms field. Reads in all_allowed.
614618
*/
615619
@java.io.Serial
620+
@SuppressWarnings("removal")
616621
private void readObject(ObjectInputStream in)
617622
throws IOException, ClassNotFoundException
618623
{

src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,12 +1629,6 @@ final boolean isApparentlyUnblocked() {
16291629
*/
16301630
private static volatile int poolIds;
16311631

1632-
/**
1633-
* Permission required for callers of methods that may start or
1634-
* kill threads. Lazily constructed.
1635-
*/
1636-
static volatile RuntimePermission modifyThreadPermission;
1637-
16381632
/**
16391633
* For VirtualThread intrinsics
16401634
*/

src/java.base/share/classes/jdk/internal/access/JavaIOFilePermissionAccess.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@ public interface JavaIOFilePermissionAccess {
3535
* @return the new FilePermission plus the alt path (as npath2)
3636
* or the input itself if no alt path is available.
3737
*/
38+
@SuppressWarnings("removal")
3839
FilePermission newPermPlusAltPath(FilePermission input);
3940

4041
/**
@@ -44,5 +45,6 @@ public interface JavaIOFilePermissionAccess {
4445
* @return the new FilePermission using the alt path (as npath)
4546
* or null if no alt path is available
4647
*/
48+
@SuppressWarnings("removal")
4749
FilePermission newPermUsingAltPath(FilePermission input);
4850
}

src/java.base/share/classes/jdk/internal/access/SharedSecrets.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -287,6 +287,7 @@ public static void setJavaIOFileDescriptorAccess(JavaIOFileDescriptorAccess jiof
287287
javaIOFileDescriptorAccess = jiofda;
288288
}
289289

290+
@SuppressWarnings("removal")
290291
public static JavaIOFilePermissionAccess getJavaIOFilePermissionAccess() {
291292
var access = javaIOFilePermissionAccess;
292293
if (access == null) {

0 commit comments

Comments
 (0)