Explicitly set Java language level to 1.8 + using diamonds

This commit is contained in:
Gianlu 2020-05-25 15:58:11 +02:00
parent fefd9022a8
commit 973133c40c
7 changed files with 11 additions and 12 deletions

View File

@ -17,6 +17,8 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties> </properties>
<repositories> <repositories>

View File

@ -37,7 +37,7 @@ public final class CustomCardFormatHelper {
public static String formatBlackCard(final JSONArray textParts) { public static String formatBlackCard(final JSONArray textParts) {
// TODO this is going to need some work to look pretty. // TODO this is going to need some work to look pretty.
final List<String> strs = new ArrayList<String>(textParts.size()); final List<String> strs = new ArrayList<>(textParts.size());
for (final Object o : textParts) { for (final Object o : textParts) {
strs.add((String) o); strs.add((String) o);
} }
@ -47,7 +47,7 @@ public final class CustomCardFormatHelper {
public static String formatWhiteCard(final JSONArray textParts) { public static String formatWhiteCard(final JSONArray textParts) {
// The white cards should only ever have one element in text, but let's be safe. // The white cards should only ever have one element in text, but let's be safe.
final List<String> strs = new ArrayList<String>(textParts.size()); final List<String> strs = new ArrayList<>(textParts.size());
for (final Object o : textParts) { for (final Object o : textParts) {
final String cardCastString = (String) o; final String cardCastString = (String) o;
if (cardCastString.isEmpty()) { if (cardCastString.isEmpty()) {

View File

@ -249,7 +249,7 @@ public class CustomCardsService {
private void putCache(CustomDeck deck, long timeout, String url, String hash) { private void putCache(CustomDeck deck, long timeout, String url, String hash) {
synchronized (cache) { synchronized (cache) {
cache.add(new SoftReference<CacheEntry>(new CacheEntry(timeout + System.currentTimeMillis(), deck, url, hash))); cache.add(new SoftReference<>(new CacheEntry(timeout + System.currentTimeMillis(), deck, url, hash)));
} }
} }
@ -295,16 +295,13 @@ public class CustomCardsService {
return null; return null;
} }
final InputStream is = conn.getInputStream(); try (InputStream is = conn.getInputStream()) {
try {
return new ByteSource() { return new ByteSource() {
@Override @Override
public InputStream openStream() { public InputStream openStream() {
return is; return is;
} }
}.asCharSource(Charsets.UTF_8).read(); }.asCharSource(Charsets.UTF_8).read();
} finally {
is.close();
} }
} }

View File

@ -33,8 +33,8 @@ public class CustomDeck extends CardSet {
private final int id; private final int id;
private final String name; private final String name;
private final String description; private final String description;
private final Set<CustomBlackCard> blackCards = new HashSet<CustomBlackCard>(); private final Set<CustomBlackCard> blackCards = new HashSet<>();
private final Set<CustomWhiteCard> whiteCards = new HashSet<CustomWhiteCard>(); private final Set<CustomWhiteCard> whiteCards = new HashSet<>();
public CustomDeck(final int id, final String name, final String description) { public CustomDeck(final int id, final String name, final String description) {
this.id = id; this.id = id;

View File

@ -30,7 +30,7 @@ public class AddCardsetHandler extends GameWithPlayerHandler {
@Override @Override
public Map<ReturnableData, Object> handleWithUserInGame(final RequestWrapper request, public Map<ReturnableData, Object> handleWithUserInGame(final RequestWrapper request,
final HttpSession session, final User user, final Game game) { final HttpSession session, final User user, final Game game) {
final Map<ReturnableData, Object> data = new HashMap<ReturnableData, Object>(); final Map<ReturnableData, Object> data = new HashMap<>();
if (game.getHost() != user) { if (game.getHost() != user) {
return error(ErrorCode.NOT_GAME_HOST); return error(ErrorCode.NOT_GAME_HOST);

View File

@ -31,7 +31,7 @@ public class ListCardsetsHandler extends GameWithPlayerHandler {
@Override @Override
public Map<ReturnableData, Object> handleWithUserInGame(final RequestWrapper request, public Map<ReturnableData, Object> handleWithUserInGame(final RequestWrapper request,
final HttpSession session, final User user, final Game game) { final HttpSession session, final User user, final Game game) {
final Map<ReturnableData, Object> data = new HashMap<ReturnableData, Object>(); final Map<ReturnableData, Object> data = new HashMap<>();
final List<Map<CardSetData, Object>> setDatas = new ArrayList<>(); final List<Map<CardSetData, Object>> setDatas = new ArrayList<>();
for (final Integer deckId : game.getCustomDeckIds().toArray(new Integer[0])) { for (final Integer deckId : game.getCustomDeckIds().toArray(new Integer[0])) {

View File

@ -30,7 +30,7 @@ public class RemoveCardsetHandler extends GameWithPlayerHandler {
@Override @Override
public Map<ReturnableData, Object> handleWithUserInGame(final RequestWrapper request, public Map<ReturnableData, Object> handleWithUserInGame(final RequestWrapper request,
final HttpSession session, final User user, final Game game) { final HttpSession session, final User user, final Game game) {
final Map<ReturnableData, Object> data = new HashMap<ReturnableData, Object>(); final Map<ReturnableData, Object> data = new HashMap<>();
if (game.getHost() != user) { if (game.getHost() != user) {
return error(ErrorCode.NOT_GAME_HOST); return error(ErrorCode.NOT_GAME_HOST);