Browse Source

Fix warnings

#307
Decebal Suiu 6 years ago
parent
commit
6addff34e2
  1. 9
      pf4j/src/main/java/org/pf4j/BasePluginRepository.java
  2. 2
      pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java
  3. 6
      pf4j/src/main/java/org/pf4j/PluginWrapper.java
  4. 6
      pf4j/src/main/java/org/pf4j/processor/ExtensionAnnotationProcessor.java
  5. 12
      pf4j/src/main/java/org/pf4j/util/AndFileFilter.java
  6. 10
      pf4j/src/main/java/org/pf4j/util/DirectedGraph.java
  7. 12
      pf4j/src/main/java/org/pf4j/util/OrFileFilter.java

9
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) {

2
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");

6
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

6
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);
}
}

12
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;
}

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

12
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;
}

Loading…
Cancel
Save