Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

WIP

 

Table of Contents

Getting ready to contribute to NetBeans

...

And remember: These are guidelines, not laws.

Streaming API considerations

Avoid using unnecessary streaming API constructs. For instance, this code:

Code Block
languagejava
for (Transaction commit : SPIAccessor.DEFAULT.getCommits(bag)) {
	SPIAccessor.DEFAULT.check(commit, true);
}

Is perfectly readable and performant, but it could be transformed to the Streaming API equivalent:

Code Block
languagejava
SPIAccessor.DEFAULT.getCommits(bag).forEach((commit) -> SPIAccessor.DEFAULT.check(commit, true));

But the resulting code will be slower and more difficult to debug, so the change does not really add more value to the source code.

When using the Streaming API always try to write readable constructs and make the code easy to debug (by splitting complex streaming API constructs in multiple lines, for instance).

Keep explicity typing

Try not to remove typing when using generics with the diamond operator. So, for instance, you could replace

Code Block
languagejava
ArrayList<JCVariableDecl> fieldGroup = null;
// lots of lines here...
fieldGroup = new ArrayList<JCVariableDecl>();

With

Code Block
languagejava
ArrayList<JCVariableDecl> fieldGroup = null;
// lots of lines here...
fieldGroup = new ArrayList<>();

This is, you could use the diamond operator in the assignment, but this will result in a less readable code. Try to keep explicit typing visible as much as possible, pondering always readability over syntax sugar.

Internationalization

If the source code might be translated to other languages then please add the comment `// NOI18N` to the string literals that must not be translated. Strings to be translated should be properly added to resource bundles.

...