From 02cfdc2061d5a0b43431fd4b32159ec034d87916 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 7 Apr 2017 08:05:54 +0000 Subject: [PATCH] 8177530: Module system implementation refresh (4/2017) Co-authored-by: Mandy Chung Reviewed-by: mchung, alanb --- jdk/make/mapfiles/libjava/mapfile-vers | 12 +- .../classes/java/io/ObjectInputFilter.java | 2 +- .../share/classes/java/lang/Class.java | 72 +++-- .../share/classes/java/lang/ClassLoader.java | 5 +- .../LayerInstantiationException.java | 9 +- .../java/lang/{reflect => }/Module.java | 261 +++++++++--------- .../{reflect/Layer.java => ModuleLayer.java} | 155 +++++------ .../share/classes/java/lang/NamedPackage.java | 1 - .../share/classes/java/lang/Package.java | 1 - .../classes/java/lang/SecurityManager.java | 4 +- .../classes/java/lang/StackTraceElement.java | 8 +- .../share/classes/java/lang/System.java | 83 ++++-- .../java/lang/{reflect => }/WeakPairMap.java | 2 +- .../classes/java/lang/invoke/MemberName.java | 1 - .../java/lang/invoke/MethodHandles.java | 5 +- .../java/lang/module/Configuration.java | 12 +- .../java/lang/module/ModuleDescriptor.java | 10 +- .../java/lang/module/ModuleFinder.java | 34 +-- .../classes/java/lang/module/Resolver.java | 47 +++- .../java/lang/module/package-info.java | 10 +- .../classes/java/lang/reflect/Proxy.java | 8 +- .../java/lang/reflect/package-info.java | 11 +- .../classes/java/util/ResourceBundle.java | 1 - .../classes/java/util/ServiceLoader.java | 72 +++-- .../spi/AbstractResourceBundleProvider.java | 1 - .../javax/crypto/JceSecurityManager.java | 1 - .../jdk/internal/loader/BootLoader.java | 7 +- .../jdk/internal/loader/ClassLoaders.java | 1 - .../classes/jdk/internal/loader/Loader.java | 17 +- .../jdk/internal/loader/LoaderPool.java | 5 +- .../internal/logger/DefaultLoggerFinder.java | 1 - .../jdk/internal/logger/LazyLoggers.java | 5 +- .../jdk/internal/misc/JavaLangAccess.java | 82 +++++- .../misc/JavaLangReflectModuleAccess.java | 121 -------- .../misc/JavaUtilResourceBundleAccess.java | 1 - .../jdk/internal/misc/SharedSecrets.java | 11 - .../internal/module/IllegalAccessLogger.java | 1 - .../jdk/internal/module/ModuleBootstrap.java | 21 +- .../jdk/internal/module/ModulePatcher.java | 20 +- .../jdk/internal/module/ModulePath.java | 17 +- .../classes/jdk/internal/module/Modules.java | 49 +--- .../jdk/internal/module/ServicesCatalog.java | 1 - .../classes/sun/invoke/util/VerifyAccess.java | 1 - .../classes/sun/launcher/LauncherHelper.java | 157 ++++++----- .../classes/sun/reflect/misc/MethodUtil.java | 1 - .../java.base/share/native/libjava/Module.c | 22 +- .../javax/imageio/metadata/IIOMetadata.java | 1 - .../imageio/spi/ImageReaderWriterSpi.java | 1 - .../classes/javax/swing/text/PlainView.java | 1 - .../lang/instrument/ClassFileTransformer.java | 1 - .../java/lang/instrument/Instrumentation.java | 21 +- .../UnmodifiableModuleException.java | 56 ++++ .../sun/instrument/InstrumentationImpl.java | 15 +- .../sun/instrument/TransformerManager.java | 2 - .../share/native/libinstrument/JPLISAgent.h | 2 +- .../classes/java/util/logging/Level.java | 2 +- .../classes/java/util/logging/LogManager.java | 2 - .../classes/java/util/logging/Logger.java | 2 - .../logging/internal/LoggingProviderImpl.java | 1 - .../management/remote/rmi/RMIConnector.java | 1 - .../remote/JMXConnectorFactory.java | 1 - .../management/ManagementFactoryHelper.java | 4 +- .../sun/naming/internal/VersionHelper.java | 2 +- .../activation/ActivationInstantiator.java | 4 +- .../java/rmi/server/UnicastRemoteObject.java | 4 +- .../sun/security/pkcs11/P11KeyStore.java | 2 +- .../sun/security/pkcs11/SunPKCS11.java | 8 +- .../tools/common/ProcessArgumentMatcher.java | 1 - .../native/libjdwp/ModuleReferenceImpl.c | 8 +- .../jdk/tools/jlink/internal/Jlink.java | 7 +- .../jlink/internal/PluginRepository.java | 11 +- .../jdk/tools/jlink/internal/TaskHelper.java | 11 +- .../jdk/tools/jlink/internal/Utils.java | 1 - .../internal/plugins/ReleaseInfoPlugin.java | 35 ++- jdk/test/TEST.ROOT | 4 +- .../awt/TrayIcon/SystemTrayIconHelper.java | 4 +- .../java.desktop/java/awt/Helper.java | 1 - jdk/test/java/awt/regtesthelpers/Util.java | 2 +- jdk/test/java/lang/Class/GetModuleTest.java | 1 - .../lang/Class/forName/modules/TestLayer.java | 6 +- .../lang/Class/forName/modules/TestMain.java | 4 +- .../forName/modules/src/m2/p2/test/Main.java | 5 +- .../forName/modules/src/m3/p3/NoAccess.java | 6 +- .../src/m3/p3/NoGetClassLoaderAccess.java | 4 +- .../FieldSetAccessibleTest.java | 4 +- .../java/lang/Class/getResource/Main.java | 3 +- .../getResource/automaticmodules/Main.java | 3 +- .../ClassLoader/getResource/modules/Main.java | 3 +- .../Layer => ModuleLayer}/BasicLayerTest.java | 192 +++++++------ .../LayerAndLoadersTest.java | 81 +++--- .../LayerControllerTest.java | 28 +- .../Layer => ModuleLayer}/layertest/Test.java | 2 +- .../src/m1/module-info.java | 0 .../Layer => ModuleLayer}/src/m1/p/Main.java | 0 .../src/m1/p/Service.java | 0 .../src/m2/module-info.java | 0 .../Layer => ModuleLayer}/src/m2/q/Hello.java | 0 .../src/m3/module-info.java | 0 .../Layer => ModuleLayer}/src/m3/w/Hello.java | 0 .../src/m4/impl/ServiceImpl.java | 0 .../src/m4/module-info.java | 0 .../AddExportsTest.java | 4 +- .../AnnotationsTest.java | 8 +- .../BasicModuleTest.java | 27 +- .../WithSecurityManager.java | 12 +- .../access/AccessTest.java | 0 .../access/src/target/module-info.java | 0 .../access/src/target/p1/Helper.java | 2 - .../access/src/target/p1/Public.java | 0 .../access/src/target/p2/NonPublic.java | 0 .../access/src/target/q1/Public.java | 0 .../access/src/target/q2/NonPublic.java | 0 .../access/src/test/module-info.java | 0 .../access/src/test/test/Main.java | 4 +- .../Module => ModuleTests}/addXXX/Driver.java | 0 .../addXXX/m1/module-info.java | 0 .../addXXX/m1/p1/C.java | 0 .../addXXX/m2/module-info.java | 0 .../addXXX/m2/p2/C.java | 2 - .../addXXX/m2/p2/internal/C.java | 0 .../addXXX/m3/module-info.java | 0 .../addXXX/m3/p3/C.java | 0 .../addXXX/m4/module-info.java | 0 .../addXXX/m4/p4/C.java | 0 .../addXXX/test/module-info.java | 0 .../addXXX/test/test/C.java | 0 .../addXXX/test/test/Main.java | 1 - .../addXXX/test/test/Service.java | 0 .../Module => ModuleTests}/allow.policy | 0 .../annotation/Basic.java | 1 - .../annotation/src/m/module-info.java | 0 .../annotation/src/m/p/annotation/Bar.java | 0 .../annotation/src/m/p/annotation/Baz.java | 0 .../annotation/src/m/p/annotation/Foo.java | 0 .../SecurityManager/CheckPackageAccess.java | 3 +- .../CheckSecurityProvider.java | 3 +- .../lang/SecurityManager/modules/Test.java | 2 - .../StackTraceElement/PublicConstructor.java | 1 - .../lib/m1/com/app/Utils.java | 1 - .../Logger/custom/CustomLoggerTest.java | 1 - .../BaseLoggerFinder.java | 1 - .../TestLoggerFinder.java | 1 - .../LoggerFinderAPI/LoggerFinderAPI.java | 1 - .../BaseDefaultLoggerFinderTest.java | 1 - .../BaseLoggerBridgeTest.java | 1 - .../BasePlatformLoggerTest.java | 1 - .../BootstrapLoggerAPIsTest.java | 1 - .../BootstrapLogger/BootstrapLoggerTest.java | 1 - .../LoggerBridgeTest/LoggerBridgeTest.java | 1 - .../LoggerFinderLoaderTest.java | 1 - .../PlatformLoggerBridgeTest.java | 1 - .../SystemLoggerInPlatformLoader.java | 3 +- .../backend/LoggerFinderBackendTest.java | 1 - .../DefaultLoggerBridgeTest.java | 1 - .../{reflect => }/WeakPairMap/Driver.java | 4 +- .../java.base/java/lang}/WeakPairMapTest.java | 2 +- .../ATransformerManagementTestCase.java | 2 - .../instrument/BootstrapClassPathAgent.java | 1 - .../instrument/BootstrapClassPathTest.java | 1 - .../RedefineClassWithNativeMethodAgent.java | 1 - .../lang/instrument/RedefineModuleAgent.java | 7 +- .../lang/instrument/RedefineModuleTest.java | 29 +- .../lang/instrument/RetransformAgent.java | 1 - .../instrument/SimpleIdentityTransformer.java | 1 - .../test/p/PrivateLookupInTests.java | 1 - .../java/lang/invoke/modules/m1/p1/Main.java | 6 +- .../lang/module/AutomaticModulesTest.java | 255 ++++++++++++++--- .../java/lang/module/ConfigurationTest.java | 15 +- .../lang/module/ModuleDescriptorTest.java | 1 - .../java/lang/module/ModuleFinderTest.java | 24 ++ .../module/ModuleReader/ModuleReaderTest.java | 1 - .../ModuleSetAccessibleTest.java | 1 - .../reflect/Proxy/ProxyClassAccessTest.java | 5 +- .../reflect/Proxy/ProxyForMethodHandle.java | 1 - .../lang/reflect/Proxy/ProxyLayerTest.java | 15 +- .../reflect/Proxy/ProxyModuleMapping.java | 1 - .../reflect/Proxy/src/test/jdk/test/Main.java | 1 - .../Proxy/src/test/jdk/test/ProxyTest.java | 1 - .../Provider/DefaultProviderList.java | 1 - .../modules/cache/src/test/jdk/test/Main.java | 3 +- .../security/src/test/jdk/test/Main.java | 1 - .../jdk/embargo/TestWithNoModuleArg.java | 1 - .../jdk/embargo/TestWithUnnamedModuleArg.java | 1 - .../visibility/src/pkg/jdk/pkg/test/Main.java | 1 - .../test/jdk/test/TestWithNoModuleArg.java | 1 - .../jdk/test/TestWithUnnamedModuleArg.java | 1 - .../modules/BadProvidersTest.java | 5 +- .../util/ServiceLoader/modules/Basic.java | 26 +- .../java/util/logging/LocalizedLevelName.java | 1 - .../pkgs/p3/test/ResourceBundleTest.java | 1 - .../test/jdk/test/ResourceBundleDelegate.java | 1 - .../CheckEncodingPropertiesFile.java | 1 - .../jdk/internal/jimage/JImageOpenTest.java | 3 +- .../modules/etc/JdkQualifiedExportTest.java | 1 - .../modules/etc/VerifyModuleDelegation.java | 6 +- .../jdk/modules/incubator/DefaultImage.java | 41 ++- .../jdk/modules/incubator/ImageModules.java | 11 +- .../src/cp/listmods/ListModules.java | 4 +- .../src/cp/test/ConvertToLowerCase.java | 4 +- .../incubator/src/cp/test/WriteUpperCase.java | 4 +- jdk/test/jdk/modules/open/Basic.java | 1 - .../src/basictest/test/Main.java | 7 +- .../src/sptest/test/Main.java | 6 +- .../src/container/container/Main.java | 10 +- .../test/loggerfinder/TestLoggerFinder.java | 1 - .../sun/tools/jconsole/ResourceCheckTest.java | 1 - jdk/test/tools/jar/modularJar/Basic.java | 2 +- .../modularJar/src/bar/jdk/test/bar/Bar.java | 1 - jdk/test/tools/jlink/JLink2Test.java | 3 +- jdk/test/tools/jlink/JLinkTest.java | 3 +- .../jlink/basic/src/test/jdk/test/Test.java | 5 +- .../jlink/plugins/PluginsNegativeTest.java | 7 +- .../UserModuleTest.java | 1 - .../src/m1/p1/Main.java | 2 - .../src/m3/p3/Main.java | 1 - .../src/m4/p4/Main.java | 3 +- .../src/m5/p5/Main.java | 3 +- .../src/test/jdk/test/Main.java | 4 +- .../launcher/modules/dryrun/DryRunTest.java | 16 -- .../modules/listmods/ListModsTest.java | 2 +- .../patch/basic/src/test/jdk/test/Main.java | 2 - .../src/test/jdk/test/Main.java | 3 +- 222 files changed, 1364 insertions(+), 1233 deletions(-) rename jdk/src/java.base/share/classes/java/lang/{reflect => }/LayerInstantiationException.java (93%) rename jdk/src/java.base/share/classes/java/lang/{reflect => }/Module.java (89%) rename jdk/src/java.base/share/classes/java/lang/{reflect/Layer.java => ModuleLayer.java} (88%) rename jdk/src/java.base/share/classes/java/lang/{reflect => }/WeakPairMap.java (99%) delete mode 100644 jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangReflectModuleAccess.java create mode 100644 jdk/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableModuleException.java rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/BasicLayerTest.java (85%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/LayerAndLoadersTest.java (88%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/LayerControllerTest.java (88%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/layertest/Test.java (95%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m1/module-info.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m1/p/Main.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m1/p/Service.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m2/module-info.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m2/q/Hello.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m3/module-info.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m3/w/Hello.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m4/impl/ServiceImpl.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m4/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/AddExportsTest.java (97%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/AnnotationsTest.java (95%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/BasicModuleTest.java (93%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/WithSecurityManager.java (92%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/AccessTest.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/target/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/target/p1/Helper.java (97%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/target/p1/Public.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/target/p2/NonPublic.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/target/q1/Public.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/target/q2/NonPublic.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/test/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/test/test/Main.java (99%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/Driver.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m1/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m1/p1/C.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m2/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m2/p2/C.java (97%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m2/p2/internal/C.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m3/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m3/p3/C.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m4/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m4/p4/C.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/test/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/test/test/C.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/test/test/Main.java (99%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/test/test/Service.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/allow.policy (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/annotation/Basic.java (98%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/annotation/src/m/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/annotation/src/m/p/annotation/Bar.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/annotation/src/m/p/annotation/Baz.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/annotation/src/m/p/annotation/Foo.java (100%) rename jdk/test/java/lang/{reflect => }/WeakPairMap/Driver.java (91%) rename jdk/test/java/lang/{reflect/WeakPairMap/java.base/java/lang/reflect => WeakPairMap/java.base/java/lang}/WeakPairMapTest.java (99%) diff --git a/jdk/make/mapfiles/libjava/mapfile-vers b/jdk/make/mapfiles/libjava/mapfile-vers index b7773925154..31395f7ee23 100644 --- a/jdk/make/mapfiles/libjava/mapfile-vers +++ b/jdk/make/mapfiles/libjava/mapfile-vers @@ -273,12 +273,12 @@ SUNWprivate_1.1 { Java_jdk_internal_misc_VM_getRuntimeArguments; Java_jdk_internal_misc_VM_initialize; - Java_java_lang_reflect_Module_defineModule0; - Java_java_lang_reflect_Module_addReads0; - Java_java_lang_reflect_Module_addExports0; - Java_java_lang_reflect_Module_addExportsToAll0; - Java_java_lang_reflect_Module_addExportsToAllUnnamed0; - Java_java_lang_reflect_Module_addPackage0; + Java_java_lang_Module_defineModule0; + Java_java_lang_Module_addReads0; + Java_java_lang_Module_addExports0; + Java_java_lang_Module_addExportsToAll0; + Java_java_lang_Module_addExportsToAllUnnamed0; + Java_java_lang_Module_addPackage0; Java_jdk_internal_loader_BootLoader_getSystemPackageLocation; Java_jdk_internal_loader_BootLoader_getSystemPackageNames; diff --git a/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java b/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java index f9bbf1178ec..534e1b2b8de 100644 --- a/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java +++ b/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java @@ -322,7 +322,7 @@ public interface ObjectInputFilter { * Other patterns match or reject class or package name * as returned from {@link Class#getName() Class.getName()} and * if an optional module name is present - * {@link java.lang.reflect.Module#getName() class.getModule().getName()}. + * {@link Module#getName() class.getModule().getName()}. * Note that for arrays the element type is used in the pattern, * not the array type. *