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

Feature/avoid hashmapint #1773

Merged
merged 8 commits into from
May 21, 2021
Merged

Feature/avoid hashmapint #1773

merged 8 commits into from
May 21, 2021

Conversation

davidscottcohen
Copy link
Contributor

Before this PR

new HashMap(int) is confusing

After this PR

==COMMIT_MSG==
==COMMIT_MSG==

Possible downsides?

@changelog-app
Copy link

changelog-app bot commented May 21, 2021

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Feature/avoid hashmapint

Check the box to generate changelog(s)

  • Generate changelog entry

@policy-bot policy-bot bot requested a review from jkozlowski May 21, 2021 17:15
@carterkozak
Copy link
Contributor

Recreated from #1771

Copy link
Contributor

@carterkozak carterkozak left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@bulldozer-bot bulldozer-bot bot merged commit 4af9ce6 into develop May 21, 2021
@bulldozer-bot bulldozer-bot bot deleted the feature/avoid-hashmapint branch May 21, 2021 20:03
@svc-autorelease
Copy link
Collaborator

Released 3.87.0

@pkoenig10
Copy link
Member

pkoenig10 commented May 22, 2021

The intention of this check conflicts with PreferCollectionConstructors. It's a bit confusing for devs to have JDK constructors preferred in some cases and Guava static factory methods preferred in others.

pkoenig10 added a commit that referenced this pull request May 22, 2021
@carterkozak
Copy link
Contributor

The intention of this check conflicts with PreferCollectionConstructors. It's confusing for devs to have JDK constructors preferred in some cases and Guava static factory methods preferred in others.

The hashmap(int) ctor itself is confusing, and it can cause serious problems when it's used expecting to insert the given number of elements when the value is used to size the hash table instead. That's why the PreferCollectionConstructors was implemented specifically to avoid flagging Maps.newHashMapWithExpectedSize(int)

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

Successfully merging this pull request may close these issues.

5 participants