Bug 72946

Summary: Refactoring context menu does not show inline action on local variables [refactoring] [inline temp]
Product: [Eclipse Project] JDT Reporter: Tobias Widmer <tobias_widmer>
Component: CoreAssignee: David Audel <david_audel>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: markus.kell.r
Version: 3.0   
Target Milestone: 3.1 M2   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Method Body none

Description Tobias Widmer CLA 2004-08-31 06:07:41 EDT
Build I20040824: Javaeditor context menu does not contain inline action when a 
local variable is selected. The refactoring is enabled however.

Steps to reproduce:
- Write a similar statement as below:

		ListRewrite list= rewrite.getListRewrite(targetClass, 
TypeDeclaration.BODY_DECLARATIONS_PROPERTY);
		list.insertAt(newMethod, ASTNodes.getInsertionIndex(newMethod, 
targetClass.bodyDeclarations()), null);
- Place caret on "list"
- Invoke context menu
Comment 1 Dirk Baeumer CLA 2004-08-31 06:37:38 EDT
Please investigate.
Comment 2 Tobias Widmer CLA 2004-08-31 06:56:26 EDT
Created attachment 14281 [details]
Method Body
Comment 3 Markus Keller CLA 2004-08-31 08:10:18 EDT
Moving to JDT/Core.

ICompilationUnit#codeSelect(int,int) returns an ILocalVariable with an invalid
parent iff the enclosing method has an array-type parameter:
...
	void test(int[] arg) {
		List list= new ArrayList();
	}
...
The parent of the ILocalVariable for "list" is "test(int[][]) (not open)". Note
the wrong array dimension count.

We only show the action if the resolved element exists, and an ILocalVariable
only exists iff its parent exists.
Comment 4 Tobias Widmer CLA 2004-08-31 09:07:40 EDT
The wrong array dimension can also be observed on the java text hover.
Comment 5 David Audel CLA 2004-09-02 09:21:09 EDT
Fixed and test added
   ResolveTest#testArrayParameterInsideParent1()

The bug was inside Util.typeSignature().
type.getParameterizedTypeName() return type name with brackets and 
Util.typeSignature() add also the brackets.
Comment 6 David Audel CLA 2004-09-23 06:55:14 EDT
Verified in I200409240100.