test/hotspot/jtreg/compiler/jvmci/SecurityRestrictionsTest.java
changeset 54669 ad45b3802d4e
parent 47216 71c04702a3d5
equal deleted inserted replaced
54668:0bda2308eded 54669:ad45b3802d4e
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    82     private enum TestCase {
    82     private enum TestCase {
    83         NO_SEC_MAN,
    83         NO_SEC_MAN,
    84         NO_JVMCI {
    84         NO_JVMCI {
    85             @Override
    85             @Override
    86             public Class<? extends Throwable> getExpectedException() {
    86             public Class<? extends Throwable> getExpectedException() {
    87                 return InternalError.class;
    87                 return Error.class;
    88             }
    88             }
    89         },
    89         },
    90         ALL_PERM {
    90         ALL_PERM {
    91             @Override
    91             @Override
    92             public SecurityManager getSecurityManager() {
    92             public SecurityManager getSecurityManager() {
   170                         throw new AssertionError(message, e);
   170                         throw new AssertionError(message, e);
   171                     }
   171                     }
   172                 }
   172                 }
   173             };
   173             };
   174             Utils.runAndCheckException(() -> {
   174             Utils.runAndCheckException(() -> {
   175                 try {
   175                 // CompilerToVM::<cinit> provokes CompilerToVM::<init>
   176                     // CompilerToVM::<cinit> provokes CompilerToVM::<init>
   176                 Class.forName("jdk.vm.ci.hotspot.CompilerToVMHelper");
   177                     Class.forName("jdk.vm.ci.hotspot.CompilerToVMHelper");
       
   178                 } catch (ClassNotFoundException e) {
       
   179                     throw new Error("TESTBUG : " + e, e);
       
   180                 }
       
   181             }, exceptionCheck);
   177             }, exceptionCheck);
   182         }
   178         }
   183 
   179 
   184         public SecurityManager getSecurityManager() {
   180         public SecurityManager getSecurityManager() {
   185             return null;
   181             return null;