Fix "At least one of the problems in category 'unchecked' is not analysed due to a compiler option being ignored" warnings

This commit is contained in:
Reinhard Pointner 2017-10-16 21:41:17 +02:00
parent 6cc4851fab
commit b412bf33fe
7 changed files with 0 additions and 22 deletions

View File

@ -154,7 +154,6 @@ public class Cache {
return new TypedCache<List<V>>(cache, cacheType, it -> it == null ? null : stream((Object[]) it).map(cls::cast).collect(toList()), it -> it == null ? null : it.toArray()); return new TypedCache<List<V>>(cache, cacheType, it -> it == null ? null : stream((Object[]) it).map(cls::cast).collect(toList()), it -> it == null ? null : it.toArray());
} }
@SuppressWarnings("unchecked")
public static class TypedCache<V> extends Cache { public static class TypedCache<V> extends Cache {
private final Function<Object, V> read; private final Function<Object, V> read;

View File

@ -1,7 +1,6 @@
package net.filebot.hash; package net.filebot.hash;
import java.io.File; import java.io.File;
import java.text.FieldPosition; import java.text.FieldPosition;
import java.text.Format; import java.text.Format;
@ -12,25 +11,20 @@ import java.util.Map.Entry;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class VerificationFormat extends Format { public class VerificationFormat extends Format {
private final String hashTypeHint; private final String hashTypeHint;
public VerificationFormat() { public VerificationFormat() {
this.hashTypeHint = ""; this.hashTypeHint = "";
} }
public VerificationFormat(String hashTypeHint) { public VerificationFormat(String hashTypeHint) {
this.hashTypeHint = hashTypeHint.isEmpty() ? "" : '?' + hashTypeHint.toUpperCase(); this.hashTypeHint = hashTypeHint.isEmpty() ? "" : '?' + hashTypeHint.toUpperCase();
} }
@Override @Override
public StringBuffer format(Object obj, StringBuffer sb, FieldPosition pos) { public StringBuffer format(Object obj, StringBuffer sb, FieldPosition pos) {
@SuppressWarnings("unchecked")
Entry<File, String> entry = (Entry<File, String>) obj; Entry<File, String> entry = (Entry<File, String>) obj;
String path = entry.getKey().getPath(); String path = entry.getKey().getPath();
@ -39,13 +33,11 @@ public class VerificationFormat extends Format {
return sb.append(format(path, hash)); return sb.append(format(path, hash));
} }
public String format(String path, String hash) { public String format(String path, String hash) {
// e.g. 1a02a7c1e9ac91346d08829d5037b240f42ded07 ?SHA1*folder/file.txt // e.g. 1a02a7c1e9ac91346d08829d5037b240f42ded07 ?SHA1*folder/file.txt
return String.format("%s %s*%s", hash, hashTypeHint, path); return String.format("%s %s*%s", hash, hashTypeHint, path);
} }
/** /**
* Pattern used to parse the lines of a md5 or sha1 file. * Pattern used to parse the lines of a md5 or sha1 file.
* *
@ -61,7 +53,6 @@ public class VerificationFormat extends Format {
*/ */
private final Pattern pattern = Pattern.compile("^(\\p{XDigit}+)\\s+(?:\\?\\w+)?\\*?(.+)$"); private final Pattern pattern = Pattern.compile("^(\\p{XDigit}+)\\s+(?:\\?\\w+)?\\*?(.+)$");
@Override @Override
public Entry<File, String> parseObject(String line) throws ParseException { public Entry<File, String> parseObject(String line) throws ParseException {
Matcher matcher = pattern.matcher(line); Matcher matcher = pattern.matcher(line);
@ -73,13 +64,11 @@ public class VerificationFormat extends Format {
return entry(matcher.group(2), matcher.group(1)); return entry(matcher.group(2), matcher.group(1));
} }
@Override @Override
public Entry<File, String> parseObject(String line, ParsePosition pos) { public Entry<File, String> parseObject(String line, ParsePosition pos) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
protected Entry<File, String> entry(String path, String hash) { protected Entry<File, String> entry(String path, String hash) {
return new SimpleImmutableEntry<File, String>(new File(path), hash); return new SimpleImmutableEntry<File, String>(new File(path), hash);
} }

View File

@ -119,7 +119,6 @@ public class SeriesNameMatcher {
* @return series names that have been matched one or multiple times depending on the threshold * @return series names that have been matched one or multiple times depending on the threshold
*/ */
private Collection<String> flatMatchAll(String[] names, Pattern prefixPattern, int threshold, boolean strict) { private Collection<String> flatMatchAll(String[] names, Pattern prefixPattern, int threshold, boolean strict) {
@SuppressWarnings("unchecked")
Comparator<String> wordComparator = (Comparator) commonSequenceMatcher.getCollator(); Comparator<String> wordComparator = (Comparator) commonSequenceMatcher.getCollator();
ThresholdCollection<String> thresholdCollection = new ThresholdCollection<String>(threshold, wordComparator); ThresholdCollection<String> thresholdCollection = new ThresholdCollection<String>(threshold, wordComparator);

View File

@ -130,7 +130,6 @@ class BindingDialog extends JDialog {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, null, isSelected, hasFocus, row, column); super.getTableCellRendererComponent(table, null, isSelected, hasFocus, row, column);
@SuppressWarnings("unchecked")
Future<String> future = (Future<String>) value; Future<String> future = (Future<String>) value;
// reset state // reset state

View File

@ -33,7 +33,6 @@ import redstone.xmlrpc.XmlRpcException;
import redstone.xmlrpc.XmlRpcFault; import redstone.xmlrpc.XmlRpcFault;
import redstone.xmlrpc.util.Base64; import redstone.xmlrpc.util.Base64;
@SuppressWarnings("unchecked")
public class OpenSubtitlesXmlRpc { public class OpenSubtitlesXmlRpc {
private final String useragent; private final String useragent;

View File

@ -9,7 +9,6 @@ import java.nio.channels.Channels;
import org.junit.Test; import org.junit.Test;
@SuppressWarnings("resource")
public class ByteBufferOutputStreamTest { public class ByteBufferOutputStreamTest {
@Test @Test

View File

@ -1,7 +1,6 @@
package net.filebot.util; package net.filebot.util;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -11,12 +10,10 @@ import java.util.List;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class TreeIteratorTest { public class TreeIteratorTest {
private List<Object> tree; private List<Object> tree;
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
tree = new ArrayList<Object>(); tree = new ArrayList<Object>();
@ -42,12 +39,10 @@ public class TreeIteratorTest {
tree.add(trunk); tree.add(trunk);
} }
@Test @Test
public void iterate() { public void iterate() {
TreeIterator<Object> treeIterator = new TreeIterator<Object>(tree) { TreeIterator<Object> treeIterator = new TreeIterator<Object>(tree) {
@SuppressWarnings("unchecked")
@Override @Override
protected Iterator<Object> children(Object node) { protected Iterator<Object> children(Object node) {
if (node instanceof Iterable) if (node instanceof Iterable)
@ -55,7 +50,6 @@ public class TreeIteratorTest {
return null; return null;
} }
}; };
// check leafs (String) and nodes (Iterable) // check leafs (String) and nodes (Iterable)