See https://wikis.forgerock.org/confluence/display/devcom/Coding+Style+and+Guidelines for details of ForgeRock's coding style and guidelines. OpenAM specific aspects are covered below.
Package and class naming
In general when introducing new source files into the repository they should be beneath the package name of
org.forgerock.openam. Exceptions can be made, for example:
- If existing code is package private and would have to be re-factored, the new code should be introduced into the existing package hierarchy.
- If the class is very tightly integrated with the specific set of classes within a package then a strong case can be made to co-locate them.
If the developer has doubts as to the package where their new class should reside then please send an email to the openam_eng mailing list.
When editing an existing file use your common sense as to code re-factoring. If you are updating a method consider the following:
- If there is an iterator being used; can you switch to using for-each.
- Make sure that you use generics where possible; so
Set foo = new HashSet();would become
Set<String> foo = new HashSet<>();
Generics should always be used in new code and old code re-factored where possible.
- Move from StringBuffer to StringBuilder
- Fix trivial IDE warnings such as @Override annotations missing and such like.