Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion make/RunTests.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ define SetupRunJtregTestBody
-vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE) \
-vmoption:-Djava.io.tmpdir="$$($1_TEST_TMP_DIR)"

$1_JTREG_BASIC_OPTIONS += -automatic -ignore:quiet
$1_JTREG_BASIC_OPTIONS += -automatic -ignore:quiet -Djavatest.security.noSecurityManager=true

# Make it possible to specify the JIB_DATA_DIR for tests using the
# JIB Artifact resolver
Expand Down
4 changes: 2 additions & 2 deletions src/demo/share/jfc/J2Ddemo/java2d/Tools.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -406,7 +406,7 @@ public void run() {
if (pDialogState) {
printJob.print(aset);
}
} catch (java.security.AccessControlException ace) {
} catch (@SuppressWarnings("removal") java.security.AccessControlException ace) {
String errmsg = "Applet access control exception; to allow "
+ "access to printer, set\n"
+ "permission for \"queuePrintJob\" in "
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -32,6 +32,7 @@
* Creates this platform's default SelectorProvider
*/

@SuppressWarnings("removal")
public class DefaultSelectorProvider {
private static final SelectorProviderImpl INSTANCE;
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

public final class CgroupUtil {

@SuppressWarnings("removal")
public static Stream<String> readFilePrivileged(Path path) throws IOException {
try {
PrivilegedExceptionAction<Stream<String>> pea = () -> Files.lines(path);
Expand All @@ -64,7 +65,7 @@ static void unwrapIOExceptionAndRethrow(PrivilegedActionException pae) throws IO
static String readStringValue(CgroupSubsystemController controller, String param) throws IOException {
PrivilegedExceptionAction<BufferedReader> pea = () ->
Files.newBufferedReader(Paths.get(controller.path(), param));
try (BufferedReader bufferedReader =
try (@SuppressWarnings("removal") BufferedReader bufferedReader =
AccessController.doPrivileged(pea)) {
String line = bufferedReader.readLine();
return line;
Expand All @@ -76,6 +77,7 @@ static String readStringValue(CgroupSubsystemController controller, String param
}
}

@SuppressWarnings("removal")
public static List<String> readAllLinesPrivileged(Path path) throws IOException {
try {
PrivilegedExceptionAction<List<String>> pea = () -> Files.readAllLines(path);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -32,6 +32,7 @@
* Creates this platform's default SelectorProvider
*/

@SuppressWarnings("removal")
public class DefaultSelectorProvider {
private static final SelectorProviderImpl INSTANCE;
static {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -73,6 +73,7 @@ public Object newInstance(Object ctrParamObj)
}


@SuppressWarnings("removal")
public AppleProvider() {
/* We are the Apple provider */
super("Apple", PROVIDER_VER, info);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ static class TrustedCertEntry {
}

private static void permissionCheck() {
@SuppressWarnings("removal")
SecurityManager sec = System.getSecurityManager();

if (sec != null) {
Expand Down
3 changes: 2 additions & 1 deletion src/java.base/macosx/classes/java/net/DefaultInterface.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -106,6 +106,7 @@ private static NetworkInterface chooseDefaultInterface() {

boolean ip4 = false, ip6 = false, isNonLinkLocal = false;
PrivilegedAction<Enumeration<InetAddress>> pa = ni::getInetAddresses;
@SuppressWarnings("removal")
Enumeration<InetAddress> addrs = AccessController.doPrivileged(pa);
while (addrs.hasMoreElements()) {
InetAddress addr = addrs.nextElement();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -32,6 +32,7 @@
* Creates this platform's default SelectorProvider
*/

@SuppressWarnings("removal")
public class DefaultSelectorProvider {
private static final SelectorProviderImpl INSTANCE;
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ private static class AllowKDF {

private static final boolean VALUE = getValue();

@SuppressWarnings("removal")
private static boolean getValue() {
return AccessController.doPrivileged(
(PrivilegedAction<Boolean>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ public void engineStore(OutputStream stream, char[] password)
* @exception CertificateException if any of the certificates in the
* keystore could not be loaded
*/
@SuppressWarnings("removal")
public void engineLoad(InputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -73,6 +73,7 @@ AlgorithmParameters getParameters() {
return params;
}

@SuppressWarnings("removal")
final Key getKey(Cipher c, int maxLength)
throws IOException, ClassNotFoundException, IllegalBlockSizeException,
BadPaddingException {
Expand Down Expand Up @@ -112,6 +113,7 @@ private static class DeserializationChecker implements ObjectInputFilter {
private static final ObjectInputFilter OWN_FILTER;

static {
@SuppressWarnings("removal")
String prop = AccessController.doPrivileged(
(PrivilegedAction<String>) () -> {
String tmp = System.getProperty(KEY_SERIAL_FILTER);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -117,6 +117,7 @@ private void psA(String type, String algo, String cn,
attrs));
}

@SuppressWarnings("removal")
public SunJCE() {
/* We are the "SunJCE" provider */
super("SunJCE", PROVIDER_VER, info);
Expand Down
25 changes: 25 additions & 0 deletions src/java.base/share/classes/java/io/File.java
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ public URI toURI() {
* method denies read access to the file
*/
public boolean canRead() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
Expand Down Expand Up @@ -798,6 +799,7 @@ public boolean canRead() {
* method denies write access to the file
*/
public boolean canWrite() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
Expand All @@ -821,6 +823,7 @@ public boolean canWrite() {
* method denies read access to the file or directory
*/
public boolean exists() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
Expand Down Expand Up @@ -851,6 +854,7 @@ public boolean exists() {
* method denies read access to the file
*/
public boolean isDirectory() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
Expand Down Expand Up @@ -883,6 +887,7 @@ public boolean isDirectory() {
* method denies read access to the file
*/
public boolean isFile() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
Expand Down Expand Up @@ -912,6 +917,7 @@ public boolean isFile() {
* @since 1.2
*/
public boolean isHidden() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
Expand Down Expand Up @@ -955,6 +961,7 @@ public boolean isHidden() {
* method denies read access to the file
*/
public long lastModified() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
Expand Down Expand Up @@ -986,6 +993,7 @@ public long lastModified() {
* method denies read access to the file
*/
public long length() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
Expand Down Expand Up @@ -1026,6 +1034,7 @@ public long length() {
* @since 1.2
*/
public boolean createNewFile() throws IOException {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) security.checkWrite(path);
if (isInvalid()) {
Expand Down Expand Up @@ -1053,6 +1062,7 @@ public boolean createNewFile() throws IOException {
* delete access to the file
*/
public boolean delete() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkDelete(path);
Expand Down Expand Up @@ -1091,6 +1101,7 @@ public boolean delete() {
* @since 1.2
*/
public void deleteOnExit() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkDelete(path);
Expand Down Expand Up @@ -1154,6 +1165,7 @@ public String[] list() {
* the directory
*/
private final String[] normalizedList() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
Expand Down Expand Up @@ -1356,6 +1368,7 @@ public File[] listFiles(FileFilter filter) {
* method does not permit the named directory to be created
*/
public boolean mkdir() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
Expand Down Expand Up @@ -1438,6 +1451,7 @@ public boolean renameTo(File dest) {
if (dest == null) {
throw new NullPointerException();
}
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
Expand Down Expand Up @@ -1477,6 +1491,7 @@ public boolean renameTo(File dest) {
*/
public boolean setLastModified(long time) {
if (time < 0) throw new IllegalArgumentException("Negative time");
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
Expand Down Expand Up @@ -1507,6 +1522,7 @@ public boolean setLastModified(long time) {
* @since 1.2
*/
public boolean setReadOnly() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
Expand Down Expand Up @@ -1550,6 +1566,7 @@ public boolean setReadOnly() {
* @since 1.6
*/
public boolean setWritable(boolean writable, boolean ownerOnly) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
Expand Down Expand Up @@ -1628,6 +1645,7 @@ public boolean setWritable(boolean writable) {
* @since 1.6
*/
public boolean setReadable(boolean readable, boolean ownerOnly) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
Expand Down Expand Up @@ -1709,6 +1727,7 @@ public boolean setReadable(boolean readable) {
* @since 1.6
*/
public boolean setExecutable(boolean executable, boolean ownerOnly) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
Expand Down Expand Up @@ -1772,6 +1791,7 @@ public boolean setExecutable(boolean executable) {
* @since 1.6
*/
public boolean canExecute() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkExec(path);
Expand Down Expand Up @@ -1854,6 +1874,7 @@ public static File[] listRoots() {
* @see FileStore#getTotalSpace
*/
public long getTotalSpace() {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new RuntimePermission("getFileSystemAttributes"));
Expand Down Expand Up @@ -1897,6 +1918,7 @@ public long getTotalSpace() {
* @see FileStore#getUnallocatedSpace
*/
public long getFreeSpace() {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new RuntimePermission("getFileSystemAttributes"));
Expand Down Expand Up @@ -1943,6 +1965,7 @@ public long getFreeSpace() {
* @see FileStore#getUsableSpace
*/
public long getUsableSpace() {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new RuntimePermission("getFileSystemAttributes"));
Expand Down Expand Up @@ -1977,6 +2000,7 @@ private static int shortenSubName(int subNameLength, int excess,
}
return subNameLength;
}
@SuppressWarnings("removal")
static File generateFile(String prefix, String suffix, File dir)
throws IOException
{
Expand Down Expand Up @@ -2125,6 +2149,7 @@ public static File createTempFile(String prefix, String suffix,

File tmpdir = (directory != null) ? directory
: TempDirectory.location();
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
File f;
do {
Expand Down
Loading