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

New Check: ForbidWildcardAsReturnType #75

Closed
romani opened this Issue Nov 3, 2012 · 0 comments

Comments

Projects
None yet
2 participants
@romani
Member

romani commented Nov 3, 2012

ForbidWildcardAsReturnType.

Joshua Bloch, "Effective Java (2nd edition)" Item 28: page 137 :
"Do not use wildcard types as return
types. Rather than providing additional flexibility for your users, it would force
them to use wildcard types in client code.
Properly used, wildcard types are nearly invisible to users of a class. They
cause methods to accept the parameters they should accept and reject those they
should reject. If the user of a class has to think about wildcard types, there is
probably something wrong with the class’s API."

Options:

  • check public method (boolean) (default value = true)
  • check protected method (boolean) (default value = true)
  • check protected-package methods (boolean) (default value = true)
  • check private methods (boolean) (default value = false)
  • allow Wildcard with "super" (boolean). example: "? super T" (default value = false)
  • allow Wildcard with "extends" (boolean). example: "? extends T" (default value = false)
  • ignore list for Class names (regexp), example "Comparable<? super T>". (default value = "Comparable|Comparator")

http://sourceforge.net/p/checkstyle/feature-requests/580/

@ghost ghost assigned baratali Jul 11, 2013

baratali added a commit to baratali/sevntu.checkstyle that referenced this issue Jul 30, 2013

baratali added a commit to baratali/sevntu.checkstyle that referenced this issue Aug 10, 2013

baratali added a commit to baratali/sevntu.checkstyle that referenced this issue Aug 13, 2013

baratali added a commit to baratali/sevntu.checkstyle that referenced this issue Aug 21, 2013

baratali added a commit to baratali/sevntu.checkstyle that referenced this issue Aug 21, 2013

baratali added a commit to baratali/sevntu.checkstyle that referenced this issue Aug 22, 2013

@romani romani closed this in #127 Aug 22, 2013

romani added a commit that referenced this issue Aug 22, 2013

Merge pull request #127 from baratali/iss75
Fixes #75. ForbidWildcardAsReturnTypeCheck was introduced.

daniilyar added a commit to daniilyar/sevntu.checkstyle that referenced this issue Sep 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment