Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Refactor method programatically fails in subclass(org.eclipse.jdt.core.IMethod rename refactor fails in subclass)
Refactor method programatically fails in subclass [message #1698218] Fri, 12 June 2015 05:22 Go to next message
Eclipse UserFriend
I am using IMethod method

and calling method.rename(newName, true, new NullProgressMonitor());

It refactors interface method, but fails to refactor its implementation methods.

For example,

interface Animal {
void eat() ; // refactors here
}

class Dog implements Animal {

// fails to refactor this
void eat() {


}

}

Kindly help!
Re: Refactor method programatically fails in subclass [message #1698245 is a reply to message #1698218] Fri, 12 June 2015 08:52 Go to previous messageGo to next message
Eclipse UserFriend
I've never tried to refactor programmatically, but it looks harder than what you're doing. (org.eclipse.jdt.core.refactoring)

That said, everything compiles without error? Everything is compiled?

What version of Eclipse? What version of Java?

[Updated on: Fri, 12 June 2015 09:53] by Moderator

Re: Refactor method programatically fails in subclass [message #1698276 is a reply to message #1698245] Fri, 12 June 2015 13:57 Go to previous message
Eclipse UserFriend
Thanks for the immediate reply.

Java ver 1.7
Eclipse ver Luna 4.4.1

Actually IMethod.rename works & compiles fine with interface or class, but enables save button.

Funny it used to work earlier for sub classes also, not sure why its not working now.

If you can provide clean refactoring through other api's such as below

org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor

tried this also,

IntroduceIndirectionRefactoring refactoring = new IntroduceIndirectionRefactoring();
refactoring.setMethod(method);
refactoring.setUpdateReferences(true);
refactoring.setMethodName("shrikanth");

run(new IntroduceIndirectionWizard(refactoring , "Introduce Indirection"),
new Shell(), "Introduce Indirection");
//



Thanks,
Shrikanth N C
Previous Topic:JBoss is always in the starting state
Next Topic:SWT Tree rebuild
Goto Forum:
  


Current Time: Wed May 07 13:08:31 EDT 2025

Powered by FUDForum. Page generated in 0.03891 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top