-
Notifications
You must be signed in to change notification settings - Fork 519
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
Avoid Java compiler errors around invoking unqualified methods called "yield" in generated decoders in Java 17 #910
Comments
writeoncereadmany
pushed a commit
to writeoncereadmany/simple-binary-encoding
that referenced
this issue
Jul 27, 2022
writeoncereadmany
pushed a commit
to writeoncereadmany/simple-binary-encoding
that referenced
this issue
Jul 27, 2022
This now generates code that compiles in Java 17 for groups, composites and fields named "yield", and demonstrates the need for each of these. There are many paths through the JavaGenerator I have not yet tested (or implemented).
writeoncereadmany
pushed a commit
to writeoncereadmany/simple-binary-encoding
that referenced
this issue
Jul 27, 2022
This now generates code that compiles in Java 17 for all the paths through writeTokenDisplay I can find, and I think that's all that's needed here?
writeoncereadmany
pushed a commit
to writeoncereadmany/simple-binary-encoding
that referenced
this issue
Jul 27, 2022
…d and groups with a field called yield, ie that recursive rendering works the way I'd hope and expect.
I believe that's all the paths through writeTokenDisplay in JavaGenerator handled with this-qualification, and that's the only place this error can arise. At the very least, this is a start :) |
writeoncereadmany
pushed a commit
to writeoncereadmany/simple-binary-encoding
that referenced
this issue
Jul 28, 2022
… than an entry in the build file. Note: this only fails when running with a Java 17 toolchain, not on Java 8 or 11.
writeoncereadmany
pushed a commit
to writeoncereadmany/simple-binary-encoding
that referenced
this issue
Jul 28, 2022
writeoncereadmany
pushed a commit
to writeoncereadmany/simple-binary-encoding
that referenced
this issue
Jul 28, 2022
writeoncereadmany
pushed a commit
to writeoncereadmany/simple-binary-encoding
that referenced
this issue
Jul 28, 2022
writeoncereadmany
pushed a commit
to writeoncereadmany/simple-binary-encoding
that referenced
this issue
Jul 28, 2022
mjpt777
pushed a commit
that referenced
this issue
Jul 28, 2022
* Test to replicate compiler errors in decoders on JDK17 when a field is called "yield" #910 * #910 Start fixing unqualified yield errors This now generates code that compiles in Java 17 for groups, composites and fields named "yield", and demonstrates the need for each of these. There are many paths through the JavaGenerator I have not yet tested (or implemented). * #910 Finish(?) fixing unqualified yield errors This now generates code that compiles in Java 17 for all the paths through writeTokenDisplay I can find, and I think that's all that's needed here? * #910 Add a test to ensure we handle both groups called yield and groups with a field called yield, ie that recursive rendering works the way I'd hope and expect. * #910 Use a unit test to highlight compilation errors rather than an entry in the build file. Note: this only fails when running with a Java 17 toolchain, not on Java 8 or 11. * #910 Restrict test to run only on JRE17, and generate updated IR codecs * #910 Fix checkstyle * #910 Remove unnecessary property from unit test * #910 Remove unused import Co-authored-by: tom.johnson <tom.johnson@transficc.com>
Fix merged, thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More recent versions of Java introduce errors when invoking unqualified methods called "yield". For example, in Java 17:
Our build process fails on warnings, and builds decoders written using the JavaGenerator.
Those decoders include a appendTo method, which has patterns like:
where the method names are based on the field names. When we have a field called yield - which we need, that's the domain concept, this yields (if you'll pardon the pun) this compiler error.
One simple fix is - if it were instead:
it would not raise the error.
I'll start by trying to create a unit test to reproduce the problem.
The text was updated successfully, but these errors were encountered: