Skip to content

Commit c3a7a3b

Browse files
committed
Make Findbugs happy after the Java 7 conversion.
1 parent d97b5b1 commit c3a7a3b

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

src/main/java/net/alloyggp/tournament/api/TPlayerScore.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public int getSeedFromRoundStart() {
3838

3939
@Override
4040
public int compareTo(TPlayerScore other) {
41-
int scoreComparison = score.compareTo(other.score);
41+
//lower PlayerScore is better; higher Score is better
42+
int scoreComparison = other.score.compareTo(score);
4243
if (scoreComparison != 0) {
43-
//lower PlayerScore is better; higher Score is better
44-
return -scoreComparison;
44+
return scoreComparison;
4545
}
4646
return Integer.compare(seedFromRoundStart, other.seedFromRoundStart);
4747
}

src/main/java/net/alloyggp/tournament/internal/MatchResults.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import java.util.Collection;
44
import java.util.Set;
55

6+
import javax.annotation.Nonnull;
7+
68
import com.google.common.base.Predicate;
79
import com.google.common.collect.Collections2;
810
import com.google.common.collect.HashMultimap;
@@ -26,7 +28,7 @@ public static Set<TMatchResult> filterByStage(Collection<TMatchResult> inputs, f
2628
return Sets.newHashSet(Collections2.filter(inputs,
2729
new Predicate<TMatchResult>() {
2830
@Override
29-
public boolean apply(TMatchResult input) {
31+
public boolean apply(@Nonnull TMatchResult input) {
3032
String matchId = input.getMatchId();
3133
int matchStage = MatchIds.parseStageNumber(matchId);
3234
return matchStage == stageNum;
@@ -42,7 +44,7 @@ public static Set<TMatchResult> getResultsPriorToStage(Collection<TMatchResult>
4244
return Sets.newHashSet(Collections2.filter(inputs,
4345
new Predicate<TMatchResult>() {
4446
@Override
45-
public boolean apply(TMatchResult input) {
47+
public boolean apply(@Nonnull TMatchResult input) {
4648
String matchId = input.getMatchId();
4749
int matchStage = MatchIds.parseStageNumber(matchId);
4850
return matchStage < stageNum;

src/main/java/net/alloyggp/tournament/internal/SwissFormat1Runner.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.Map;
99
import java.util.Set;
1010

11+
import javax.annotation.Nonnull;
1112
import javax.annotation.Nullable;
1213
import javax.annotation.concurrent.Immutable;
1314
import javax.annotation.concurrent.NotThreadSafe;
@@ -30,18 +31,18 @@
3031
import com.google.common.collect.SetMultimap;
3132
import com.google.common.collect.Sets;
3233

34+
import net.alloyggp.tournament.api.TGame;
3335
import net.alloyggp.tournament.api.TMatchResult;
3436
import net.alloyggp.tournament.api.TMatchResult.Outcome;
35-
import net.alloyggp.tournament.internal.spec.MatchSpec;
36-
import net.alloyggp.tournament.internal.spec.RoundSpec;
3737
import net.alloyggp.tournament.api.TMatchSetup;
3838
import net.alloyggp.tournament.api.TNextMatchesResult;
3939
import net.alloyggp.tournament.api.TPlayer;
4040
import net.alloyggp.tournament.api.TPlayerScore;
4141
import net.alloyggp.tournament.api.TRanking;
4242
import net.alloyggp.tournament.api.TScore;
4343
import net.alloyggp.tournament.api.TSeeding;
44-
import net.alloyggp.tournament.api.TGame;
44+
import net.alloyggp.tournament.internal.spec.MatchSpec;
45+
import net.alloyggp.tournament.internal.spec.RoundSpec;
4546

4647
public class SwissFormat1Runner implements FormatRunner {
4748
private static final SwissFormat1Runner INSTANCE = new SwissFormat1Runner();
@@ -780,7 +781,7 @@ private static <K,T> ImmutableMap<K, ImmutableMultiset<ImmutableSet<T>>> toImmut
780781
Map<K, Multiset<Set<T>>> map) {
781782
return ImmutableMap.copyOf(Maps.transformValues(map, new Function<Multiset<Set<T>>, ImmutableMultiset<ImmutableSet<T>>>() {
782783
@Override
783-
public ImmutableMultiset<ImmutableSet<T>> apply(Multiset<Set<T>> input) {
784+
public ImmutableMultiset<ImmutableSet<T>> apply(@Nonnull Multiset<Set<T>> input) {
784785
return toImmutableSetEntriedMultiset(input);
785786
}
786787
}));
@@ -799,7 +800,7 @@ private static <K1,K2,V2> ImmutableMap<K1, ImmutableMap<K2, V2>> toImmutableMapV
799800
Map<K1, Map<K2, V2>> map) {
800801
return ImmutableMap.copyOf(Maps.transformValues(map, new Function<Map<K2, V2>, ImmutableMap<K2, V2>>() {
801802
@Override
802-
public ImmutableMap<K2, V2> apply(Map<K2, V2> input) {
803+
public ImmutableMap<K2, V2> apply(@Nonnull Map<K2, V2> input) {
803804
return ImmutableMap.copyOf(input);
804805
}
805806
}));

src/test/java/net/alloyggp/tournament/SingleEliminationVictoryTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import java.util.Random;
77
import java.util.Set;
88

9+
import javax.annotation.Nonnull;
10+
911
import org.junit.Test;
1012
import org.junit.runner.RunWith;
1113
import org.junit.runners.Parameterized;
@@ -37,7 +39,7 @@ public static Iterable<Object[]> data() {
3739
return Iterables.filter(FuzzTests.getParameters(),
3840
new Predicate<Object[]>() {
3941
@Override
40-
public boolean apply(Object[] arguments) {
42+
public boolean apply(@Nonnull Object[] arguments) {
4143
String testSpec = (String) arguments[1];
4244
return testSpec.startsWith("singleElim");
4345
}

0 commit comments

Comments
 (0)