Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 204527 - [inline] Inline Method - checkFinalConditions too strict
Summary: [inline] Inline Method - checkFinalConditions too strict
Status: CLOSED DUPLICATE of bug 83329
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-25 07:11 EDT by Máirtín Keane CLA
Modified: 2013-07-23 08:19 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 Máirtín Keane CLA 2007-09-25 07:11:26 EDT
Build ID: I20070503-1400

Steps To Reproduce:
----------------------------------------
* Steps to Reproduce * 
----------------------------------------
1. Use the following code:


L1.  public class TestClass {
L2.     public static void main(String[] args) {
L3.        SubClass subClass = new SubClass();
L4.        subClass.method();
L5.     }
L6.  }
L7.
L8.  class SubClass extends BaseClass {
L9.    public void method() {
L10.       newMethod();
L11.   }
L12. }
L13.
L14. abstract class BaseClass {
L15.    public abstract void method();
L16.
L17.    public void newMethod() {
L18.       System.out.println("BaseClass::newMethod()");
L19.    }
L20. }

2. Select the method on line L9

3. From the Eclipse Menu select: Refactor -> Inline 

  3.1 Up pops the "Inline method" dialog

4. Uncheck the "Delete method declaration" check box on the dialog

5. Click "Ok"

6. A dialog pops up that notifies you that the "Method to be inlined overrides method from class BaseClass"

7. Click "Continue"

8. Refactoring finishes executing

----------------------------------------
* Actual Behaviour *
----------------------------------------
No refactoring is carried out.

----------------------------------------
* Expected Behaviour *
----------------------------------------

The method call on L4 should be inlined i.e. it should be refactored from "subClass.method();" to "subClass.newMethod();"



More information:

See: 

http://www.eclipse.org/newsportal/article.php?id=21497&group=eclipse.tools.jdt#21497

for further information.

Also:

The same "problem" occurs when you are inlining calls to the method (without deleting the method) and either

(1) The method is overridden in a subclass

(2) The method is a method from an interface that the class implements
Comment 1 Markus Keller CLA 2013-07-23 08:19:47 EDT

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