Bug 12767 - AST MethodBinding question
Summary: AST MethodBinding question
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-04 04:59 EST by Martin Aeschlimann CLA
Modified: 2002-04-23 08:46 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2002-04-04 04:59:40 EST
20020402

I'm working on corrrection for unresolved field names:
Assume this is the code:
public void run(Runnable run) {}

private void foo() {
  run(myRunnable);
}

myRunnable is not defined. Quick fix gives a proposal to introduce a new field.
The problem is, what type has the field to introduce.
If I resolve the MethodBinding of 'run' it is null, which makes sense, 
as 'myRunnable' is undefined, and run can't be 100% mapped.
However, when hovering over run, codeSelect find out that this is run(Runnable)
(as there is no other 'run' visible)

Couldn't the AST also guess the method binding?
Comment 1 Philipe Mulet CLA 2002-04-04 10:23:20 EST
We have a special guessing mode for code selection.

Unclear whether we would like to find a potential binding decoration in case 
message arguments could not be bound.

For each unbound field/method, you would step to the parent level and guess its 
expected type for the unbound node ? But this would be tricky to generalize, 
since not only messages are involved here, but rather every compound 
expression... 
Comment 2 Martin Aeschlimann CLA 2002-04-04 10:48:58 EST
I could try to do the guessing myself.
How do I get the receiver type of my method?
Comment 3 Olivier Thomann CLA 2002-04-04 11:57:58 EST
I consider this feature as being beyond the scope of the DOM/AST API. The DOM/AST API is supposed to 
return bindings when they can be resolved. This is clearly not the case here.
Comment 4 Philipe Mulet CLA 2002-04-05 05:17:16 EST
The guessing technology was on SelectionOnMessageSend. We will experiment 
moving it into the base MessageSend node, only in error case. It is quite 
small, and if satisfactory then we will release it. 

Comment 5 Philipe Mulet CLA 2002-04-05 09:48:47 EST
Fixed