User Tools

Site Tools


OAuth: login failed No such service Facebook
info:java

Java

Code conventions

  • Classes have a name starting with an uppercase character, should contain a noun
  • Methods start with a lowercase character and should contain a verb
  • Packages are all lowercase
  • Members start lowercase, or all uppercase if static

Classes

  • Members are private in all cases, unless static
  • Members initialized in constructor are final.
  • Static members should be final, can be public in that case

Inner classes can divert from those rules, but should never be exported to outside the containing compilation unit. Declare all inner classes as package-private, i.e. no visibility modifier. If declared private, Java needs to generate synthetic accessor methods.

Debugging annotations in Eclipse

To find out what's wrong with a text annotation (it's created, but nothing can be seen in the text viewer), set a break point on org.eclipse.jface.text.source.AnnotationPainter, method getDecoration(Annotation annotation, Decoration decoration). It can be found around line 826 in 3.6.2.

info/java.txt · Last modified: 2015/02/26 08:56 by moritz

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki