Community
Participate
Working Groups
Null analysis of fields seems to not work at all. The simplest test case that I could think of package pkg; import org.eclipse.jdt.annotation.NonNull; public class Main { @NonNull Object f; public void meth() { this.f = null; } } yields no error/warning. I have all options under "Warnings/Null analysis" switched on. Am I doing something wrong?
P.S.: My definition of "NonNull" is package org.eclipse.jdt.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE}) @Documented @Retention(RetentionPolicy.CLASS) public @interface NonNull { }
Oh, I just saw https://bugs.eclipse.org/bugs/show_bug.cgi?id=331649 This means that the feature will make it into 4.3 M5, great!
Will be implemented in 4.3.
In fact, you can just grab one of the recent I builds and start using this feature. And of course, if you want an official release, you will get it in 4.3. *** This bug has been marked as a duplicate of bug 331649 ***
Verified for 4.3 M6 with build I20130310-2000.