This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Suppress CheckStyle Warning  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a checkstyle warning

Member Names: Name 'userName' must match pattern '^[a-z][a-zA-Z0-9]*$'.

I want to supress this warning.

What argument should I pass to @SuppressWarnings annotation?

Thanks
 
Sheriff
Posts: 21464
97
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read your private messages regarding an important announcement.

Thank you,

Rob


That said, something tells me you're not posting everything; userName already matches that regular expression. Where did you get this warning from?
 
author
Posts: 3281
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using an IDE?
 
sdeepa redd
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using eclipse. Sorry abt the "userName". It is "UserName" with capital U.
 
author & internet detective
Posts: 38906
684
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

sdeepa redd wrote:I am using eclipse. Sorry abt the "userName". It is "UserName" with capital U.


Why not change the code? It's convention to use a lowercase letter to begin a variable name.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm with Jeanne on this one--unless you have a compelling reason for not following one of the most common code conventions it's probably best to follow it.

That said, you can change the regex used for Checkstyle's naming rules in its config file. For instance, some places I've worked use leading and trailing underscores for members and parameters respectively, and we've configured Checkstyle appropriately.
 
A wop bop a lu bob a womp bam boom. Tutti frutti ad:
Download Free Java APIs to Work with Office Files and PDF
htttp://www.e-iceblue.com/free-apis.html
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!