Svatopluk Dedic created NETBEANS-343:
----------------------------------------
Summary: Possible Null dereference hint works bad with overrides
Key: NETBEANS-343
URL: https://issues.apache.org/jira/browse/NETBEANS-343
Project: NetBeans
Issue Type: Bug
Components: java - Hints
Affects Versions: 8.2
Reporter: Svatopluk Dedic
I have an interface and implementing class:
{code:java}
public interface Builder {
@CheckForNull
Properties getNodeProperties(int nodeId);
}
public class ModelBuilder implements Builder {
// ...
@Override
public Properties getNodeProperties(int nodeId) { /* ... */ }
protected boolean updateNodeBlock(int nodeId, String name) {
final Properties properties = getNodeProperties(nodeId);
final String oldBlock = properties.get(PROPNAME_BLOCK, String.class);
}
// ...
}{code}
Even though the overriden method is marked with CheckForNull, the hint for
possible null dereference at properties.get will not show up unless the
overriden method is also annotated.
This is IMHO bad, the inherited contract allows to return null, and unless the
overriden method is annotated with different flag (i.e. NonNull), the inherited
info should be used.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists