test/hotspot/jtreg/runtime/RedefineObject/WalkThroughInvoke.java
author mullan
Wed, 04 Apr 2018 11:26:10 -0400
changeset 49520 7a64b48586d8
parent 47216 71c04702a3d5
permissions -rw-r--r--
8193032: Remove terminally deprecated SecurityManager APIs Summary: Remove the checkTopLevelWindow, checkSystemClipboardAccess, checkAwtEventQueueAccess, and checkMemberAccess methods. Reviewed-by: alanb, mchung, kcr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19278
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
     1
/*
49520
7a64b48586d8 8193032: Remove terminally deprecated SecurityManager APIs
mullan
parents: 47216
diff changeset
     2
 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
19278
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
     4
 *
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
     8
 *
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    13
 * accompanied this code).
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    14
 *
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    18
 *
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    21
 * questions.
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    22
 */
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    23
import java.lang.reflect.*;
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    24
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    25
public class WalkThroughInvoke {
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    26
  public void stackWalk() {
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    27
      try {
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    28
          Class b = Object.class;
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    29
          SecurityManager sm = new SecurityManager();
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    30
          // Walks the stack with Method.invoke in the stack (which is the
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    31
          // purpose of the test) before it gets an AccessControlException.
49520
7a64b48586d8 8193032: Remove terminally deprecated SecurityManager APIs
mullan
parents: 47216
diff changeset
    32
          sm.checkPermission(new RuntimePermission("accessDeclaredMembers"));
19278
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    33
      } catch (java.security.AccessControlException e) {
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    34
          // Ignoring an 'AccessControlException' exception since
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    35
          // it is expected as part of this test.
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    36
      }
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    37
  }
c4355bebb414 8009728: nsk/jvmti/AttachOnDemand/attach030 crashes on Win32
coleenp
parents:
diff changeset
    38
};