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

unnecessary_setters_getters should allow when one is deprecated #58120

Closed
srawlins opened this issue Jan 31, 2020 · 2 comments · Fixed by dart-lang/linter#2027
Closed

unnecessary_setters_getters should allow when one is deprecated #58120

srawlins opened this issue Jan 31, 2020 · 2 comments · Fixed by dart-lang/linter#2027
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-false-positive type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@srawlins
Copy link
Member

I have code that looks like this:

class C {
  List<dynamic> _captured;

  List<dynamic> get captured => _captured;

  @Deprecated(
      'captured should be considered final - assigning this field may be '
      'removed as early as Mockito 5.0.0')
  set captured(List<dynamic> captured) => _captured = captured;
}

Both the setter and getter have been flagged by unnecessary_setters_getters, but I think they should be allowed, as one is @Deprecated.

@srawlins srawlins added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Jan 31, 2020
@pq
Copy link
Member

pq commented Feb 1, 2020

I tend to agree.

@bwilkerson?

@bwilkerson
Copy link
Member

It wouldn't be inconsistent if deprecated elements were treated like they were already gone. Not sure how often this comes up, but I wouldn't object to it.

See also #58119 for another possible tweak to the rule.

@devoncarew devoncarew added analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-lang/linter Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-false-positive type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants