8344524: Remove SecurityManager related code from jdk.jlink module

Reviewed-by: alanb, lancea, iris
This commit is contained in:
Jaikiran Pai 2024-11-21 00:55:23 +00:00
parent a599c30171
commit 400eb9b10a
3 changed files with 1 additions and 61 deletions

View File

@ -242,18 +242,6 @@ public final class Jlink {
}
}
/**
* Jlink instance constructor, if a security manager is set, the jlink
* permission is checked.
*/
@SuppressWarnings("removal")
public Jlink() {
if (System.getSecurityManager() != null) {
System.getSecurityManager().
checkPermission(new JlinkPermission("jlink"));
}
}
/**
* Build the image.
*

View File

@ -1,42 +0,0 @@
/*
* Copyright (c) 2015, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.tools.jlink.internal;
import java.security.BasicPermission;
/**
* The permission required to use jlink API. The permission target_name is
* "jlink". e.g.: permission jdk.tools.jlink.plugins.JlinkPermission "jlink";
*
*/
public final class JlinkPermission extends BasicPermission {
private static final long serialVersionUID = -3687912306077727801L;
public JlinkPermission(String name) {
super(name);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2024, 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
@ -44,13 +44,7 @@ public class Main {
* @param args command line arguments
* @return an exit code. 0 means success, non-zero means an error occurred.
*/
@SuppressWarnings("removal")
public static int run(PrintWriter out, PrintWriter err, String... args) {
if (System.getSecurityManager() != null) {
System.getSecurityManager().
checkPermission(new JlinkPermission("jlink"));
}
JlinkTask t = new JlinkTask();
t.setLog(out, err);
return t.run(args);