< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/RedefineCallerClassTest.java

Print this page

 58     public static void main(String[] args) throws Exception {
 59         runTest(RedefineCallerClassTest::test);
 60     }
 61 
 62     static void test() throws Exception {
 63         String topArchiveName = getNewArchiveName();
 64         String appJar = ClassFileInstaller.writeJar("redefine_caller_class.jar", sharedClasses);
 65 
 66         String[] mainArgs = {
 67             "redefineCaller", // redefine caller class only
 68             "useOldInf",      // use old interface only
 69             "both"            // both of the above
 70         };
 71 
 72         for (String mainArg : mainArgs) {
 73             String[] options = {
 74                 "-Xlog:class+load,cds",
 75                 "-XX:+UnlockDiagnosticVMOptions",
 76                 "-XX:+AllowArchivingWithJavaAgent",
 77                 "-javaagent:redefineagent.jar",

 78                 "-cp", appJar, mainClass, mainArg
 79             };
 80 
 81             dump(topArchiveName, options)
 82                 .assertNormalExit(output -> {
 83                     output.shouldHaveExitValue(0);
 84                     if (mainArg.equals("both") || mainArg.equals("useOldInf")) {
 85                         output.shouldContain("Skipping OldProvider: Old class has been linked")
 86                               .shouldMatch("Skipping.SimpleLambda[$][$]Lambda.*0x.*:.*Old.class.has.been.linked");
 87                     }
 88                     if (mainArg.equals("both") || mainArg.equals("redefineCaller")) {
 89                         output.shouldContain("Skipping SimpleLambda: Has been redefined");
 90                     }
 91                 });
 92 
 93             run(topArchiveName, options)
 94                 .assertNormalExit(output -> {
 95                     output.shouldHaveExitValue(0)
 96                           .shouldContain("RedefineCallerClass source: shared objects file (top)")
 97                           .shouldMatch(".class.load. SimpleLambda[$][$]Lambda.*/0x.*source:.*SimpleLambda");

 58     public static void main(String[] args) throws Exception {
 59         runTest(RedefineCallerClassTest::test);
 60     }
 61 
 62     static void test() throws Exception {
 63         String topArchiveName = getNewArchiveName();
 64         String appJar = ClassFileInstaller.writeJar("redefine_caller_class.jar", sharedClasses);
 65 
 66         String[] mainArgs = {
 67             "redefineCaller", // redefine caller class only
 68             "useOldInf",      // use old interface only
 69             "both"            // both of the above
 70         };
 71 
 72         for (String mainArg : mainArgs) {
 73             String[] options = {
 74                 "-Xlog:class+load,cds",
 75                 "-XX:+UnlockDiagnosticVMOptions",
 76                 "-XX:+AllowArchivingWithJavaAgent",
 77                 "-javaagent:redefineagent.jar",
 78                 "-XX:-PreloadSharedClasses",
 79                 "-cp", appJar, mainClass, mainArg
 80             };
 81 
 82             dump(topArchiveName, options)
 83                 .assertNormalExit(output -> {
 84                     output.shouldHaveExitValue(0);
 85                     if (mainArg.equals("both") || mainArg.equals("useOldInf")) {
 86                         output.shouldContain("Skipping OldProvider: Old class has been linked")
 87                               .shouldMatch("Skipping.SimpleLambda[$][$]Lambda.*0x.*:.*Old.class.has.been.linked");
 88                     }
 89                     if (mainArg.equals("both") || mainArg.equals("redefineCaller")) {
 90                         output.shouldContain("Skipping SimpleLambda: Has been redefined");
 91                     }
 92                 });
 93 
 94             run(topArchiveName, options)
 95                 .assertNormalExit(output -> {
 96                     output.shouldHaveExitValue(0)
 97                           .shouldContain("RedefineCallerClass source: shared objects file (top)")
 98                           .shouldMatch(".class.load. SimpleLambda[$][$]Lambda.*/0x.*source:.*SimpleLambda");
< prev index next >