test/jdk/java/lang/String/concat/WithSecurityManager.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff test/jdk/java/lang/String/concat

test/jdk/java/lang/String/concat/WithSecurityManager.java

Print this page




  21  * questions.
  22  */
  23 
  24 import java.security.Permission;
  25 
  26 /**
  27  * @test
  28  * @summary String concatenation fails with a custom SecurityManager that uses concatenation
  29  * @bug 8155090 8158851
  30  *
  31  * @compile WithSecurityManager.java
  32  *
  33  * @run main/othervm -Xverify:all WithSecurityManager
  34  * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                  WithSecurityManager
  35  * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED            WithSecurityManager
  36  * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED            WithSecurityManager
  37  * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT      WithSecurityManager
  38  * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT      WithSecurityManager
  39  * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT  WithSecurityManager
  40  *
  41  * @run main/othervm -Xverify:all --limit-modules=java.base,jdk.internal.vm.compiler WithSecurityManager
  42  * @run main/othervm -Xverify:all --limit-modules=java.base,jdk.internal.vm.compiler -Djava.lang.invoke.stringConcat=BC_SB                  WithSecurityManager
  43  * @run main/othervm -Xverify:all --limit-modules=java.base,jdk.internal.vm.compiler -Djava.lang.invoke.stringConcat=BC_SB_SIZED            WithSecurityManager
  44  * @run main/othervm -Xverify:all --limit-modules=java.base,jdk.internal.vm.compiler -Djava.lang.invoke.stringConcat=MH_SB_SIZED            WithSecurityManager
  45  * @run main/othervm -Xverify:all --limit-modules=java.base,jdk.internal.vm.compiler -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT      WithSecurityManager
  46  * @run main/othervm -Xverify:all --limit-modules=java.base,jdk.internal.vm.compiler -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT      WithSecurityManager
  47  * @run main/othervm -Xverify:all --limit-modules=java.base,jdk.internal.vm.compiler -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT  WithSecurityManager
  48 */
  49 public class WithSecurityManager {
  50     public static void main(String[] args) throws Throwable {
  51         // First time should succeed to bootstrap everything
  52         {
  53             SecurityManager sm = new SecurityManager() {
  54                 @Override
  55                 public void checkPermission(Permission perm) {
  56                     String abc = "abc";
  57                     String full = abc + "def";
  58                 }
  59             };
  60             System.setSecurityManager(sm);
  61             ClassLoader cl = new ClassLoader() {
  62             };
  63         }
  64 
  65         // Second time should succeed to run after bootstrapping
  66         {
  67             SecurityManager sm = new SecurityManager() {


  21  * questions.
  22  */
  23 
  24 import java.security.Permission;
  25 
  26 /**
  27  * @test
  28  * @summary String concatenation fails with a custom SecurityManager that uses concatenation
  29  * @bug 8155090 8158851
  30  *
  31  * @compile WithSecurityManager.java
  32  *
  33  * @run main/othervm -Xverify:all WithSecurityManager
  34  * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                  WithSecurityManager
  35  * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED            WithSecurityManager
  36  * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED            WithSecurityManager
  37  * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT      WithSecurityManager
  38  * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT      WithSecurityManager
  39  * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT  WithSecurityManager
  40  *
  41  * @run main/othervm -Xverify:all --limit-modules=java.base WithSecurityManager
  42  * @run main/othervm -Xverify:all --limit-modules=java.base -Djava.lang.invoke.stringConcat=BC_SB                  WithSecurityManager
  43  * @run main/othervm -Xverify:all --limit-modules=java.base -Djava.lang.invoke.stringConcat=BC_SB_SIZED            WithSecurityManager
  44  * @run main/othervm -Xverify:all --limit-modules=java.base -Djava.lang.invoke.stringConcat=MH_SB_SIZED            WithSecurityManager
  45  * @run main/othervm -Xverify:all --limit-modules=java.base -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT      WithSecurityManager
  46  * @run main/othervm -Xverify:all --limit-modules=java.base -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT      WithSecurityManager
  47  * @run main/othervm -Xverify:all --limit-modules=java.base -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT  WithSecurityManager
  48 */
  49 public class WithSecurityManager {
  50     public static void main(String[] args) throws Throwable {
  51         // First time should succeed to bootstrap everything
  52         {
  53             SecurityManager sm = new SecurityManager() {
  54                 @Override
  55                 public void checkPermission(Permission perm) {
  56                     String abc = "abc";
  57                     String full = abc + "def";
  58                 }
  59             };
  60             System.setSecurityManager(sm);
  61             ClassLoader cl = new ClassLoader() {
  62             };
  63         }
  64 
  65         // Second time should succeed to run after bootstrapping
  66         {
  67             SecurityManager sm = new SecurityManager() {
test/jdk/java/lang/String/concat/WithSecurityManager.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File