spring-data-redis icon indicating copy to clipboard operation
spring-data-redis copied to clipboard

Why bitField offset argument is converted to `int`?

Open psw0946 opened this issue 1 year ago • 0 comments

I have an issue when I try to do bitfield with set subcommands. But, when I pass offset argument with a long value, it emits an error with message,

Offset must be greater or equal to 0
java.lang.IllegalArgumentException: Offset must be greater or equal to 0
...

When I pass integer value offset, it succeeds.

It seems that it converts the offset value from long to int type in LettuceConverters.java.

BitFieldArgs.Offset offset = subCommand.getOffset().isZeroBased()
    ? BitFieldArgs.offset((int) subCommand.getOffset().getValue())
    : BitFieldArgs.typeWidthBasedOffset((int) subCommand.getOffset().getValue());

I think that it is caused by the lettuce core, because its offset type is int. But confusingly,, it is declared as long type at some places in lettuce core. So, I also submitted a issue on the lettuce github (link).

Is there any reason to declare offset as type int? I can pass a long value offset with redis-cli.

psw0946 avatar Aug 20 '24 13:08 psw0946