Browse Source

Fix some warnings (javadoc, pom, sonar)

tags/release-3.10.0
Decebal Suiu 1 year ago
parent
commit
36f77cc63d

+ 1
- 2
pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java View File

protected volatile Map<String, ExtensionInfo> extensionInfos; // cache extension infos by class name protected volatile Map<String, ExtensionInfo> extensionInfos; // cache extension infos by class name
protected Boolean checkForExtensionDependencies = null; protected Boolean checkForExtensionDependencies = null;


public AbstractExtensionFinder(PluginManager pluginManager) {
protected AbstractExtensionFinder(PluginManager pluginManager) {
this.pluginManager = pluginManager; this.pluginManager = pluginManager;
} }


public abstract Map<String, Set<String>> readClasspathStorages(); public abstract Map<String, Set<String>> readClasspathStorages();


@Override @Override
@SuppressWarnings("unchecked")
public <T> List<ExtensionWrapper<T>> find(Class<T> type) { public <T> List<ExtensionWrapper<T>> find(Class<T> type) {
log.debug("Finding extensions of extension point '{}'", type.getName()); log.debug("Finding extensions of extension point '{}'", type.getName());
Map<String, Set<String>> entries = getEntries(); Map<String, Set<String>> entries = getEntries();

+ 6
- 6
pf4j/src/main/java/org/pf4j/AbstractPluginManager.java View File

/** /**
* The plugins roots are supplied as comma-separated list by {@code System.getProperty("pf4j.pluginsDir", "plugins")}. * The plugins roots are supplied as comma-separated list by {@code System.getProperty("pf4j.pluginsDir", "plugins")}.
*/ */
public AbstractPluginManager() {
protected AbstractPluginManager() {
initialize(); initialize();
} }


* *
* @param pluginsRoots the roots to search for plugins * @param pluginsRoots the roots to search for plugins
*/ */
public AbstractPluginManager(Path... pluginsRoots) {
protected AbstractPluginManager(Path... pluginsRoots) {
this(Arrays.asList(pluginsRoots)); this(Arrays.asList(pluginsRoots));
} }


* *
* @param pluginsRoots the roots to search for plugins * @param pluginsRoots the roots to search for plugins
*/ */
public AbstractPluginManager(List<Path> pluginsRoots) {
protected AbstractPluginManager(List<Path> pluginsRoots) {
this.pluginsRoots.addAll(pluginsRoots); this.pluginsRoots.addAll(pluginsRoots);


initialize(); initialize();


return pluginWrapper; return pluginWrapper;
} }
/** /**
* creates the plugin wrapper. override this if you want to prevent plugins having full access to the plugin manager * creates the plugin wrapper. override this if you want to prevent plugins having full access to the plugin manager
*
*
* @return * @return
*/ */
protected PluginWrapper createPluginWrapper(PluginDescriptor pluginDescriptor, Path pluginPath, ClassLoader pluginClassLoader) { protected PluginWrapper createPluginWrapper(PluginDescriptor pluginDescriptor, Path pluginPath, ClassLoader pluginClassLoader) {
/** /**
* Set to true to allow requires expression to be exactly x.y.z. * 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 * 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 * @param exactVersionAllowed set to true or false
*/ */

+ 6
- 6
pf4j/src/main/java/org/pf4j/ClassLoadingStrategy.java View File

public class ClassLoadingStrategy { 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)); 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)); 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)); 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)); 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)); 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)); public static final ClassLoadingStrategy PDA = new ClassLoadingStrategy(Arrays.asList(Source.PLUGIN, Source.DEPENDENCIES, Source.APPLICATION));



+ 2
- 30
pf4j/src/main/java/org/pf4j/util/ClassUtils.java View File

*/ */
public class ClassUtils { public class ClassUtils {


private ClassUtils() {}

public static List<String> getAllInterfacesNames(Class<?> aClass) { public static List<String> getAllInterfacesNames(Class<?> aClass) {
return toString(getAllInterfaces(aClass)); return toString(getAllInterfaces(aClass));
} }
return list; 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}. * Get a certain annotation of a {@link TypeElement}.
* See <a href="https://stackoverflow.com/a/10167558">stackoverflow.com</a> for more information. * See <a href="https://stackoverflow.com/a/10167558">stackoverflow.com</a> for more information.
return null; 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}. * Get a certain parameter of an {@link AnnotationMirror}.
* See <a href="https://stackoverflow.com/a/10167558">stackoverflow.com</a> for more information. * See <a href="https://stackoverflow.com/a/10167558">stackoverflow.com</a> for more information.


/** /**
* Uses {@link Class#getSimpleName()} to convert from {@link Class} to {@link String}. * Uses {@link Class#getSimpleName()} to convert from {@link Class} to {@link String}.
*
* @param classes
* @return
*/ */
private static List<String> toString(List<Class<?>> classes) { private static List<String> toString(List<Class<?>> classes) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();

+ 2
- 0
pf4j/src/main/java/org/pf4j/util/StringUtils.java View File

*/ */
public class StringUtils { public class StringUtils {


private StringUtils() {}

public static boolean isNullOrEmpty(String str) { public static boolean isNullOrEmpty(String str) {
return (str == null) || str.isEmpty(); return (str == null) || str.isEmpty();
} }

+ 5
- 1
pom.xml View File

<licenses> <licenses>
<license> <license>
<name>The Apache Software License, Version 2.0</name> <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> <distribution>repo</distribution>
</license> </license>
</licenses> </licenses>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version> <version>3.8.0</version>
<configuration> <configuration>
</plugin> </plugin>


<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version> <version>2.22.1</version>
</plugin> </plugin>


<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>2.6</version> <version>2.6</version>
</plugin> </plugin>
</plugin> </plugin>


<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<configuration> <configuration>
<archive> <archive>

Loading…
Cancel
Save