1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package java.lang; 19 20 import java.security.BasicPermission; 21 22 /** 23 * Represents the permission to execute a runtime-related function. There is no 24 * action list associated with a {@code RuntimePermission}; the user either has 25 * the permission or he doesn't. 26 */ 27 public final class RuntimePermission extends BasicPermission { 28 29 private static final long serialVersionUID = 7399184964622342223L; 30 31 /** 32 * Constants for runtime permissions used in this package. 33 */ 34 static final RuntimePermission permissionToSetSecurityManager = new RuntimePermission( 35 "setSecurityManager"); 36 37 static final RuntimePermission permissionToCreateSecurityManager = new RuntimePermission( 38 "createSecurityManager"); 39 40 static final RuntimePermission permissionToGetProtectionDomain = new RuntimePermission( 41 "getProtectionDomain"); 42 43 static final RuntimePermission permissionToGetClassLoader = new RuntimePermission( 44 "getClassLoader"); 45 46 static final RuntimePermission permissionToCreateClassLoader = new RuntimePermission( 47 "createClassLoader"); 48 49 static final RuntimePermission permissionToModifyThread = new RuntimePermission( 50 "modifyThread"); 51 52 static final RuntimePermission permissionToModifyThreadGroup = new RuntimePermission( 53 "modifyThreadGroup"); 54 55 static final RuntimePermission permissionToExitVM = new RuntimePermission( 56 "exitVM"); 57 58 static final RuntimePermission permissionToReadFileDescriptor = new RuntimePermission( 59 "readFileDescriptor"); 60 61 static final RuntimePermission permissionToWriteFileDescriptor = new RuntimePermission( 62 "writeFileDescriptor"); 63 64 static final RuntimePermission permissionToQueuePrintJob = new RuntimePermission( 65 "queuePrintJob"); 66 67 static final RuntimePermission permissionToSetFactory = new RuntimePermission( 68 "setFactory"); 69 70 static final RuntimePermission permissionToSetIO = new RuntimePermission( 71 "setIO"); 72 73 static final RuntimePermission permissionToStopThread = new RuntimePermission( 74 "stopThread"); 75 76 static final RuntimePermission permissionToSetContextClassLoader = new RuntimePermission( 77 "setContextClassLoader"); 78 79 /** 80 * Creates an instance of {@code RuntimePermission} with the specified name. 81 * 82 * @param permissionName 83 * the name of the new permission. 84 */ RuntimePermission(String permissionName)85 public RuntimePermission(String permissionName) { 86 super(permissionName); 87 } 88 89 /** 90 * Creates an instance of {@code RuntimePermission} with the specified name 91 * and action list. The action list is ignored. 92 * 93 * @param name 94 * the name of the new permission. 95 * @param actions 96 * ignored. 97 */ RuntimePermission(String name, String actions)98 public RuntimePermission(String name, String actions) { 99 super(name, actions); 100 } 101 } 102