Skip to content

Commit 62938c7

Browse files
committed
chore: clean up code
1 parent af7411c commit 62938c7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

common/src/main/java/net/modgarden/silicate/api/condition/TypedGameCondition.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ private static <P> DataResult<Holder<TypedGameCondition<?, P>>> validate(Holder<
2727
}
2828
}
2929

30-
private static GameCondition<?> toGameCondition(TypedGameCondition<?, ?> typedCondition) {
31-
return typedCondition;
30+
@SuppressWarnings("unchecked") // The underlying type can be cast.
31+
private static <P> Holder<GameCondition<?>> toGameCondition(Holder<TypedGameCondition<?, P>> typedCondition) {
32+
return (Holder<GameCondition<?>>) (Object) typedCondition;
3233
}
3334

3435
/**
@@ -37,12 +38,11 @@ private static GameCondition<?> toGameCondition(TypedGameCondition<?, ?> typedCo
3738
* @return The typed codec.
3839
* @param <P> The value type of the parameter type.
3940
*/
40-
@SuppressWarnings("unchecked")
4141
static <P> Codec<Holder<TypedGameCondition<?, P>>> getTypedCodec(Class<P> clazz) {
4242
return GameCondition.CODEC
4343
.comapFlatMap(
4444
condition -> validate(condition, clazz),
45-
holder -> (Holder<GameCondition<?>>)(Object)holder
45+
TypedGameCondition::toGameCondition
4646
);
4747
}
4848

0 commit comments

Comments
 (0)