Try to avoid strange `java.lang.IncompatibleClassChangeError: vtable stub` issues

@see https://www.filebot.net/forums/viewtopic.php?f=13&t=4137
This commit is contained in:
Reinhard Pointner 2016-09-18 03:31:27 +08:00
parent 19ef203811
commit 5f734c14b2
1 changed files with 5 additions and 4 deletions

View File

@ -27,6 +27,7 @@ import java.util.Objects;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;
import com.ibm.icu.text.Transliterator;
@ -40,7 +41,6 @@ import net.filebot.web.EpisodeFormat;
import net.filebot.web.Movie;
import net.filebot.web.SeriesInfo;
import net.filebot.web.SimpleDate;
import one.util.streamex.StreamEx;
public enum EpisodeMetrics implements SimilarityMetric {
@ -208,13 +208,14 @@ public enum EpisodeMetrics implements SimilarityMetric {
return stream(objects).map(EpisodeMetrics::normalizeObject).toArray(String[]::new);
}
protected final int MAX_FIELDS = 5;
protected static final int MAX_FIELDS = 5;
protected Object[] fields(Object object) {
if (object instanceof Episode) {
Episode e = (Episode) object;
Object[] names = StreamEx.of(e.getSeriesName(), e.getTitle()).append(e.getSeriesNames()).filter(Objects::nonNull).map(Normalization::removeTrailingBrackets).distinct().limit(MAX_FIELDS).toArray();
return copyOf(names, MAX_FIELDS);
Stream<String> names = Stream.concat(Stream.of(e.getSeriesName(), e.getTitle()), e.getSeriesNames().stream()).filter(Objects::nonNull).map(Normalization::removeTrailingBrackets).distinct();
return copyOf(names.limit(MAX_FIELDS).toArray(), MAX_FIELDS);
}
if (object instanceof File) {