Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337430 - Unqualified variable names could be resolved
Summary: Unqualified variable names could be resolved
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-02-17 08:17 EST by Stefan Henss CLA
Modified: 2019-07-24 14:37 EDT (History)
0 users

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-02-17 08:17:50 EST
Button b = new Button(null, 0);
b<^Space>

gives correct receiverName but is not resolved as a variable (receiverType etc. are missing).
Comment 1 Marcel Bruch CLA 2011-02-18 13:22:27 EST
Is IntelligentCompletionContext.findMatchingLocalVariable(String) what you want? We could make this public if this meets your requirements.
Comment 2 Stefan Henss CLA 2011-02-19 22:47:47 EST
Yes, indeed, using this method I could handle the problem.
Comment 3 Marcel Bruch CLA 2011-02-20 04:22:02 EST
(In reply to comment #2)
> Yes, indeed, using this method I could handle the problem.

Here you go: public Variable findMatchingVariable(final String variableName)

It's not tested. Feel free to change it if you experience any exceptions. Only take care that as little as possible jdt.compiler AST nodes are propagated to outside world.


Please note, it searches the locals and fields declared in the current compilation unit but ignores inherited fields.Enabling this requires reworking the context and binding it to WALA or JDT. Since WALA integration is not perfectly stable yet I would postpone this for a while.
Comment 4 Marcel Bruch CLA 2012-02-02 01:41:30 EST
Closing this issue. Please give latest dev build (v0.5) a try:

http://download.eclipse.org/recommenders/updates/dev/e37/
http://download.eclipse.org/recommenders/updates/dev/e42/
Comment 5 Marcel Bruch CLA 2012-02-02 01:41:52 EST
Closing this issue. Please give latest dev build (v0.5) a try:

http://download.eclipse.org/recommenders/updates/dev/e37/
http://download.eclipse.org/recommenders/updates/dev/e42/