test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff test/hotspot/jtreg/runtime/appcds

test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java

Print this page




  62 
  63 
  64         // Make sure a class in a prohibited package for a non-custom loader
  65         // will be ignored during dumping.
  66         TestCommon.dump(appJar,
  67                         TestCommon.list("java/lang/Prohibited", "ProhibitedHelper"),
  68                         "-Xlog:class+load")
  69             .shouldContain("Dumping")
  70             .shouldNotContain("[info][class,load] java.lang.Prohibited source: ")
  71             .shouldHaveExitValue(0);
  72 
  73         // Try loading the class in a prohibited package with various -Xshare
  74         // modes. The class shouldn't be loaded and appropriate exceptions
  75         // are expected.
  76 
  77         OutputAnalyzer output;
  78 
  79         // -Xshare:on
  80         TestCommon.run(
  81             "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
  82             "-cp", appJar, "-Xlog:class+load=info", "ProhibitedHelper")
  83           .assertNormalExit("Prohibited package name: java.lang");
  84 
  85         // -Xshare:auto
  86         output = TestCommon.execAuto(
  87             "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
  88             "-cp", appJar, "-Xlog:class+load=info", "ProhibitedHelper");
  89         CDSOptions opts = (new CDSOptions()).setXShareMode("auto");
  90         TestCommon.checkExec(output, opts, "Prohibited package name: java.lang");
  91 
  92         // -Xshare:off
  93         output = TestCommon.execOff(
  94             "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
  95             "-cp", appJar, "-Xlog:class+load=info", "ProhibitedHelper");
  96         output.shouldContain("Prohibited package name: java.lang");
  97     }
  98 }


  62 
  63 
  64         // Make sure a class in a prohibited package for a non-custom loader
  65         // will be ignored during dumping.
  66         TestCommon.dump(appJar,
  67                         TestCommon.list("java/lang/Prohibited", "ProhibitedHelper"),
  68                         "-Xlog:class+load")
  69             .shouldContain("Dumping")
  70             .shouldNotContain("[info][class,load] java.lang.Prohibited source: ")
  71             .shouldHaveExitValue(0);
  72 
  73         // Try loading the class in a prohibited package with various -Xshare
  74         // modes. The class shouldn't be loaded and appropriate exceptions
  75         // are expected.
  76 
  77         OutputAnalyzer output;
  78 
  79         // -Xshare:on
  80         TestCommon.run(
  81             "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
  82             "-cp", appJar, "ProhibitedHelper")
  83           .assertNormalExit("Prohibited package name: java.lang");
  84 
  85         // -Xshare:auto
  86         output = TestCommon.execAuto(
  87             "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
  88             "-cp", appJar, "ProhibitedHelper");
  89         CDSOptions opts = (new CDSOptions()).setXShareMode("auto");
  90         TestCommon.checkExec(output, opts, "Prohibited package name: java.lang");
  91 
  92         // -Xshare:off
  93         output = TestCommon.execOff(
  94             "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
  95             "-cp", appJar, "ProhibitedHelper");
  96         output.shouldContain("Prohibited package name: java.lang");
  97     }
  98 }
test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File