Hi,

I've added quite some '@Nullable' annotations to methods. They indicate 
that a method might return null. How does that help? Assume you have 
code like this:

myObject.foo().someMethod();

Now if foo() returns null, this would throw a NullPointerException. But 
when foo() has been annotated (e.g. "@Nullable public String foo() 
{...}"), your IDE can warn you about this code. IntelliJ warns by 
default, not sure about Eclipse.

I suggest that all methods that may return null should be annotated with 
@Nullable (org.jetbrains.annotations.Nullable), not just public methods. 
Anyway, often it's even better to not return null, e.g. if a list is 
returned, the list may be empty but not null. Also, for public methods 
it should be documented in javadoc when a method can return null.

Regards
  Daniel


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Languagetool-devel mailing list
Languagetool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-devel

Reply via email to