Minor: Fix a few more compiler warnings

Fixes #7802
This commit is contained in:
Armin 2017-07-25 14:07:47 +02:00 committed by Armin Braun
parent 18571f2b89
commit ea9f56e2fc
13 changed files with 29 additions and 17 deletions

View file

@ -9,6 +9,8 @@ import static org.logstash.Valuefier.convert;
public final class ConvertedList extends ArrayList<Object> {
private static final long serialVersionUID = 1396291343595074238L;
private ConvertedList(final int size) {
super(size);
}

View file

@ -8,6 +8,8 @@ import org.jruby.runtime.builtin.IRubyObject;
public final class ConvertedMap extends HashMap<String, Object> {
private static final long serialVersionUID = -4651798808586901122L;
private ConvertedMap(final int size) {
super((size << 2) / 3 + 2);
}

View file

@ -19,14 +19,12 @@
package org.logstash;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.logstash.ackedqueue.Queueable;
import java.io.IOException;
import java.io.Serializable;
import java.nio.ByteBuffer;
public class DLQEntry implements Cloneable, Serializable, Queueable {
public class DLQEntry implements Cloneable, Queueable {
private final Event event;
private final String pluginType;

View file

@ -3,6 +3,8 @@ package org.logstash;
import java.io.IOException;
public class LockException extends IOException {
private static final long serialVersionUID = 4924559998318165488L;
public LockException(String message) {
super(message);
}
@ -10,4 +12,4 @@ public class LockException extends IOException {
public LockException(String message, Throwable cause) {
super(message, cause);
}
}
}

View file

@ -34,7 +34,7 @@ public final class Rubyfier {
try {
return BiValues.newBiValue(input).rubyValue(runtime);
} catch (IllegalArgumentException e) {
Class cls = input.getClass();
Class<?> cls = input.getClass();
throw new IllegalArgumentException(String.format(ERR_TEMPLATE, cls.getName(), cls.getSimpleName()));
}
}
@ -50,7 +50,7 @@ public final class Rubyfier {
private static RubyHash deepMap(Ruby runtime, final Map<?, ?> map) {
RubyHash hash = RubyHash.newHash(runtime);
for (Map.Entry entry : map.entrySet()) {
for (Map.Entry<?, ?> entry : map.entrySet()) {
// Note: RubyHash.put calls JavaUtil.convertJavaToUsableRubyObject on keys and values
hash.put(entry.getKey(), deep(runtime, entry.getValue()));
}

View file

@ -35,7 +35,7 @@ public class Valuefier {
try {
return BiValues.newBiValue(jp);
} catch (IllegalArgumentException e) {
Class cls = obj.getClass();
final Class<?> cls = obj.getClass();
throw new IllegalArgumentException(String.format(PROXY_ERR_TEMPLATE, cls.getName(), cls.getSimpleName(), obj.getClass().getName()), e);
}
}
@ -44,7 +44,7 @@ public class Valuefier {
try {
return BiValues.newBiValue(o);
} catch (IllegalArgumentException e) {
Class cls = o.getClass();
final Class<?> cls = o.getClass();
throw new IllegalArgumentException(String.format(ERR_TEMPLATE, cls.getName(), cls.getSimpleName()), e);
}
}

View file

@ -114,7 +114,7 @@ public class Queue implements Closeable {
// retrieve the deserialize method
try {
Class[] cArg = new Class[1];
final Class<?>[] cArg = new Class[1];
cArg[0] = byte[].class;
this.deserializeMethod = this.elementClass.getDeclaredMethod("deserialize", cArg);
} catch (NoSuchMethodException e) {

View file

@ -33,8 +33,9 @@ public class JrubyAckedBatchExtLibrary implements Library {
clazz.defineAnnotatedMethods(RubyAckedBatch.class);
}
@JRubyClass(name = "AckedBatch", parent = "Object")
@JRubyClass(name = "AckedBatch")
public static class RubyAckedBatch extends RubyObject {
private static final long serialVersionUID = -3118949118637372130L;
private Batch batch;
public RubyAckedBatch(Ruby runtime, RubyClass klass) {

View file

@ -28,7 +28,7 @@ public class MemoryCheckpointIO implements CheckpointIO {
public Checkpoint read(String fileName) throws IOException {
Checkpoint cp = null;
Map<String, Checkpoint> ns = this.sources.get(dirPath);
Map<String, Checkpoint> ns = sources.get(dirPath);
if (ns != null) {
cp = ns.get(fileName);
}
@ -45,17 +45,17 @@ public class MemoryCheckpointIO implements CheckpointIO {
@Override
public void write(String fileName, Checkpoint checkpoint) throws IOException {
Map<String, Checkpoint> ns = this.sources.get(dirPath);
Map<String, Checkpoint> ns = sources.get(dirPath);
if (ns == null) {
ns = new HashMap<>();
this.sources.put(this.dirPath, ns);
sources.put(this.dirPath, ns);
}
ns.put(fileName, checkpoint);
}
@Override
public void purge(String fileName) {
Map<String, Checkpoint> ns = this.sources.get(dirPath);
Map<String, Checkpoint> ns = sources.get(dirPath);
if (ns != null) {
ns.remove(fileName);
}
@ -63,7 +63,7 @@ public class MemoryCheckpointIO implements CheckpointIO {
@Override
public void purge() {
this.sources.remove(this.dirPath);
sources.remove(this.dirPath);
}
// @return the head page checkpoint file name

View file

@ -6,6 +6,8 @@ import org.logstash.config.ir.InvalidIRException;
* Created by andrewvc on 6/12/17.
*/
public class IncompleteSourceWithMetadataException extends InvalidIRException {
private static final long serialVersionUID = 456422097113787583L;
public IncompleteSourceWithMetadataException(String message) {
super(message);
}

View file

@ -42,6 +42,8 @@ public abstract class Vertex implements SourceComponent, HashableWithSource {
public abstract Vertex copy();
public static class InvalidEdgeTypeException extends InvalidIRException {
private static final long serialVersionUID = -2707379453144995223L;
public InvalidEdgeTypeException(String s) {
super(s);
}

View file

@ -13,6 +13,7 @@ import java.util.stream.Stream;
*/
public class ShortestPath {
static class InvalidShortestPathArguments extends Exception {
private static final long serialVersionUID = -1493537067800744231L;
private final Collection<Vertex> invalidVertices;
public InvalidShortestPathArguments(Collection<Vertex> invalidVertices) {

View file

@ -11,6 +11,8 @@ import java.util.*;
*/
public class TopologicalSort {
public static class UnexpectedGraphCycleError extends Exception {
private static final long serialVersionUID = 1778155790783320839L;
UnexpectedGraphCycleError(Graph g) {
super("Graph has cycles, is not a DAG! " + g);
}