Bug 12767

Summary: AST MethodBinding question
Product: [Eclipse Project] JDT Reporter: Martin Aeschlimann <martinae>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann
Version: 2.0   
Target Milestone: 2.0 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

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