Skip to content

Add a little clarification about static factory methods versus record constructors. #1913

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 1 commit into from
Mar 26, 2025

Conversation

copybara-service[bot]
Copy link
Contributor

Add a little clarification about static factory methods versus record constructors.

The text here was intended to be about the common case where your AutoValue class Foo has a single static factory method which calls the generated AutoValue_Foo constructor. Then if you replace Foo with a record, there's not a whole lot of benefit to maintaining the method, apart from easing migration. But one benefit is that methods have names. This is mostly relevant when you have several static factory methods.

RELNOTES=n/a

… constructors.

The text here was intended to be about the common case where your AutoValue class `Foo` has a single static factory method which calls the generated `AutoValue_Foo` constructor. Then if you replace `Foo` with a record, there's not a whole lot of benefit to maintaining the method, apart from easing migration. But one benefit is that methods have names. This is mostly relevant when you have _several_ static factory methods.

RELNOTES=n/a
PiperOrigin-RevId: 740873396
@copybara-service copybara-service bot force-pushed the test_main_740862336 branch from 9b4202f to a682925 Compare March 26, 2025 19:59
@copybara-service copybara-service bot merged commit a682925 into main Mar 26, 2025
@copybara-service copybara-service bot deleted the test_main_740862336 branch March 26, 2025 19:59
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.

1 participant