Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unnecessary boxed primitives in AutoValue classes #3460

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cushon
Copy link
Contributor

@cushon cushon commented Aug 27, 2024

Fixes

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableResult.java:42: error: [AutoValueUnnecessaryBoxing] property method com.google.cloud.bigquery.TableResult.getTotalRows() is primitive but parameter of setter method is not
    public abstract TableResult.Builder setTotalRows(Long totalRows);
                                        ^

See google/auto@328a25c

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #3459 ☕️

If you write sample code, please follow the samples format.

@cushon cushon requested a review from a team as a code owner August 27, 2024 19:06
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: bigquery Issues related to the googleapis/java-bigquery API. labels Aug 27, 2024
@PhongChuong
Copy link
Contributor

/gcbrun

@PhongChuong PhongChuong self-requested a review August 29, 2024 19:38
@PhongChuong
Copy link
Contributor

Generally looks good.
Can you add an exception for the change in:
google-cloud-bigquery/clirr-ignored-differences.xml
And fix the conventionalcommits check.

@cushon cushon changed the title Fix unnecessary boxed primitives in AutoValue classes fix: unnecessary boxed primitives in AutoValue classes Aug 29, 2024
Copy link

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

Fixes

```
google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableResult.java:42: error: [AutoValueUnnecessaryBoxing] property method com.google.cloud.bigquery.TableResult.getTotalRows() is primitive but parameter of setter method is not
    public abstract TableResult.Builder setTotalRows(Long totalRows);
                                        ^
```

See google/auto@328a25c
@cushon cushon requested a review from a team as a code owner August 29, 2024 21:42
@cushon
Copy link
Contributor Author

cushon commented Aug 29, 2024

Generally looks good. Can you add an exception for the change in: google-cloud-bigquery/clirr-ignored-differences.xml And fix the conventionalcommits check.

Thanks, done!

@PhongChuong
Copy link
Contributor

@cushon , it seems like ci / clirr is still failing.
Sorry for the late reply.

@cpovirk
Copy link

cpovirk commented Sep 5, 2024

@cushon is out for a couple more days, but I've been wondering: Would it make sense to leave the old method in place but as @Deprecated method that forwards to the new one? This PR isn't dangerous for anyone who recompiles against the new BigQuery version before using it, but it's dangerous for anyone who has previously compiled against BigQuery and then tries to use that precompiled jar with a new version of BigQuery at runtime. Given that, this PR would in principle justify a major-version bump, but I don't know how big the danger is in practice.

@cushon
Copy link
Contributor Author

cushon commented Sep 10, 2024

Would it make sense to leave the old method in place but as @Deprecated method that forwards to the new one?

Thanks, I'm going to try that out, I pushed another commit.

@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: xs Pull request size is extra small. labels Sep 10, 2024
@cushon
Copy link
Contributor Author

cushon commented Sep 10, 2024

I'm still getting a clirr error, any ideas what why the exemption isn't sufficient?

Error:  Unable to locate enclosing class com.google.cloud.bigquery. for nested class com.google.cloud.bigquery.$AutoValue_Annotations
Error:  7013: com.google.cloud.bigquery.TableResult$Builder: Abstract method 'public com.google.cloud.bigquery.TableResult$Builder setTotalRows(long)' has been added

<difference>
<differenceType>7005</differenceType>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<differenceType>7005</differenceType>
<differenceType>7013</differenceType>

It looks like it's now complaining about a new abstract method, I assume on the theory that subclasses would have to implement it. Given that the only subclass here will be the one generated by AutoValue (I hope :)), we should be able to suppress that, too.

Since the old method continues to exist in this iteration of the PR, that suppression can replace the old one from the time of the method removal. With that change, JOB_TYPE=clirr .kokoro/build.sh appears to pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/java-bigquery API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableResult.java does unnecessary boxing
3 participants