googleapis / java-bigquery

Apache License 2.0
112 stars 121 forks source link

fix: unnecessary boxed primitives in AutoValue classes #3460

Open cushon opened 3 months ago

cushon commented 3 months ago

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 https://github.com/google/auto/commit/328a25c161b4423ff71b38054d3f2502da394d37

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:

Fixes #3459 ☕️

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

PhongChuong commented 3 months ago

/gcbrun

PhongChuong commented 3 months ago

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

conventional-commit-lint-gcf[bot] commented 3 months ago

🤖 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/

cushon commented 3 months ago

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 commented 2 months ago

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

cpovirk commented 2 months ago

@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 commented 2 months ago

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.

cushon commented 2 months ago

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