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());
}
@SuppressWarnings("unchecked")
public static class TypedCache<V> extends Cache {
private final Function<Object, V> read;

View File

@ -1,7 +1,6 @@
package net.filebot.hash;
import java.io.File;
import java.text.FieldPosition;
import java.text.Format;
@ -12,25 +11,20 @@ import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class VerificationFormat extends Format {
private final String hashTypeHint;
public VerificationFormat() {
this.hashTypeHint = "";
}
public VerificationFormat(String hashTypeHint) {
this.hashTypeHint = hashTypeHint.isEmpty() ? "" : '?' + hashTypeHint.toUpperCase();
}
@Override
public StringBuffer format(Object obj, StringBuffer sb, FieldPosition pos) {
@SuppressWarnings("unchecked")
Entry<File, String> entry = (Entry<File, String>) obj;
String path = entry.getKey().getPath();
@ -39,13 +33,11 @@ public class VerificationFormat extends Format {
return sb.append(format(path, hash));
}
public String format(String path, String hash) {
// e.g. 1a02a7c1e9ac91346d08829d5037b240f42ded07 ?SHA1*folder/file.txt
return String.format("%s %s*%s", hash, hashTypeHint, path);
}
/**
* 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+)?\\*?(.+)$");
@Override
public Entry<File, String> parseObject(String line) throws ParseException {
Matcher matcher = pattern.matcher(line);
@ -73,13 +64,11 @@ public class VerificationFormat extends Format {
return entry(matcher.group(2), matcher.group(1));
}
@Override
public Entry<File, String> parseObject(String line, ParsePosition pos) {
throw new UnsupportedOperationException();
}
protected Entry<File, String> entry(String path, String 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
*/
private Collection<String> flatMatchAll(String[] names, Pattern prefixPattern, int threshold, boolean strict) {
@SuppressWarnings("unchecked")
Comparator<String> wordComparator = (Comparator) commonSequenceMatcher.getCollator();
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) {
super.getTableCellRendererComponent(table, null, isSelected, hasFocus, row, column);
@SuppressWarnings("unchecked")
Future<String> future = (Future<String>) value;
// reset state

View File

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

View File

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

View File

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