I am using a Java library called Jooq. It has a class UpdateSetStep
with a function
<T> UpdateSetMoreStep<R> set(Field<T> field, T value);
Which I am using as intended:
return set(GENERIC_TOKEN.IS_REVOKED, true)
.set(GENERIC_TOKEN.EXPIRES_AT_UTC, LocalDateTime.now(clock))
.set(GENERIC_TOKEN.REVOKED_CAUSE, revokedCause)
But Sonar says Element access should use indexed access operators
and if I were to do
this[GENERIC_TOKEN.IS_REVOKED] = true
then there would be no way to access the return value and chain into the next call.
Sonar should probably ignore this rule for chained access like .set(...).set(...)
SonarSource 8.3.0.71062
SonarQube Version 10.1 (build 73491)
Java 17.0.6
Kotlin 1.8.22