Bug 148011 - [quick fix] 'create method': wrong result type on array indexing
Summary: [quick fix] 'create method': wrong result type on array indexing
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M1   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 148224
Blocks:
  Show dependency tree
 
Reported: 2006-06-21 06:21 EDT by Michael Schneider CLA
Modified: 2007-07-02 08:24 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 Michael Schneider CLA 2006-06-21 06:21:03 EDT
In my code I reference method 'foo()' which does not already exist. So I open the quick assist context menu (CTRL+1) on that reference and choose the 'create method' entry. There is a use case when this action produces a method stub with a wrong result type: When the method reference is followed by an array indexing:

    void f() {
        int i = nonExistingMethodReturningIntegerArray()[0];
    }

Here the new method should return an int _array_, but using quick assist results in the following method stub (some additional code parts due to template customization):

    /**
     * TODO: Description
     * @return
     */
    private int nonExistingMethodReturningIntegerArray() {
        // TODO: implementation
        throw new UnsupportedOperationException("not yet implemented");
    }

Of course, after this action, the method reference in the caller method 'f()' shows an error:

    "the type of the expression must be an array type but is resolved to int" 
 
Bye,
Michael Schneider
Comment 1 Jerome Lanneluc CLA 2006-06-21 07:04:05 EDT
Moving to JDT UI
Comment 2 Martin Aeschlimann CLA 2006-06-22 10:29:55 EDT
need API as requested in bug 148224 
Comment 3 Martin Aeschlimann CLA 2007-07-02 08:11:35 EDT
reopen
Comment 4 Martin Aeschlimann CLA 2007-07-02 08:24:42 EDT
fixed > 20070702