Skip to content

Conversation

@jimexist
Copy link
Member

@jimexist jimexist commented Apr 12, 2022

java generator to add @OverRide where possible

  • Did you create an Apache Jira ticket? (not required for trivial changes)
  • If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • Did you squash your changes to a single commit? (not required, but preferred)
  • Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
  • If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.

@jimexist jimexist changed the title java generator to add @Override where possible THRIFT-5551: java generator to add @Override where possible Apr 12, 2022
Copy link
Member

@ctubbsii ctubbsii left a comment

Choose a reason for hiding this comment

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

These changes are harder to review than necessary, because they contain a lot of style changes. I would recommend minimizing the changes in this PR by retaining the existing style, so it's easier to review. For style standardization/improvements, I'd suggest creating a separate PR that does only that and no substantive changes.

@jimexist
Copy link
Member Author

These changes are harder to review than necessary, because they contain a lot of style changes. I would recommend minimizing the changes in this PR by retaining the existing style, so it's easier to review. For style standardization/improvements, I'd suggest creating a separate PR that does only that and no substantive changes.

Thanks for the suggestion - I wonder it too. The formatting changes were made by my editor, and I don't have a good way to separate it from the actual changes now.

If it's okay do you think I can create a separate, clean, style only change and merge that first. And then this change can be much cleaner? @ctubbsii

@ctubbsii
Copy link
Member

If it's okay do you think I can create a separate, clean, style only change and merge that first. And then this change can be much cleaner?

Yeah, I think that would be a good option. If a standard style can be enforced by people with any editor, something like what the formatter-maven-plugin provides for Java code, that would be even better, I would think.

@jimexist
Copy link
Member Author

jimexist commented Apr 12, 2022

yes @ctubbsii the tool is clang-format and it's also centrally configured here - which is also what my editor formatting is relying on.

@ctubbsii
Copy link
Member

I just learned about clang-format. It seems nice... but a quick check shows it's defaults would change a lot of thrift code, and not always for the better. I'm not sure if the Thrift community would endorse its use, but there is a .clang-format file in the root directory. It seems it hasn't been run in awhile. It might be easier to just look over this PR and try to undo the formatting changes. Or, just rely on reviewers to figure it out.

@jimexist jimexist force-pushed the java-gen-add-annotation branch from c8cf896 to 46aaed2 Compare April 12, 2022 03:30
@ctubbsii
Copy link
Member

@jimexist I think you need to rebase and force-push to get this up-to-date.

@jimexist jimexist force-pushed the java-gen-add-annotation branch from 46aaed2 to 806886b Compare April 12, 2022 04:16
Copy link
Member

@ctubbsii ctubbsii left a comment

Choose a reason for hiding this comment

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

Overall, this looks pretty good to me. I haven't verified that all the new uses are actually overrides, but it will be pretty obvious if they aren't... it will generate code that won't compile if they aren't.

Co-authored-by: Christopher Tubbs <ctubbsii@apache.org>

void t_java_generator::generate_java_struct_clear(std::ostream& out, t_struct* tstruct) {
if (!java5_) {
indent(out) << "@Override" << endl;
Copy link
Member Author

Choose a reason for hiding this comment

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

@Override is _since_ 5.0

indent(f_service_) << " this.clientManager = clientManager;" << endl;
indent(f_service_) << " this.protocolFactory = protocolFactory;" << endl;
indent(f_service_) << " }" << endl;
indent(f_service_) << " @Override" << endl;
Copy link
Member

Choose a reason for hiding this comment

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

That's a test, right? Seen and fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants