test/hotspot/jtreg/runtime/appcds/test-classes/DummyClassHelper.java
changeset 54927 1512d88b24c6
parent 48832 f1e8ddd6fdc4
equal deleted inserted replaced
54926:d4e7ccaf1445 54927:1512d88b24c6
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2018, 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.
    22  *
    22  *
    23  */
    23  */
    24 
    24 
    25 import java.lang.*;
    25 import java.lang.*;
    26 import java.lang.reflect.*;
    26 import java.lang.reflect.*;
       
    27 import jdk.test.lib.cds.CDSTestUtils;
    27 import sun.hotspot.WhiteBox;
    28 import sun.hotspot.WhiteBox;
    28 
    29 
    29 public class DummyClassHelper {
    30 public class DummyClassHelper {
    30     static void checkDummyMethod(Class<?> cls, String className) {
    31     static void checkDummyMethod(Class<?> cls, String className) {
    31         Method m = null;
    32         Method m = null;
    48         }
    49         }
    49         for (int i = 0; i < classNames.length; i++) {
    50         for (int i = 0; i < classNames.length; i++) {
    50             cls = Class.forName(classNames[i]);
    51             cls = Class.forName(classNames[i]);
    51             checkDummyMethod(cls, classNames[i]);
    52             checkDummyMethod(cls, classNames[i]);
    52             if (doWBCheck) {
    53             if (doWBCheck) {
    53                 if (!wb.isSharedClass(cls)) {
    54                 // FIXME: for dynamic archive, the class loaded from the
    54                     throw new java.lang.RuntimeException(classNames[i] +
    55                 // bootclasspath jar during dump time is not loaded from the
    55                         ".class should be in shared space.");
    56                 // archive during run time.
       
    57                 if (!CDSTestUtils.isDynamicArchive()) {
       
    58                     if (!wb.isSharedClass(cls)) {
       
    59                         throw new java.lang.RuntimeException(classNames[i] +
       
    60                             ".class should be in shared space.");
       
    61                     }
    56                 }
    62                 }
    57             }
    63             }
    58         }
    64         }
    59     }
    65     }
    60 }
    66 }