Bug 64302 - [introduce parameter] Guess names for expression in method call based on parameter name
Summary: [introduce parameter] Guess names for expression in method call based on para...
Status: REOPENED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-27 06:17 EDT by Markus Keller CLA
Modified: 2010-09-05 13:57 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2004-05-27 06:17:18 EDT
E.g.

void doTheWork(int workItemCount) {}
void caller() {
    doTheWork(17); //extract "17" into local variable
}

-> proposed name: "i"
-> better suggestions: "workItemCount", "itemCount", "count".

This can be used in ExtractTemp, ConvertTempToField, IntroduceParameter, and
maybe  also in ExtractConstant refactorings.

Priorities for guessing types:
1. guessTempNamesFromMethodInvocation()
2. guessTempNamesFromArgument()
3. guessTempNamesFromExpression().

This whole guessing code should be extracted into StubUtility.
Comment 1 Dirk Baeumer CLA 2004-05-27 13:23:13 EDT
Good suggestion. We should consider this for 3.1
Comment 2 Martin Aeschlimann CLA 2006-08-03 10:40:54 EDT
Quick fixes use ASTResolving.suggestLocalVariableNames(IJavaProject, ITypeBinding, Expression, String[]) to guess the name from an expression. It doesn't use parameter names so far.
Would make sense to move to StubUtility.
Comment 3 Markus Keller CLA 2007-10-24 10:33:23 EDT
Dup of bug 207185?
Comment 4 Martin Aeschlimann CLA 2007-10-24 10:43:53 EDT
verified that the example works with the fix for bug 207185

*** This bug has been marked as a duplicate of bug 207185 ***
Comment 5 Markus Keller CLA 2007-10-25 05:20:31 EDT
Reopening to add support in Introduce Parameter as well.