These are our basic style rules for new Java code in LanguageTool. For IntelliJ IDEA, you might want to use these inspection settings.
if
block.final
for parameters or local variables, but write your
code as if there was a final
, i.e. do not re-assign local variables.
Configure your IDE to help you with that.
final
for member variables if possible.@deprecated
javadoc tag to document the method/class
to be used instead.@since x.y
javadoc annotation to all new non-private methods,
with x.y
being the version number of the next release.@Nullable
to methods that might return null
, no matter if
these methods are public or not.language-en
and language-core
. It is known as split package
problem that prevent a migration for Java Platform Module System (JPMS)
introduced in Java 9. Each individual language module should have its own
and unique package path which will end with a language code,
ex. org.languagetool.language.en
and org.languagetool.language.rules.en
for English language project.Examples for proper use of whitespace:
if (var == 2) {
statements;
}
if (var != 3) {
statements;
} else {
statements;
}
if (var == 1 && foo == 5) {
statements;
} else if (condition) {
statements;
} else if (condition) {
statements;
}
try {
statement;
} catch (Exception e) {
statement;
} finally {
statement;
}