-
Notifications
You must be signed in to change notification settings - Fork 15.7k
Generated Java code causes "redundant cast to Builder" warnings #5139
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
Comments
Would you be willing to accept a pull request that fixes this? |
Thanks for accepting the fix! @BSBandme What's your policy regarding new releases, how often are releases made? Not asking that you make a release immediately, just want to know how to set my expectations 🙂 |
@acozzette You seem to have tagged a 3.6.1.1 release 7 days ago, but this version is not yet available in Maven Central from what I can tell: https://search.maven.org/search?q=g:com.google.protobuf Also, this commit (dc81f79) doesn't seem to be present on the 3.6.x branch for now: v3.6.1...3.6.x, so I'm pretty certain it isn't included in the version that got tagged as 3.6.1.1. If you could cherry-pick this change (or, make someone else do it) and put out a 3.6.1.2 or 3.6.2 version, me (and others) would be incredibly thankful. Thanks in advance! 👍 |
@perlun That 3.6.1.1 release was just meant to include an important fix that was blocking the Bazel 0.20 release, so I tagged a commit without doing a full release and publishing artifacts and everything. We are going to do a real 3.7 release soon, so that will include all the changes that are currently on master. |
@acozzette Wonderful, thanks for the update. 👍 |
any update on the timeline for new release? |
Ping @acozzette or others - any updates? (I was reminded about this now since it floods our build output) |
Another ping, any ETA for the next release? |
We are working on it now. I think it's probably ready to go but we're going to do another rc release just to be safe before we release 3.7.0. |
Seems this issue is still not fixed in |
please reopen as requested in #8208 by @perezd in #8208 (comment). |
Oops, didn't realize it was closed. |
Hi, any progress on this? |
Has this been reproduced w/ our latest java release? (3.17) |
Huh, maybe you could add a test. PR #5247 sadly did not add any. |
The script in attachment, with
|
We'll accept PRs to resolve this similar to the others if you'd like. |
You already did this for non-lite versions: |
Great! That'll make it easier for someone to send us a PR, appreciate it! |
Fixes #5139 Previously the fix #5247 has removed unnecessary cast to Builder in generated Java code, and the current PR is doing a similar one for Java lite code. After this PR, both Java and Java lite code won't have an unnecessary cast to Builder, thus #5139 will be fixed. This change simply removed those casts to Builder for 2 methods, and the reason it will work is: DEFAULT_INSTANCE.createBuilder method is defined in the superclass, and the return value is a generic value which is exactly the Builder class passed in. Closes #10781 COPYBARA_INTEGRATE_REVIEW=#10781 from 1e0ng:main e8f9c98 FUTURE_COPYBARA_INTEGRATE_REVIEW=#10781 from 1e0ng:main e8f9c98 PiperOrigin-RevId: 532797271
Uh oh!
There was an error while loading. Please reload this page.
What version of protobuf and what language are you using?
Version: v3.6.1
Gradle plugin version: v0.8.6
Language: Java
What operating system (Linux, Windows, ...) and version?
Ubuntu 16.04
What runtime / compiler are you using (e.g., python version or gcc version)
What did you do?
I don't know if this is a regression or always has been like this, this is the first time I'm using the protobuf java stuff.
I prepared a project demonstrating the issue https://github.com/slovdahl/protobuf-java-warnings, but in short:
./gradlew compileJava
, which generates the java code and compiles the generated code.What did you expect to see
No java compiler warnings.
What did you see instead?
The text was updated successfully, but these errors were encountered: