Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How do I auto-move dependencies of a statement as well, while moving the statement
How do I auto-move dependencies of a statement as well, while moving the statement [message #1748561] Thu, 24 November 2016 12:02 Go to next message
Priyanshu Singh is currently offline Priyanshu SinghFriend
Messages: 1
Registered: November 2016
Junior Member
I have following functions-

void called(PassedObj obP){
    A obA = new A(pOb);
    B obB = new B(obA);
    obB.randomFunc();
    ...
}

void caller(){
    PassedObj obP= new PassedObj();
    called(obP);
}


Using Eclipse JDT, is it possible to automatically figure out all the dependencies of the obj2 and auto-move them to the caller function?

I want to refactor these functions to look something like-

void called(B obB){
    obB.randomFunc();
    ...
}

void caller(){
    PassedObj obP= new PassedObj();
    A obA = new A(obP);
    B obB = new B(obA);
    called(objB);
}


In general, is it possible to move a statement to another function so that all the dependencies of the statement are also moved(copied) to the new place?
Re: How do I auto-move dependencies of a statement as well, while moving the statement [message #1748709 is a reply to message #1748561] Sun, 27 November 2016 13:03 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
You have a valid answer to this on StackOverflow. No reason for double-posting.

The art here is to combine existing refactorings to achieve your goal with existing tooling, rather than inventing new special-case refactorings.
Previous Topic:SWT Shell init Fails
Next Topic:How to make a generic null annotated method
Goto Forum:
  


Current Time: Tue Apr 23 14:55:50 GMT 2024

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

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

Back to the top