9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @summary Ensure that a package whose module has not been defined to the boot loader 27 * is correctly located with -Xbootclasspath/a 28 * @requires !(os.family == "windows") 29 * @library /testlibrary 30 * @modules java.base/jdk.internal.misc 31 * java.management 32 * @run main/othervm XbootcpVisibility 33 */ 34 35 import java.io.File; 36 import java.nio.file.Files; 37 import java.nio.file.Paths; 38 39 import jdk.test.lib.*; 40 41 public class XbootcpVisibility { 42 43 public static void main(String[] args) throws Throwable { 44 45 String Vis1_B_src = 46 "package p2;" + 47 "public class Vis1_B { public void m() { System.out.println(\"In B's m()\"); } }"; 48 49 ClassFileInstaller.writeClassToDisk("p2/Vis1_B", 50 InMemoryJavaCompiler.compile("p2.Vis1_B", Vis1_B_src), System.getProperty("test.classes")); 51 ClassFileInstaller.writeClassToDisk("p2/Vis1_B", "mods1"); 52 53 String Vis1_C_src = 54 "package p2;" + 55 "public class Vis1_C { public void m() { System.out.println(\"In C's m()\"); } }"; 56 57 ClassFileInstaller.writeClassToDisk("p2/Vis1_C", 58 InMemoryJavaCompiler.compile("p2.Vis1_C", Vis1_C_src), System.getProperty("test.classes")); 59 ClassFileInstaller.writeClassToDisk("p2/Vis1_C", "mods1"); | 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @summary Ensure that a package whose module has not been defined to the boot loader 27 * is correctly located with -Xbootclasspath/a 28 * @requires !(os.family == "windows") 29 * @library /test/lib 30 * @modules java.base/jdk.internal.misc 31 * java.management 32 * @run main/othervm XbootcpVisibility 33 */ 34 35 import java.io.File; 36 import java.nio.file.Files; 37 import java.nio.file.Paths; 38 39 import jdk.test.lib.InMemoryJavaCompiler; 40 import jdk.test.lib.process.OutputAnalyzer; 41 import jdk.test.lib.process.ProcessTools; 42 43 public class XbootcpVisibility { 44 45 public static void main(String[] args) throws Throwable { 46 47 String Vis1_B_src = 48 "package p2;" + 49 "public class Vis1_B { public void m() { System.out.println(\"In B's m()\"); } }"; 50 51 ClassFileInstaller.writeClassToDisk("p2/Vis1_B", 52 InMemoryJavaCompiler.compile("p2.Vis1_B", Vis1_B_src), System.getProperty("test.classes")); 53 ClassFileInstaller.writeClassToDisk("p2/Vis1_B", "mods1"); 54 55 String Vis1_C_src = 56 "package p2;" + 57 "public class Vis1_C { public void m() { System.out.println(\"In C's m()\"); } }"; 58 59 ClassFileInstaller.writeClassToDisk("p2/Vis1_C", 60 InMemoryJavaCompiler.compile("p2.Vis1_C", Vis1_C_src), System.getProperty("test.classes")); 61 ClassFileInstaller.writeClassToDisk("p2/Vis1_C", "mods1"); |