JDT Annotation @Nullable not treated as default [message #1118533] |
Fri, 27 September 2013 13:58 |
Mark Leone Messages: 69 Registered: April 2012 |
Member |
|
|
Maybe I'm misreading the documentation, but it seems to me that when using JDT annotations for null analysis, @Nullable is considered the default when inheriting from a a class with annotations applied.
So I have the following method declaration in an abstract class:
protected void someMethod(@Nullable SomeType param_1, @Nullable SomeType param_2) {
}
And the following overriding declaration in a sublcass:
@Override
protected void someMethod(SomeType param_1, SomeType param_2) {
...
}
The compiler complains that I have to annotate the method parameters in the subclass implementation with @Nullable since the parameters are declared that way in the superclass. But I thought that @Nullable is the default, so I don't have to explicitly apply the @Nullable annotations to subclass implementations. Either I'm wrong about that, or there's some configuration setting I'm not aware of.
The annotation @NonNullByDefault is not being used anywhere, but the compiler seems to be acting as though it is. I'm trying to avoid having to apply hundreds of annotations in a legacy code base.
Edit: I'm using Juno. A colleague using Kepler has a preference option under Java -> Compiler -> Errors and Warnings -> Null Analysis called "Inherit Null Annotations". Checking this preference fixes the problem for him, but the preference is not available in my IDE. I can upgrade to Kepler, but would like to know is there any way to get the desired behavior in Juno?
[Updated on: Fri, 27 September 2013 15:33] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06866 seconds