diff options
author | Decebal Suiu <decebal.suiu@gmail.com> | 2023-02-01 21:10:19 +0200 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2023-02-01 21:10:19 +0200 |
commit | 36f77cc63d99ee041aeaac280e74e8900abb3367 (patch) | |
tree | eb0f2bae6dde5a91261fbf12fdff8a6bd8083faf | |
parent | dd42fafa1c6b3d3873dfc54dadcab1b3d6babd06 (diff) | |
download | pf4j-36f77cc63d99ee041aeaac280e74e8900abb3367.tar.gz pf4j-36f77cc63d99ee041aeaac280e74e8900abb3367.zip |
Fix some warnings (javadoc, pom, sonar)
-rw-r--r-- | pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java | 3 | ||||
-rw-r--r-- | pf4j/src/main/java/org/pf4j/AbstractPluginManager.java | 12 | ||||
-rw-r--r-- | pf4j/src/main/java/org/pf4j/ClassLoadingStrategy.java | 12 | ||||
-rw-r--r-- | pf4j/src/main/java/org/pf4j/util/ClassUtils.java | 32 | ||||
-rw-r--r-- | pf4j/src/main/java/org/pf4j/util/StringUtils.java | 2 | ||||
-rw-r--r-- | pom.xml | 6 |
6 files changed, 22 insertions, 45 deletions
diff --git a/pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java b/pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java index 8288ddc..998a29d 100644 --- a/pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java +++ b/pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java @@ -41,7 +41,7 @@ public abstract class AbstractExtensionFinder implements ExtensionFinder, Plugin protected volatile Map<String, ExtensionInfo> extensionInfos; // cache extension infos by class name protected Boolean checkForExtensionDependencies = null; - public AbstractExtensionFinder(PluginManager pluginManager) { + protected AbstractExtensionFinder(PluginManager pluginManager) { this.pluginManager = pluginManager; } @@ -50,7 +50,6 @@ public abstract class AbstractExtensionFinder implements ExtensionFinder, Plugin public abstract Map<String, Set<String>> readClasspathStorages(); @Override - @SuppressWarnings("unchecked") public <T> List<ExtensionWrapper<T>> find(Class<T> type) { log.debug("Finding extensions of extension point '{}'", type.getName()); Map<String, Set<String>> entries = getEntries(); diff --git a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java index d57b12e..f56a94f 100644 --- a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java +++ b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java @@ -113,7 +113,7 @@ public abstract class AbstractPluginManager implements PluginManager { /** * The plugins roots are supplied as comma-separated list by {@code System.getProperty("pf4j.pluginsDir", "plugins")}. */ - public AbstractPluginManager() { + protected AbstractPluginManager() { initialize(); } @@ -122,7 +122,7 @@ public abstract class AbstractPluginManager implements PluginManager { * * @param pluginsRoots the roots to search for plugins */ - public AbstractPluginManager(Path... pluginsRoots) { + protected AbstractPluginManager(Path... pluginsRoots) { this(Arrays.asList(pluginsRoots)); } @@ -131,7 +131,7 @@ public abstract class AbstractPluginManager implements PluginManager { * * @param pluginsRoots the roots to search for plugins */ - public AbstractPluginManager(List<Path> pluginsRoots) { + protected AbstractPluginManager(List<Path> pluginsRoots) { this.pluginsRoots.addAll(pluginsRoots); initialize(); @@ -877,10 +877,10 @@ public abstract class AbstractPluginManager implements PluginManager { return pluginWrapper; } - + /** * creates the plugin wrapper. override this if you want to prevent plugins having full access to the plugin manager - * + * * @return */ protected PluginWrapper createPluginWrapper(PluginDescriptor pluginDescriptor, Path pluginPath, ClassLoader pluginClassLoader) { @@ -933,7 +933,7 @@ public abstract class AbstractPluginManager implements PluginManager { /** * Set to true to allow requires expression to be exactly x.y.z. * The default is false, meaning that using an exact version x.y.z will - * implicitly mean the same as >=x.y.z + * implicitly mean the same as >=x.y.z * * @param exactVersionAllowed set to true or false */ diff --git a/pf4j/src/main/java/org/pf4j/ClassLoadingStrategy.java b/pf4j/src/main/java/org/pf4j/ClassLoadingStrategy.java index 7ef3952..3dfe425 100644 --- a/pf4j/src/main/java/org/pf4j/ClassLoadingStrategy.java +++ b/pf4j/src/main/java/org/pf4j/ClassLoadingStrategy.java @@ -30,32 +30,32 @@ import java.util.List; public class ClassLoadingStrategy { /** - * application(parent) -> plugin -> dependencies + * application(parent) -> plugin -> dependencies */ public static final ClassLoadingStrategy APD = new ClassLoadingStrategy(Arrays.asList(Source.APPLICATION, Source.PLUGIN, Source.DEPENDENCIES)); /** - * application(parent) -> dependencies -> plugin + * application(parent) -> dependencies -> plugin */ public static final ClassLoadingStrategy ADP = new ClassLoadingStrategy(Arrays.asList(Source.APPLICATION, Source.DEPENDENCIES, Source.PLUGIN)); /** - * plugin -> application(parent) -> dependencies + * plugin -> application(parent) -> dependencies */ public static final ClassLoadingStrategy PAD = new ClassLoadingStrategy(Arrays.asList(Source.PLUGIN, Source.APPLICATION, Source.DEPENDENCIES)); /** - * dependencies -> application(parent) -> plugin + * dependencies -> application(parent) -> plugin */ public static final ClassLoadingStrategy DAP = new ClassLoadingStrategy(Arrays.asList(Source.DEPENDENCIES, Source.APPLICATION, Source.PLUGIN)); /** - * dependencies -> plugin -> application(parent) + * dependencies -> plugin -> application(parent) */ public static final ClassLoadingStrategy DPA = new ClassLoadingStrategy(Arrays.asList(Source.DEPENDENCIES, Source.PLUGIN, Source.APPLICATION)); /** - * plugin -> dependencies -> application(parent) + * plugin -> dependencies -> application(parent) */ public static final ClassLoadingStrategy PDA = new ClassLoadingStrategy(Arrays.asList(Source.PLUGIN, Source.DEPENDENCIES, Source.APPLICATION)); diff --git a/pf4j/src/main/java/org/pf4j/util/ClassUtils.java b/pf4j/src/main/java/org/pf4j/util/ClassUtils.java index 97daa27..c64ea47 100644 --- a/pf4j/src/main/java/org/pf4j/util/ClassUtils.java +++ b/pf4j/src/main/java/org/pf4j/util/ClassUtils.java @@ -28,6 +28,8 @@ import java.util.Map; */ public class ClassUtils { + private ClassUtils() {} + public static List<String> getAllInterfacesNames(Class<?> aClass) { return toString(getAllInterfaces(aClass)); } @@ -56,26 +58,6 @@ public class ClassUtils { return list; } - /* - public static List<String> getAllAbstractClassesNames(Class<?> aClass) { - return toString(getAllInterfaces(aClass)); - } - - public static List getAllAbstractClasses(Class aClass) { - List<Class<?>> list = new ArrayList<>(); - - Class<?> superclass = aClass.getSuperclass(); - while (superclass != null) { - if (Modifier.isAbstract(superclass.getModifiers())) { - list.add(superclass); - } - superclass = superclass.getSuperclass(); - } - - return list; - } - */ - /** * Get a certain annotation of a {@link TypeElement}. * See <a href="https://stackoverflow.com/a/10167558">stackoverflow.com</a> for more information. @@ -96,13 +78,6 @@ public class ClassUtils { return null; } - /* - public static Element getAnnotationMirrorElement(TypeElement typeElement, Class<?> annotationClass) { - AnnotationMirror annotationMirror = getAnnotationMirror(typeElement, annotationClass); - return annotationMirror != null ? annotationMirror.getAnnotationType().asElement() : null; - } - */ - /** * Get a certain parameter of an {@link AnnotationMirror}. * See <a href="https://stackoverflow.com/a/10167558">stackoverflow.com</a> for more information. @@ -139,9 +114,6 @@ public class ClassUtils { /** * Uses {@link Class#getSimpleName()} to convert from {@link Class} to {@link String}. - * - * @param classes - * @return */ private static List<String> toString(List<Class<?>> classes) { List<String> list = new ArrayList<>(); diff --git a/pf4j/src/main/java/org/pf4j/util/StringUtils.java b/pf4j/src/main/java/org/pf4j/util/StringUtils.java index 72087ca..aa84ff4 100644 --- a/pf4j/src/main/java/org/pf4j/util/StringUtils.java +++ b/pf4j/src/main/java/org/pf4j/util/StringUtils.java @@ -20,6 +20,8 @@ package org.pf4j.util; */ public class StringUtils { + private StringUtils() {} + public static boolean isNullOrEmpty(String str) { return (str == null) || str.isEmpty(); } @@ -19,7 +19,7 @@ <licenses> <license> <name>The Apache Software License, Version 2.0</name> - <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> + <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> <distribution>repo</distribution> </license> </licenses> @@ -66,6 +66,7 @@ <pluginManagement> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> @@ -74,11 +75,13 @@ </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.6</version> </plugin> @@ -149,6 +152,7 @@ </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> |