Skip to content

Why bitField offset argument is converted to int? #2974

@psw0946

Description

@psw0946

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions