hotspot/test/runtime/modules/JVMGetModuleByPkgName.java
changeset 43665 4bb003cad9b9
parent 40631 ed82623d7831
child 44520 0553e129e0ec
equal deleted inserted replaced
43606:a5aa7536131c 43665:4bb003cad9b9
     1 /*
     1 /*
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2017, 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.
    77             throw new RuntimeException(
    77             throw new RuntimeException(
    78                 "Unexpected named module returned for package p2 in unnamed module");
    78                 "Unexpected named module returned for package p2 in unnamed module");
    79         }
    79         }
    80 
    80 
    81         MyClassLoader cl1 = new MyClassLoader();
    81         MyClassLoader cl1 = new MyClassLoader();
    82         Module module1 = (Module)ModuleHelper.ModuleObject("module1", cl1, new String[] { "mypackage" });
    82         Module module_one = (Module)ModuleHelper.ModuleObject("module_one", cl1, new String[] { "mypackage" });
    83         assertNotNull(module1, "Module should not be null");
    83         assertNotNull(module_one, "Module should not be null");
    84         ModuleHelper.DefineModule(module1, "9.0", "module1/here", new String[] { "mypackage" });
    84         ModuleHelper.DefineModule(module_one, "9.0", "module_one/here", new String[] { "mypackage" });
    85         if (ModuleHelper.GetModuleByPackageName(cl1, "mypackage") != module1) {
    85         if (ModuleHelper.GetModuleByPackageName(cl1, "mypackage") != module_one) {
    86             throw new RuntimeException("Wrong module returned for cl1 mypackage");
    86             throw new RuntimeException("Wrong module returned for cl1 mypackage");
    87         }
    87         }
    88     }
    88     }
    89 
    89 
    90     static class MyClassLoader extends ClassLoader { }
    90     static class MyClassLoader extends ClassLoader { }