This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin 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
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 21602
101
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
7
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: 39129
723
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.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!