You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Duplicate entries inside annotation listing are a common mistake that should be flagged.
Description of the proposed new feature
Support a stylistic preference.
Avoid a common gotcha, or potential problem.
Improve performance.
Introduce a new BugChecker to flag duplicate entries as this is a common mistake. Similar to LexicographicalAnnotationListing, the new BugChecker should identify and handle duplicate entries to improve code quality and reduce potential errors.
I would like to rewrite the following code:
@A("foo", "bar", "foo")
AduplicateAnnotations();
to:
@A("foo", "bar")
AduplicateAnnotations();
Considerations
👉 To consider: A duplicate entry is a duplicate pointer reference and not just the same name.
👉 Open question: Are there situations where we do not want to flag this ?
Participation
I am willing to submit a pull request to implement this improvement.
(Repeated annotations such as @Baz() @Baz() are rejected by the compiler, unless they're declared @Repeatable, in which case the repetition likely is intended.)
Edit: I see that this comment is indeed located on the wrong class. That's my fault!
I'm not sure how pointer references factor in, but since only primitives, enum values and strings can be annotation arguments, the invariant holds that a value is a duplicated if and only if it is equal to some other value inside the same annotation attribute.
There are likely cases we'll want to exclude, but none come to mind right now. We might want to run a first version against the Picnic code base to assess what is flagged.
Problem
Duplicate entries inside annotation listing are a common mistake that should be flagged.
Description of the proposed new feature
Introduce a new BugChecker to flag duplicate entries as this is a common mistake. Similar to
LexicographicalAnnotationListing
, the new BugChecker should identify and handle duplicate entries to improve code quality and reduce potential errors.I would like to rewrite the following code:
to:
Considerations
👉 To consider: A duplicate entry is a duplicate pointer reference and not just the same name.
👉 Open question: Are there situations where we do not want to flag this ?
Participation
Additional context
See this comment.
Edit 1: Update requirements based on this.
The text was updated successfully, but these errors were encountered: