Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339453 - Variable.getReceiverCalls() is empty but shouldn't
Summary: Variable.getReceiverCalls() is empty but shouldn't
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Recommenders (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Marcel Bruch CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-09 20:47 EST by Stefan Henss CLA
Modified: 2019-07-24 14:36 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 Stefan Henss CLA 2011-03-09 20:47:54 EST
b = new Button(null, 0);
b.setText("test");
b<^Space>

context.getReceiverType() etc. are null, I have to search for the variable using ((IntelligentCompletionContext) context).findMatchingVariable("b"). For the resulting variable the method getReceiverCalls() is empty.

For all variables which are detected by the context the receiver calls are not obtained using getReceiverCalls(), but with this:

for (final IVariableUsageResolver resolver : usageResolvers.get()) {
            if (resolver.canResolve(context)) {
                receiverMethodInvocations = resolver.getReceiverMethodInvocations();
                return true;
            }
        }

(...templates.PatternRecommender)
Comment 1 Marcel Bruch CLA 2011-03-10 01:08:30 EST
The context's getVariable method is a *handle-only* operation the returns the search key that may be used to lookup the real variable (with its usages) in a resolver.

Clearly there is a confusion which should be solved somehow. The context, however, should IMHO not be responsible to resolve the variable usages. We may return a new Variable-subtype that throws exceptions whenever another method than getVariableName and -Type is called.

Are there any other design proposals?

Added Johannes to the discussion.
Comment 2 Marcel Bruch CLA 2012-01-12 04:22:55 EST
closing this issue. API has been changed. The store based approach is completely gone.