mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-11 05:59:52 +00:00
8174194: Several java/lang tests failing due to undeclared module dependencies
Reviewed-by: dfuchs, mchung
This commit is contained in:
parent
9d0a07ff25
commit
73a2915d57
@ -33,6 +33,7 @@
|
||||
|
||||
import java.lang.module.ModuleFinder;
|
||||
import java.lang.module.ModuleReference;
|
||||
import java.lang.reflect.Layer;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@ -80,25 +81,33 @@ public class CheckPackageAccess {
|
||||
}
|
||||
|
||||
void test() {
|
||||
System.out.println("Testing module " + moduleName);
|
||||
final boolean isModulePresent =
|
||||
Layer.boot().findModule(moduleName).isPresent();
|
||||
System.out.format("Testing module: %1$s. Module is%2$s present.\n",
|
||||
moduleName, isModulePresent ? "" : " NOT");
|
||||
|
||||
// access to exported pkg should pass
|
||||
testNonRestricted(exports);
|
||||
if (isModulePresent) {
|
||||
|
||||
// access to opened pkg should pass
|
||||
opens.ifPresent(Test::testNonRestricted);
|
||||
// access to exported pkg should pass
|
||||
testNonRestricted(exports);
|
||||
|
||||
// access to concealed pkg should fail
|
||||
testRestricted(conceals);
|
||||
// access to opened pkg should pass
|
||||
opens.ifPresent(Test::testNonRestricted);
|
||||
|
||||
// access to qualified export pkg should fail
|
||||
qualExports.ifPresent(Test::testRestricted);
|
||||
// access to concealed pkg should fail
|
||||
testRestricted(conceals);
|
||||
|
||||
// access to qualified open pkg should fail
|
||||
qualOpens.ifPresent(Test::testRestricted);
|
||||
// access to qualified export pkg should fail
|
||||
qualExports.ifPresent(Test::testRestricted);
|
||||
|
||||
// access to qualified opened pkg that is also exported should pass
|
||||
qualOpensAndExports.ifPresent(Test::testNonRestricted);
|
||||
// access to qualified open pkg should fail
|
||||
qualOpens.ifPresent(Test::testRestricted);
|
||||
|
||||
// access to qualified opened pkg that is also exported should pass
|
||||
qualOpensAndExports.ifPresent(Test::testNonRestricted);
|
||||
} else {
|
||||
System.out.println("Skipping tests for module.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void testRestricted(String pkg) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,6 +26,7 @@
|
||||
* @bug 6479237
|
||||
* @summary Basic test StackTraceElement with class loader names
|
||||
* @library lib /lib/testlibrary
|
||||
* @modules jdk.compiler
|
||||
* @build m1/* WithClassLoaderName
|
||||
* @run main/othervm m1/com.app.Main
|
||||
* @run main/othervm WithClassLoaderName
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,7 +30,7 @@
|
||||
* @library /lib/testlibrary/jsr292 /lib/testlibrary
|
||||
* @modules java.base/java.lang.invoke:open
|
||||
* java.base/java.lang.ref:open
|
||||
* jdk.management
|
||||
* java.management
|
||||
* @build TestMethods
|
||||
* @build LambdaFormTestCase
|
||||
* @build LFCachingTestCase
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,6 +30,7 @@
|
||||
* @library /lib/testlibrary/jsr292 /lib/testlibrary
|
||||
* @modules java.base/java.lang.ref:open
|
||||
* java.base/java.lang.invoke:open
|
||||
* java.management
|
||||
* @build TestMethods
|
||||
* @build LambdaFormTestCase
|
||||
* @build LFCachingTestCase
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,6 +26,7 @@
|
||||
* @bug 8151099
|
||||
* @summary Verify platform MXBeans initialized properly with java.management
|
||||
* module only. No other management provider
|
||||
* @modules java.management
|
||||
* @run main/othervm --limit-modules=java.management DefaultManagementProviderTest
|
||||
*/
|
||||
import java.lang.management.ManagementFactory;
|
||||
|
||||
@ -57,6 +57,9 @@ import static java.util.stream.Collectors.toMap;
|
||||
/*
|
||||
* @test
|
||||
* @bug 8062389
|
||||
* @modules java.compiler
|
||||
* jdk.compiler
|
||||
* jdk.zipfs
|
||||
* @summary Nearly exhaustive test of Class.getMethod() and Class.getMethods()
|
||||
* @run main PublicMethodsTest
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user