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

fix(jsii): deprecation warnings erroneously warn for duplicate enum values #3105

Merged
merged 2 commits into from
Oct 28, 2021

Conversation

njlynch
Copy link
Contributor

@njlynch njlynch commented Oct 28, 2021

The deprecation warnings feature will warn if an enum value is used which is
equal to one to a deprecated enum member. Unfortunately, in the case of an enum
with duplicate values, there is no way to tell whether the deprecated member was
used (or not). The current behavior emits warnings even in cases where the
active/undeprecated member is being used.

This change flips the behavior to mute the notification in the case where the
value used is a known duplicate value. This results in erring on the side of
false negatives (not catching deprecated usage) over false positives (warning in
the case nothing's wrong).

fixes #3103


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…alues

The deprecation warnings feature will warn if an enum value is used which is
equal to one to a deprecated enum member. Unfortunately, in the case of an enum
with duplicate values, there is no way to tell whether the deprecated member was
used (or not). The current behavior emits warnings even in cases where the
active/undeprecated member is being used.

This change flips the behavior to mute the notification in the case where the
value used is a known duplicate value. This results in erring on the side of
false negatives (not catching deprecated usage) over false positives (warning in
the case nothing's wrong).

fixes #3103
@njlynch njlynch requested a review from a team October 28, 2021 15:11
@njlynch njlynch self-assigned this Oct 28, 2021
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Oct 28, 2021
Copy link
Contributor

@MrArnoldPalmer MrArnoldPalmer left a comment

Choose a reason for hiding this comment

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

LGTM. We could use a .some() instead of a filter().length but just a nit.

@mergify
Copy link
Contributor

mergify bot commented Oct 28, 2021

Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it!

@mergify mergify bot added the pr/ready-to-merge This PR is ready to be merged. label Oct 28, 2021
@mergify
Copy link
Contributor

mergify bot commented Oct 28, 2021

Merging (with squash)...

@mergify
Copy link
Contributor

mergify bot commented Oct 28, 2021

Merging (with squash)...

@mergify mergify bot merged commit c477422 into main Oct 28, 2021
@mergify mergify bot deleted the njlynch/fix-3103 branch October 28, 2021 22:11
@mergify mergify bot removed the pr/ready-to-merge This PR is ready to be merged. label Oct 28, 2021
@njlynch
Copy link
Contributor Author

njlynch commented Oct 29, 2021

LGTM. We could use a .some() instead of a filter().length but just a nit.

I'm checking .filter().length > 1 (looking for 2 or more results).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(jsii) incorrect deprecation warning when two string enums have the same value
2 participants