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 - Add cast hint if method invocation parameter types do not match
Summary: Add cast hint if method invocation parameter types do not match
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.0.1
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-10 09:28 UTC by mco
Modified: 2013-09-02 14:21 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.