Browse Source

Fix some warnings (javadoc, pom, sonar)

pull/515/head
Decebal Suiu 2 years ago
parent
commit
36f77cc63d
  1. 3
      pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java
  2. 8
      pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
  3. 12
      pf4j/src/main/java/org/pf4j/ClassLoadingStrategy.java
  4. 32
      pf4j/src/main/java/org/pf4j/util/ClassUtils.java
  5. 2
      pf4j/src/main/java/org/pf4j/util/StringUtils.java
  6. 6
      pom.xml

3
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();

8
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();
@ -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 &gt;=x.y.z
*
* @param exactVersionAllowed set to true or false
*/

12
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) -&gt; plugin -&gt; dependencies
*/
public static final ClassLoadingStrategy APD = new ClassLoadingStrategy(Arrays.asList(Source.APPLICATION, Source.PLUGIN, Source.DEPENDENCIES));
/**
* application(parent) -> dependencies -> plugin
* application(parent) -&gt; dependencies -&gt; plugin
*/
public static final ClassLoadingStrategy ADP = new ClassLoadingStrategy(Arrays.asList(Source.APPLICATION, Source.DEPENDENCIES, Source.PLUGIN));
/**
* plugin -> application(parent) -> dependencies
* plugin -&gt; application(parent) -&gt; dependencies
*/
public static final ClassLoadingStrategy PAD = new ClassLoadingStrategy(Arrays.asList(Source.PLUGIN, Source.APPLICATION, Source.DEPENDENCIES));
/**
* dependencies -> application(parent) -> plugin
* dependencies -&gt; application(parent) -&gt; plugin
*/
public static final ClassLoadingStrategy DAP = new ClassLoadingStrategy(Arrays.asList(Source.DEPENDENCIES, Source.APPLICATION, Source.PLUGIN));
/**
* dependencies -> plugin -> application(parent)
* dependencies -&gt; plugin -&gt; application(parent)
*/
public static final ClassLoadingStrategy DPA = new ClassLoadingStrategy(Arrays.asList(Source.DEPENDENCIES, Source.PLUGIN, Source.APPLICATION));
/**
* plugin -> dependencies -> application(parent)
* plugin -&gt; dependencies -&gt; application(parent)
*/
public static final ClassLoadingStrategy PDA = new ClassLoadingStrategy(Arrays.asList(Source.PLUGIN, Source.DEPENDENCIES, Source.APPLICATION));

32
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<>();

2
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();
}

6
pom.xml

@ -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>

Loading…
Cancel
Save