OneOf is set multiple times with different values

Open Beginner friendly
#4,359 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
database

Research direction

Start in bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableTableAdminClientWrapper.java at the calls near lines 240 and 258. Read the surrounding OneOf target construction and run the Error Prone RedundantSetterCall check. Done means the redundant setter warnings are resolved without changing the intended target behavior.

Written by the indexing model from the issue text.

Description

api: bigtable

These calls to OneOf setters in BigtableTableAdminClientWrapper.java overwrite previously set values:

https://github.com/googleapis/java-bigtable-hbase/blob/d3403e14cf0463d39e71d1af62a81f3c4110d125/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableTableAdminClientWrapper.java#L240

https://github.com/googleapis/java-bigtable-hbase/blob/d3403e14cf0463d39e71d1af62a81f3c4110d125/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableTableAdminClientWrapper.java#L258

This was noticed because of an Error Prone static check, which reports the following error for that code:

src/main/java/com/google/cloud/bigtable/grpc/BigtableTableAdminClientWrapper.java:240: error: [RedundantSetterCall] The oneof `Target` (set via setDeleteAllDataFromTable, setRowKeyPrefix) was called twice with . Setting the same field multiple times is redundant, and could mask a bug.
            .setRowKeyPrefix(rowKeyPrefix)
                             ^
    (see https://errorprone.info/bugpattern/RedundantSetterCall)
src/main/java/com/google/cloud/bigtable/grpc/BigtableTableAdminClientWrapper.java:258: error: [RedundantSetterCall] The oneof `Target` (set via setDeleteAllDataFromTable, setRowKeyPrefix) was called twice with . Setting the same field multiple times is redundant, and could mask a bug.
            .setRowKeyPrefix(rowKeyPrefix)
                             ^
    (see https://errorprone.info/bugpattern/RedundantSetterCall)
Dominant language
Java
Stars
184
Forks
184
Avg merge
10h
Merged PRs (30d)
6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from googleapis/java-bigtable-hbase

All issues in googleapis/java-bigtable-hbase

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.