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.
Find Usages is broken on any constant declarations. For example, create a new project, and in main.rb add this line FOO="bar" Now do right click on Foo and choose Find Usages => NPE and find usages aborts.
Fix is trivial and low risk. Basically, the "getKind()" method in RubyElementCtx is given a JRuby AST node and asked what kind of node it is - a class, a variable, a constant, a field, and so on. This method fails to check for ConstantDeclNodes, it only checks ConstNodes. The fix is to just handle this case as well: --- RubyElementCtx.java 30 Oct 2007 14:43:16 -0000 1.7 +++ RubyElementCtx.java 16 Nov 2007 01:02:32 -0000 @@ -255,6 +255,8 @@ kind = ElementKind.CONSTANT; } } + } else if (node instanceof ConstDeclNode) { + kind = ElementKind.CONSTANT; } else if (node instanceof GlobalVarNode || node instanceof GlobalAsgnNode) { kind = ElementKind.GLOBAL; } else if (node instanceof InstVarNode || node instanceof InstAsgnNode || Martin, can you review this fix? Jiri, do you agree to merge this to 6.0? Fixed in trunk: Checking in RubyElementCtx.java; /cvs/ruby/refactoring/src/org/netbeans/modules/refactoring/ruby/RubyElementCtx.java,v <-- RubyElementCtx.java new revision: 1.8; previous revision: 1.7 done
> Martin, can you review this fix? I do not know this code. Sure, from narrow-scope view it looks good. A regression test would review it more than I can ;)
I verified the fix in trunk and I agree to merge it to 6.0.
Integrated in release60 Checking in refactoring/src/org/netbeans/modules/refactoring/ruby/RubyElementCtx.java; /cvs/ruby/refactoring/src/org/netbeans/modules/refactoring/ruby/RubyElementCtx.java,v <-- RubyElementCtx.java new revision: 1.7.2.1; previous revision: 1.7 done
The patch merged to the branch did not compile. You forgot to merge the import fix from rev 1.9. Checking in ruby/refactoring/src/org/netbeans/modules/refactoring/ruby/RubyElementCtx.java; /shared/data/ccvs/repository/ruby/refactoring/src/org/netbeans/modules/refactoring/ruby/RubyElementCtx.java,v <-- RubyElementCtx.java new revision: 1.7.2.2; previous revision: 1.7.2.1 done
Thanks, Jesse!
Verified in 6.0.