Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 317995

Summary: Refactoring problem converting data array to parameter array
Product: [Tools] PTP Reporter: Cyril Georgy <cyril.georgy>
Component: Photran.Refactoring EngineAssignee: Matthew Fotzler <incongruous>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P5 CC: com-eclipse-dot-org, incongruous
Version: unspecified   
Target Milestone: 6.0.2   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Screenshot illustrating the problem.
none
Example code
none
Example code - expected result
none
patch com-eclipse-dot-org: iplog+

Description Cyril Georgy CLA 2010-06-25 10:07:34 EDT
Build Identifier: I20100608-0911

When trying to convert a data array to a parameter array using the refactoring tool, the result is NOT creating a parameter array, but a simgle variable containing the value of the first cell of the array. The other cells are not converted and disappear.

Reproducible: Always

Steps to Reproduce:
1.Declare a data array
2.Try to convert it to a parameter array using "Refactor --> Data to Parameter".
Comment 1 Cyril Georgy CLA 2010-06-25 10:09:01 EDT
Created attachment 172756 [details]
Screenshot illustrating the problem.
Comment 2 Jeffrey Overbey CLA 2010-06-25 10:24:30 EDT
Created attachment 172759 [details]
Example code
Comment 3 Jeffrey Overbey CLA 2010-06-25 10:27:32 EDT
Created attachment 172760 [details]
Example code - expected result
Comment 4 Matthew Fotzler CLA 2010-07-08 13:03:47 EDT
Created attachment 173791 [details]
patch
Comment 5 Matthew Fotzler CLA 2010-07-08 13:06:44 EDT
The patch addresses this bug by not allowing the refactoring to occur on any arrays, data implied do loops, or pointers.  When it encounters a data statement with one of the previous mentioned constructs, it will convert up to that construct and leave the rest of that particular data statement alone (to avoid the bug occurring).

note: This should be an editor refactoring rather than a resource refactoring, as it is not likely the user wants to convert all data statements to parameters.
Comment 6 Jeffrey Overbey CLA 2010-07-08 15:00:36 EDT
Thanks, Matt.  Sometime we should look at making this an editor refactoring and dealing correctly with constant-size arrays.

Regarding your patch, can you please confirm that

1. you wrote 100% of the code without incorporating content from elsewhere or relying on the intellectual property of others,

2. you have the right to contribute the code to Eclipse, and

3. you have included the EPL license header in all source files?
Comment 7 Matthew Fotzler CLA 2010-07-08 15:03:43 EDT
Yes, I wrote 100% of the code without incorporating content from elsewhere or relying on the intellectual property of others, I have the right to contribute the code to Eclipse, and I have included the EPL license header in all source files.
Comment 8 Jeffrey Overbey CLA 2010-07-14 14:05:22 EDT
This is a small contribution, so I can commit it without filing a CQ.
Comment 9 Jeffrey Overbey CLA 2010-07-14 16:05:25 EDT
The patch is committed to CVS for 6.0.2 and 7.0.

We still need to address the following issues:

- This should be an editor refactoring rather than a resource refactoring,
as it is not likely the user wants to convert all data statements to
parameters.

- This fix is not optimal.  In simple cases (e.g., the array has known bounds), we should still be able to do the conversion to a PARAMETER statement.
Comment 10 Jeffrey Overbey CLA 2011-03-18 11:50:48 EDT
Closing since the fix was applied for 6.0.2