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

Migrate code away from anonymous class using initializers #10633

Conversation

findepi
Copy link
Member

@findepi findepi commented Jan 15, 2022

While it's possible to create a pre-populated collection using new CollectionClass() { { ... add elements ... } }, it is not the idiomatic
way to do it.

@cla-bot cla-bot bot added the cla-signed label Jan 15, 2022
@findepi findepi force-pushed the findepi/migrate-code-away-from-anonymous-class-using-initializers-56c2d4 branch from 746e099 to b5eb717 Compare January 15, 2022 11:12
Copy link
Member

@hashhar hashhar left a comment

Choose a reason for hiding this comment

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

Thank you.

@hashhar
Copy link
Member

hashhar commented Jan 15, 2022

Does either ErrorProne or Modernizr provide some way to enforce this?

@findepi
Copy link
Member Author

findepi commented Jan 15, 2022

Does either ErrorProne or Modernizr provide some way to enforce this?

I can try to imagine legitimate use-case for an initializer in an anonymous class.

Also adds necessary dependencies to make sure such problems are detected
in the module.
While it's possible to create a pre-populated collection using `new
CollectionClass() { { ... add elements ... } }`, it is not the idiomatic
way to do it.
checkRequest(server.takeRequest(5, TimeUnit.SECONDS), new HashMap<>() {{
put("Authorization", "Trust Me!");
put("Cache-Control", "no-cache");
}}, queryCompleteEvent);
Copy link
Member Author

Choose a reason for hiding this comment

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

i lost queryCompleteEvent.
i don't understand how CI figured this out, as this test method is not @Test annotated (#10635), yet it failed (https://github.com/trinodb/trino/runs/4826429554?check_suite_focus=true)

@findepi findepi force-pushed the findepi/migrate-code-away-from-anonymous-class-using-initializers-56c2d4 branch from b5eb717 to a0cdaa0 Compare January 15, 2022 21:48
@findepi findepi merged commit 53596c3 into trinodb:master Jan 16, 2022
@findepi findepi deleted the findepi/migrate-code-away-from-anonymous-class-using-initializers-56c2d4 branch January 16, 2022 20:43
@github-actions github-actions bot added this to the 369 milestone Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants