• 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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: 21459
96
Chrome Eclipse IDE Java 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
Bartender
Posts: 3280
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
Sheriff
Posts: 38569
659
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
Rancher
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!