Skip to content

Commit da307a0

Browse files
committed
Fix linter warning in org.prism.ParsingOptions
The linter warning is the following: ``` /b/b/e/main/src/yarp/java/org/prism/ParsingOptions.java:99: warning: [lossy-conversions] implicit cast from int to byte in compound assignment is possibly lossy result |= 1 << value.ordinal(); ^ error: warnings found and -Werror specified ```
1 parent 1750d62 commit da307a0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/yarp/java/org/prism/ParsingOptions.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ private static void write(ByteArrayOutputStream output, byte[] bytes) {
9696
private static <T extends Enum<T>> byte serializeEnumSet(EnumSet<T> set) {
9797
byte result = 0;
9898
for (T value : set) {
99-
result |= 1 << value.ordinal();
99+
assert (1 << value.ordinal()) <= Byte.MAX_VALUE;
100+
result |= (byte) (1 << value.ordinal());
100101
}
101102
return result;
102103
}

0 commit comments

Comments
 (0)