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 200821

Summary: Add cast hint if method invocation parameter types do not match
Product: java Reporter: mco <mco>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.0.1   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: ENHANCEMENT Exception Reporter:

Description mco 2011-08-10 09:28:40 UTC
Would it be possible to add a cast hint if method call parameters do not fit (maybe only when there is already method with exact parameters number, and parameter that does not fit can be cast to type required by method invocation).
Right now i only have hint to create method when what I really want to do is cast one of parameters.

Example:

I have method with signature:

private void prettyPrint(Writer out, DefaultMutableTreeNode node, int level)

When i try to call it like this:
prettyPrint(w, root.getFirstChild(), -1)

where:
w - PrintWriter
root - DefaultMutableTreeNode
root.getFirstChild() - returns javax.​swing.​tree.TreeNode

and only hint i get is to create new method:
prettyPrint(Writer w, TreeNode firstChild, int i)

When what I really would like to do is to cast root.getFirstChild() to DefaultMutableTreeNode so my invocation looks like this:

prettyPrint(w, (DefaultMutableTreeNode)root.getFirstChild(), -1);

Thanks.