Skip to content

Commit 1f59f71

Browse files
committed
Reapply fix in ParsingOptions to suppress linter warning
The linter warning: ``` /b/b/e/main/src/yarp/java/org/prism/ParsingOptions.java:103: 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 error ```
1 parent c36fbb8 commit 1f59f71

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
@@ -100,7 +100,8 @@ private static void write(ByteArrayOutputStream output, byte[] bytes) {
100100
private static <T extends Enum<T>> byte serializeEnumSet(EnumSet<T> set) {
101101
byte result = 0;
102102
for (T value : set) {
103-
result |= 1 << value.ordinal();
103+
assert (1 << value.ordinal()) <= Byte.MAX_VALUE;
104+
result |= (byte) (1 << value.ordinal());
104105
}
105106
return result;
106107
}

0 commit comments

Comments
 (0)