Bug 22938 - Refactor doesn't work with cast and spacing.
Summary: Refactor doesn't work with cast and spacing.
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Adam Kiezun CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 22939 23329
Blocks:
  Show dependency tree
 
Reported: 2002-08-28 05:33 EDT by Daniele CLA
Modified: 2003-05-14 11:04 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniele CLA 2002-08-28 05:33:39 EDT
I explain my problem with a little piece of code.
If you have this example code:

class NonnaPapera
{
}
class Paperino extends NonnaPapera
{
}
public class TestRefactor
{
	public static void main(String[] args)
	{
		Paperino paperino = new Paperino();
		NonnaPapera nonnaPapera = ( NonnaPapera )paperino;
	}
}

I have refactored the name of class NonnaPapera in Pippo and Eclipse trasform
the code in this way:

class Pippo
{
}
class Paperino extends Pippo
{
}

public class TestRefactor
{

	public static void main(String[] args)
	{
		Paperino paperino = new Paperino();
		Pippo nonnaPapera = ( NPippo)paperino;
	}
}

As you can see the line
 Pippo nonnaPapera = ( NPippo)paperino; is WRONG!!!
insted of
 Pippo nonnaPapera = ( Pippo )paperino;
Comment 1 Daniele CLA 2002-08-28 05:46:38 EDT
The problem exists also without use cast.. for example I try this method

  public static void test( String aLongNameParameter )
  {
  	String c = ( aLongNameParameter );
  }

If you change the name from aLongNameParameter to pippo you have this results:

  public static void test( String pippo )
  {
  	String c = (pippor );
  }

Comment 2 Adam Kiezun CLA 2002-08-28 07:07:02 EDT
great find Daniele, thanks
i added test cases for affected refactorings: Rename Type, Rename Local, Inline 
Local Variable

they will be enabled as soon as the culprit (bug 22939) is fixed.
Comment 3 Adam Kiezun CLA 2002-09-09 11:28:02 EDT
one more bug (bug 23329) makes this not work yet
Comment 4 Adam Kiezun CLA 2002-09-13 10:51:22 EDT
fixed
Comment 5 Darin Wright CLA 2003-05-14 11:04:45 EDT
*** Bug 24125 has been marked as a duplicate of this bug. ***