Skip to content

Comments

Test duplicate client method fix#3063

Closed
anuchandy wants to merge 1 commit intoAzure:mainfrom
anuchandy:autorest-check-media-type-regression
Closed

Test duplicate client method fix#3063
anuchandy wants to merge 1 commit intoAzure:mainfrom
anuchandy:autorest-check-media-type-regression

Conversation

@anuchandy
Copy link
Member

No description provided.

@anuchandy anuchandy changed the title test duplicate client method fix Test duplicate client method fix Apr 3, 2025
github-merge-queue bot pushed a commit to microsoft/typespec that referenced this pull request Apr 3, 2025
This PR addresses a regression introduced in the
[PR](#6737).

In 6737, a `List<MethodTransformationDetails>` representing mappings
were replaced with a new type `ParameterTransformations` that composes
an `immutable` list of mapping.

The original list was the JDK `ArrayList<>` that internally implements
`equals()` and `hashcode()` (e.g., those equality impl ensures different
list with zero elements as equal).

The new type `ParameterTransformations` introduced inherits the
`equals()` and `hashcode()` from `Object`, so two distinct references
are always different. Additionally, the composed `immutable` list is JDK
`ImmutableList`, unlike `ArrayList`, it doesn’t not implement `equals()`
and `hashcode()` but inherits Object's.

The `ClientMethod` composes `ParameterTransformations ` (earlier `List<
MethodTransformationDetails >`) property.

The generator needs to find distinct list of `ClientMethods`, and the
proper comparison requires all composed properties type to support
equality checks. So, with changes 6737, there were duplicate
`ClientMethod`, resulting in emitted Java class to have same function
appears twice.

Fixes: Azure/autorest.java#3061

Autorest [PR](Azure/autorest.java#3063)
@anuchandy anuchandy closed this Apr 11, 2025
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