Skip to content

Add missing CopyableBuilder interfaces and fixed buggy ones. #3267

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

Merged
merged 3 commits into from
Jun 24, 2022

Conversation

millems
Copy link
Contributor

@millems millems commented Jun 23, 2022

Add CopyableBuilder and ToCopyableBuilder interfaces to credential providers. Also added spotbugs rule to validate that these and all other toBuilder methods are correct. Fixed any issues found with existing methods.

@millems millems requested a review from a team as a code owner June 23, 2022 23:51
Comment on lines 164 to 168
builders.put(obj.getClassName(), obj);
builderParents.put(obj.getClassName(),
Stream.concat(Arrays.stream(parentInterfaces), Arrays.stream(obj.getSuperClasses()))
.map(JavaClass::getClassName)
.collect(Collectors.toSet()));
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the same code will get executed for any matching i. Is there a way to break it out of the loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch, yes!

Copy link
Contributor Author

@millems millems Jun 24, 2022

Choose a reason for hiding this comment

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

Technically it might be slower this way with it outside of the loop, since most classes won't have a matching value and none will have multiple matching values (enforced in the interface visitation logic).

millems added 2 commits June 24, 2022 11:54
…ed when ToCopyableBuilder.toBuilder is invoked.

Also fixed any violations that rule found.
@millems millems force-pushed the millem/master/copyable-builder-validation branch from e30f139 to 922ccc3 Compare June 24, 2022 18:54
@millems millems enabled auto-merge (squash) June 24, 2022 21:16
@millems millems merged commit 43d3e6b into master Jun 24, 2022
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 24 Code Smells

32.6% 32.6% Coverage
0.4% 0.4% Duplication

@millems millems deleted the millem/master/copyable-builder-validation branch June 24, 2022 22:48
aws-sdk-java-automation added a commit that referenced this pull request Sep 20, 2024
…c36f85568

Pull request: release <- staging/317dd499-2aca-470a-9809-3e2c36f85568
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.

2 participants