This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Add null checker annotations for methods that check for null | ||
---|---|---|---|
Product: | java | Reporter: | SirIntellegence |
Component: | Hints | Assignee: | Svata Dedic <sdedic> |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 8.0.2 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Bug Depends on: | 249320 | ||
Bug Blocks: |
Description
SirIntellegence
2015-06-04 20:38:16 UTC
I have an idea. You could add annotations for parameters. For example, with a method that returns a boolean and takes an object, you could annotate the argument with: @NullTrue or @NullFalse To tell the IDE what value gets returned when null is passed in. You could also add @NullException to indicate that an exception will be thrown if the item is null. Yes, this would be useful. I plan, in the future, some metadata (perhaps distilled from annotations, but also should be specified in text files for e.g. 3rd party libraries). There's a lot what a method can do -- param may be known to be null, or nullable (sometimes null), the method may throw an exception, return a non-null or nullable ... |