Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/misc/URLClassPath/EnableLookupCache.java
38838 views
/*1* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/* @test24* @bug 806165125* @summary -Dsun.cds.enableSharedLookupCache specified on the command-line26* should have no effect.27* @run main/othervm -Dsun.cds.enableSharedLookupCache=true -Xshare:off -Dfoo.foo.bar=xyz EnableLookupCache28*/2930public class EnableLookupCache {31public static void main(String[] args) throws Exception {32// If JVM is started with -Xshare:off, the sun.cds.enableSharedLookupCache33// should never be true, even if it has been explicitly set in the34// command-line.35String prop = "sun.cds.enableSharedLookupCache";36String value = System.getProperty(prop);37System.out.println("System.getProperty(\"" + prop + "\") = \"" + value+ "\"");3839if ("true".equals(value)) {40System.out.println("Test FAILED: system property " + prop +41" is \"true\" (unexpected)");42throw new RuntimeException(prop + " should not be " + value);43}4445// Make sure the -D... arguments in the @run tag are indeed used.46prop = "foo.foo.bar";47value = System.getProperty(prop);48System.out.println("System.getProperty(\"" + prop + "\") = \"" + value+ "\"");49if (!"xyz".equals(value)) {50System.out.println("Test FAILED: system property " + prop +51" should be \"xyz\" -- is JTREG set up properly?");52throw new RuntimeException(prop + " should not be " + value);53}545556// We should be able to load the other classes without issue.57A.test();58B.test();59System.out.println("Test PASSED");60}6162static class A {static void test() {}}63static class B {static void test() {}}64}65666768