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

Bug 424654

Summary: [move method] 'null' is assigned to 'this' keyword
Product: [Eclipse Project] JDT Reporter: Jongwook Kim <jongwook.kim>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: noopur_gupta, stolz+bugzilla
Version: 4.2.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Jongwook Kim CLA 2013-12-25 21:33:07 EST
When method m is moved to a, `null' is assigned to `this' keyword:

BEFORE REFACTORING
------------------

class A {}
 
class B {
    void m(A a) {
        a = null;
    }
}
 
AFTER REFACTORING
------------------
 
class A {
    void m() {
        this = null;    // Error
    }
}
 
class B {}
Comment 1 Timo Kinnunen CLA 2013-12-26 06:26:25 EST
Weirdly this feature isn't available if method m is static, which is where I've many times wanted to change first argument into a receiver. Now that I know it at least I can force the issue by refactoring the static method into an instance method first before moving it.
Comment 2 Volker Stolz CLA 2015-10-02 05:08:56 EDT
Duplicate of https://bugs.eclipse.org/bugs/show_bug.cgi?id=420726.
Comment 3 Noopur Gupta CLA 2015-10-05 03:01:35 EDT
(In reply to Volker Stolz from comment #2)
> Duplicate of https://bugs.eclipse.org/bugs/show_bug.cgi?id=420726.

Thanks!

*** This bug has been marked as a duplicate of bug 420726 ***