This is an automated email from the ASF dual-hosted git repository. chesnay pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit 4308e0c5b4e77e0f5fe0ae09ec8f6c6efc361a2a Author: Alexander Fedulov <[email protected]> AuthorDate: Fri Feb 21 15:46:48 2020 +0100 [FLINK-16222][core] Relax Plugin bounded type parameter constraint --- .../src/main/java/org/apache/flink/core/plugin/PluginLoader.java | 7 +++---- .../src/main/java/org/apache/flink/core/plugin/PluginManager.java | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/flink-core/src/main/java/org/apache/flink/core/plugin/PluginLoader.java b/flink-core/src/main/java/org/apache/flink/core/plugin/PluginLoader.java index 6dbe675..7287399 100644 --- a/flink-core/src/main/java/org/apache/flink/core/plugin/PluginLoader.java +++ b/flink-core/src/main/java/org/apache/flink/core/plugin/PluginLoader.java @@ -20,7 +20,6 @@ package org.apache.flink.core.plugin; import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.util.ArrayUtils; -import org.apache.flink.util.ChildFirstClassLoader; import org.apache.flink.util.TemporaryClassLoaderContext; import javax.annotation.concurrent.ThreadSafe; @@ -35,7 +34,7 @@ import java.util.ServiceLoader; /** * A {@link PluginLoader} is used by the {@link PluginManager} to load a single plugin. It is essentially a combination - * of a {@link ChildFirstClassLoader} and {@link ServiceLoader}. This class can locate and load service implementations + * of a {@link PluginClassLoader} and {@link ServiceLoader}. This class can locate and load service implementations * from the plugin for a given SPI. The {@link PluginDescriptor}, which among other information contains the resource * URLs, is provided at construction. */ @@ -69,7 +68,7 @@ public class PluginLoader { * @param <P> Type of the requested plugin service. * @return An iterator of all implementations of the given service interface that could be loaded from the plugin. */ - public <P extends Plugin> Iterator<P> load(Class<P> service) { + public <P> Iterator<P> load(Class<P> service) { try (TemporaryClassLoaderContext ignored = TemporaryClassLoaderContext.of(pluginClassLoader)) { return new ContextClassLoaderSettingIterator<>( ServiceLoader.load(service, pluginClassLoader).iterator(), @@ -83,7 +82,7 @@ public class PluginLoader { * * @param <P> type of the iterated plugin element. */ - static class ContextClassLoaderSettingIterator<P extends Plugin> implements Iterator<P> { + static class ContextClassLoaderSettingIterator<P> implements Iterator<P> { private final Iterator<P> delegate; private final ClassLoader pluginClassLoader; diff --git a/flink-core/src/main/java/org/apache/flink/core/plugin/PluginManager.java b/flink-core/src/main/java/org/apache/flink/core/plugin/PluginManager.java index 2385732..8d50585 100644 --- a/flink-core/src/main/java/org/apache/flink/core/plugin/PluginManager.java +++ b/flink-core/src/main/java/org/apache/flink/core/plugin/PluginManager.java @@ -63,7 +63,7 @@ public class PluginManager { * @param <P> Type of the requested plugin service. * @return Iterator over all implementations of the given service that could be loaded from all known plugins. */ - public <P extends Plugin> Iterator<P> load(Class<P> service) { + public <P> Iterator<P> load(Class<P> service) { ArrayList<Iterator<P>> combinedIterators = new ArrayList<>(pluginDescriptors.size()); for (PluginDescriptor pluginDescriptor : pluginDescriptors) { PluginLoader pluginLoader = PluginLoader.create(pluginDescriptor, parentClassLoader, alwaysParentFirstPatterns);
