aboutsummaryrefslogtreecommitdiffstats
path: root/pf4j/src
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2019-04-01 22:19:05 +0300
committerDecebal Suiu <decebal.suiu@gmail.com>2019-04-01 22:19:05 +0300
commit6addff34e21dbcd784d38f8b8c5c6259a42b2613 (patch)
treee7c27e114c23faa125df1b70415c9c0bdace9c41 /pf4j/src
parent6f2f72195943ae2bd5dfcdc7cd6e1a54235257f0 (diff)
downloadpf4j-6addff34e21dbcd784d38f8b8c5c6259a42b2613.tar.gz
pf4j-6addff34e21dbcd784d38f8b8c5c6259a42b2613.zip
Fix warnings
Diffstat (limited to 'pf4j/src')
-rw-r--r--pf4j/src/main/java/org/pf4j/BasePluginRepository.java9
-rw-r--r--pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java2
-rw-r--r--pf4j/src/main/java/org/pf4j/PluginWrapper.java6
-rw-r--r--pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java6
-rw-r--r--pf4j/src/main/java/org/pf4j/util/AndFileFilter.java12
-rw-r--r--pf4j/src/main/java/org/pf4j/util/DirectedGraph.java10
-rw-r--r--pf4j/src/main/java/org/pf4j/util/OrFileFilter.java12
7 files changed, 20 insertions, 37 deletions
diff --git a/pf4j/src/main/java/org/pf4j/BasePluginRepository.java b/pf4j/src/main/java/org/pf4j/BasePluginRepository.java
index a353756..381059c 100644
--- a/pf4j/src/main/java/org/pf4j/BasePluginRepository.java
+++ b/pf4j/src/main/java/org/pf4j/BasePluginRepository.java
@@ -48,14 +48,7 @@ public class BasePluginRepository implements PluginRepository {
this.filter = filter;
// last modified file is first
- this.comparator = new Comparator<File>() {
-
- @Override
- public int compare(File o1, File o2) {
- return (int) (o2.lastModified() - o1.lastModified());
- }
-
- };
+ this.comparator = (o1, o2) -> (int) (o2.lastModified() - o1.lastModified());
}
public void setFilter(FileFilter filter) {
diff --git a/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java b/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java
index 74cd0f3..6401f21 100644
--- a/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java
+++ b/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java
@@ -78,7 +78,7 @@ public class ManifestPluginDescriptorFinder implements PluginDescriptorFinder {
}
}
- protected Path getManifestPath(Path pluginPath) throws PluginException {
+ protected Path getManifestPath(Path pluginPath) {
if (Files.isDirectory(pluginPath)) {
// legacy (the path is something like "classes/META-INF/MANIFEST.MF")
return FileUtils.findFile(pluginPath,"MANIFEST.MF");
diff --git a/pf4j/src/main/java/org/pf4j/PluginWrapper.java b/pf4j/src/main/java/org/pf4j/PluginWrapper.java
index c7d93ca..209afb9 100644
--- a/pf4j/src/main/java/org/pf4j/PluginWrapper.java
+++ b/pf4j/src/main/java/org/pf4j/PluginWrapper.java
@@ -120,11 +120,9 @@ public class PluginWrapper {
}
PluginWrapper other = (PluginWrapper) obj;
- if (!descriptor.getPluginId().equals(other.descriptor.getPluginId())) {
- return false;
- }
- return true;
+ return descriptor.getPluginId().equals(other.descriptor.getPluginId());
+
}
@Override
diff --git a/pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java b/pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java
index e0f3513..55bbbc2 100644
--- a/pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java
+++ b/pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java
@@ -109,11 +109,7 @@ public class ExtensionAnnotationProcessor extends AbstractProcessor {
String extension = getBinaryName(extensionElement);
for (TypeElement extensionPointElement : extensionPointElements) {
String extensionPoint = getBinaryName(extensionPointElement);
- Set<String> extensionPoints = extensions.get(extensionPoint);
- if (extensionPoints == null) {
- extensionPoints = new TreeSet<>();
- extensions.put(extensionPoint, extensionPoints);
- }
+ Set<String> extensionPoints = extensions.computeIfAbsent(extensionPoint, k -> new TreeSet<>());
extensionPoints.add(extension);
}
}
diff --git a/pf4j/src/main/java/org/pf4j/util/AndFileFilter.java b/pf4j/src/main/java/org/pf4j/util/AndFileFilter.java
index cc74da4..76a17ec 100644
--- a/pf4j/src/main/java/org/pf4j/util/AndFileFilter.java
+++ b/pf4j/src/main/java/org/pf4j/util/AndFileFilter.java
@@ -23,11 +23,9 @@ import java.util.Collections;
import java.util.List;
/**
- * This filter providing conditional AND logic across a list of
- * file filters. This filter returns <code>true</code> if all filters in the
- * list return <code>true</code>. Otherwise, it returns <code>false</code>.
- * Checking of the file filter list stops when the first filter returns
- * <code>false</code>.
+ * This filter providing conditional AND logic across a list of file filters.
+ * This filter returns {@code true} if all filters in the list return {@code true}. Otherwise, it returns {@code false}.
+ * Checking of the file filter list stops when the first filter returns {@code false}.
*
* @author Decebal Suiu
*/
@@ -37,7 +35,7 @@ public class AndFileFilter implements FileFilter {
private List<FileFilter> fileFilters;
public AndFileFilter() {
- this(new ArrayList<FileFilter>());
+ this(new ArrayList<>());
}
public AndFileFilter(FileFilter... fileFilters) {
@@ -68,7 +66,7 @@ public class AndFileFilter implements FileFilter {
@Override
public boolean accept(File file) {
- if (this.fileFilters.size() == 0) {
+ if (this.fileFilters.isEmpty()) {
return false;
}
diff --git a/pf4j/src/main/java/org/pf4j/util/DirectedGraph.java b/pf4j/src/main/java/org/pf4j/util/DirectedGraph.java
index 076d67c..1163f91 100644
--- a/pf4j/src/main/java/org/pf4j/util/DirectedGraph.java
+++ b/pf4j/src/main/java/org/pf4j/util/DirectedGraph.java
@@ -44,7 +44,7 @@ public class DirectedGraph<V> {
return;
}
- neighbors.put(vertex, new ArrayList<V>());
+ neighbors.put(vertex, new ArrayList<>());
}
/**
@@ -85,7 +85,7 @@ public class DirectedGraph<V> {
}
public List<V> getNeighbors(V vertex) {
- return containsVertex(vertex) ? neighbors.get(vertex) : new ArrayList<V>();
+ return containsVertex(vertex) ? neighbors.get(vertex) : new ArrayList<>();
}
/**
@@ -101,7 +101,7 @@ public class DirectedGraph<V> {
}
/**
- * Report (as a Map) the in-degree (the number of head ends adjacent to a vertex) of each vertex.
+ * Report (as a {@link Map}) the in-degree (the number of head ends adjacent to a vertex) of each vertex.
*/
public Map<V, Integer> inDegree() {
Map<V, Integer> result = new HashMap<>();
@@ -181,9 +181,9 @@ public class DirectedGraph<V> {
*/
@Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (V vertex : neighbors.keySet()) {
- sb.append("\n " + vertex + " -> " + neighbors.get(vertex));
+ sb.append("\n ").append(vertex).append(" -> ").append(neighbors.get(vertex));
}
return sb.toString();
diff --git a/pf4j/src/main/java/org/pf4j/util/OrFileFilter.java b/pf4j/src/main/java/org/pf4j/util/OrFileFilter.java
index fccfb7b..5798249 100644
--- a/pf4j/src/main/java/org/pf4j/util/OrFileFilter.java
+++ b/pf4j/src/main/java/org/pf4j/util/OrFileFilter.java
@@ -23,11 +23,9 @@ import java.util.Collections;
import java.util.List;
/**
- * This filter providing conditional OR logic across a list of
- * file filters. This filter returns <code>true</code> if one filter in the
- * list return <code>true</code>. Otherwise, it returns <code>false</code>.
- * Checking of the file filter list stops when the first filter returns
- * <code>true</code>.
+ * This filter providing conditional OR logic across a list of file filters.
+ * This filter returns {@code true} if one filter in the list return {@code true}. Otherwise, it returns {@code false}.
+ * Checking of the file filter list stops when the first filter returns {@code true}.
*
* @author Decebal Suiu
*/
@@ -37,7 +35,7 @@ public class OrFileFilter implements FileFilter {
private List<FileFilter> fileFilters;
public OrFileFilter() {
- this(new ArrayList<FileFilter>());
+ this(new ArrayList<>());
}
public OrFileFilter(FileFilter... fileFilters) {
@@ -68,7 +66,7 @@ public class OrFileFilter implements FileFilter {
@Override
public boolean accept(File file) {
- if (this.fileFilters.size() == 0) {
+ if (this.fileFilters.isEmpty()) {
return true;
}