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.

Bug 159203

Summary: No Null pointer access hint like Eclispe in the Netbeans editor
Product: editor Reporter: desmond_kirrane <desmond_kirrane>
Component: Hints & AnnotationsAssignee: Jan Lahoda <jlahoda>
Status: RESOLVED WORKSFORME    
Severity: blocker CC: geertjan, markiewb, muzPayne, tomwheeler
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://crazyjavahacking.org/the-story-of-javac-ast-visualization-on-netbeans-platform/
Issue Type: ENHANCEMENT Exception Reporter:

Description desmond_kirrane 2009-02-26 12:20:19 UTC
If you try the below code the Editor doesn't give you a hint like Eclispe does.
In Eclispe you will get the hint "Null pointer access: The variable statement can only be null at this location"     

java.sql.Statement statement = null;
try {
    statement.executeUpdate("<sql statement>");
} catch (SQLException ex) {
    throw ex;
}

I hint is very usefull because the code still builds and you won't hit a NPE until you use the code.
Comment 1 muzPayne 2011-10-15 19:45:04 UTC
Started working on as part of the First Patch Program...
Comment 2 Jan Lahoda 2011-10-15 20:55:13 UTC
I am glad to here that!

There is a sketchy prototype implementation in:
http://hg.netbeans.org/main/contrib/file/tip/javahints/src/org/netbeans/modules/javahints/NPECheck.java
which sometimes produces false positives (warnings that are not appropriate) and is quite slow because it tries to read @CheckForNull from project metadata (was done before the common annotations has been introduced, and can probably be removed now). Tests for the prototype are here:
http://hg.netbeans.org/main/contrib/file/tip/javahints/test/unit/src/org/netbeans/modules/javahints/NPECheckTest.java
Comment 3 markiewb 2012-12-27 16:33:02 UTC
What is the current state?
Comment 4 Geertjan Wielenga 2012-12-27 16:38:47 UTC
You will now in 7.3 get a hint saying "Dereferencing null pointer".

More info: https://blogs.oracle.com/geertjan/entry/netbeans_ide_7_3_knows
Comment 5 markiewb 2012-12-27 16:44:19 UTC
(In reply to comment #4)
> You will now in 7.3 get a hint saying "Dereferencing null pointer".
> 
> More info: https://blogs.oracle.com/geertjan/entry/netbeans_ide_7_3_knows

Thank you Geertjan. Why is this issue not marked as resolved?
Comment 6 Geertjan Wielenga 2012-12-27 16:46:00 UTC
It probably should be.
Comment 7 markiewb 2013-01-02 17:19:50 UTC
(In reply to comment #6)
> It probably should be.

So am resolving this issue as worksforme.