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.
Consider the following line of Java code: foo.getBar().doSomething(); If you have a NullPointerException stacktrace which identifies this line, it's not clear whether the 'foo' instance or the 'getBar()' method is null. Probably the best way to avoid this is to have one statement per line, like: Bar bar = foo.getBar(); bar.doSomething(); It's certainly desirable to do this for new code, but many times we find ourselves working with legacy code which puts several statements on a single line. NetBeans would benefit from a refactoring pattern which splits these into one statement per line, as shown above. The existing logic for the "Assign Return Value To New Variable" quick fix hint would work quite well for naming the new instance variables created.
Introduce variable on the expression works for me in this case.