Summary: | [refactor] Add "extract static method" refactoring | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Lukas Eder <lukas.eder> |
Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
Status: | CLOSED DUPLICATE | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | noopur_gupta, stephan.herrmann |
Version: | 4.5 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows NT | ||
Whiteboard: |
Description
Lukas Eder
2014-11-11 10:04:30 EST
Passing to JDT/UI. I understand this is besides the point, but I found your example confusing at first, because you're starting from a statement with no observable effect. Shouldn't we start by adding some statements that read b after the assignment? Or extract only the RHS of the assignment? Yes it's nonsense, you're right. It should be more like this: Current output ---------------------------------------- private int memberField; public void memberMethod(int a) { int b; b = extracted(a); } private int extracted(int a) { return a + memberField; } Desired output ---------------------------------------- private int memberField; public void memberMethod(int a) { int b; b = extracted(a, memberField); } private static int extracted(int a, int memberField) { return a + memberField; } Alternative desired output ---------------------------------------- private int memberField; public void memberMethod(int a) { int b; b = extracted(a, this); } private static int extracted(int a, ScopeClass scopeClass) { return a + scopeClass.memberField; } *** This bug has been marked as a duplicate of bug 318560 *** |