-
Notifications
You must be signed in to change notification settings - Fork 246
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
(jsii) incorrect deprecation warning when two string enums have the same value #3103
Comments
I'm not convinced this is fixable with the current implementation (or at all). We are checking at the site of usage if the enum matches any of the deprecated enum values. At this point (for this example), the value of the parameter passed in is just I think we can either accept a false positive here (warning people erroneously) or we could detect that there are duplicate enum values and do nothing, leading to false negatives (not warning people). I suppose the latter is better, but it's crap either way. |
Feels like the better option is to not warn in these cases. |
…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
…alues (#3105) 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]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
|
🐛 Bug Report
When two string enums have the same value and one is deprecated, the flag
--add-deprecation-warnings
incorrectly produces a warning when the non-deprecated enum is used.Example:
https://github.com/aws/aws-cdk/blob/c4ba858278bffe1a987ea8200c313f17f7f1cbe9/packages/%40aws-cdk/core/lib/custom-resource-provider/custom-resource-provider.ts#L83-L93
The text was updated successfully, but these errors were encountered: