• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Checkstyle code formatting import and pattern errors.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I'm just about to submit my assignment to Sun. (I haven't had to ask any questions up to now due to the quality of responses already posted to the forum ) and I'm getting a lot of errors when I run checkstyle. I've been able to resolve the vast majority of these. However, I am getting the following 2 errors and I would be very grateful if somebody could let me know if they can be ignored or not.

1. "Using the '.*' form of import should be avoided - java.awt.*." I know that I'm getting this message because I'm importing a package using the *. However, the reason I'm doing this is that in some of my source code files, I'm using more than 3 classes from the relevant package. Does it sound reasonable to just explain this in my choices.txt?

2. "Name 'magicCookieLocation' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'." . The code been complained about here is the following:
Even if I change the name magicCookieLocation to magiccookielocation, it still doesn't work

Any suggestions would be very much appreciated. While these are just minor issues, I need to get them resolved. This is because of the high percentage required to pass and because projects submitted are subject to some form of automatic validation before an examiner even looks at them.

Best Regards,
Ger Loughnane.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ger,

Welcome to the JavaRanch!

I'm just about to submit my assignment to Sun. (I haven't had to ask any questions up to now due to the quality of responses already posted to the forum)

Great job!

1/ I used Eclipse as IDE to develop my assignment and I always used the "Organize Imports" function. Result: every import is being listed in the source file, no shortcut notation like java.awt.* is used. I don't know if there are any "rules" about this issue, but I think you should use one or the other consistently throughout all your code files

2/ magicCookieLocation is a constant and constants should be declared in upper case, different parts seperated by an underscore. So if you rename to MAGIC_COOKIE_LOCATION the warning will disappear.

I didn't use any of these tools to check my code style. When you use a decent IDE (like Eclipse) and you are familiar with the most code conventions you are good to go. Afterwards I used some of these tools to check my code and my experiences can be read here.

Kind regards,
Roel
 
Ger Loughnane
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Roel,

Thanks for the response. Its been very useful.

Best Regards,
Ger.
reply
    Bookmark Topic Watch Topic
  • New Topic