Bug 434881 - [move method] A behavior preserving transformation (Move Method Refactoring) is rejected
Summary: [move method] A behavior preserving transformation (Move Method Refactoring) ...
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-14 12:23 EDT by Melina Mongiovi CLA
Modified: 2020-04-11 03:39 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 Melina Mongiovi CLA 2014-05-14 12:23:05 EDT
Behavior Preserving Transformation is rejected.

Reproducible: Always

Steps to Reproduce:
1. Create the classes

package p1;
public class A {
}

package p0;
import p1.*;
public class B extends A{
  public C f = null;
  private long m(int a) {
    return 0;
  }
}

package p0;
public class C extends B {
  protected long m(int a) {
    return 1;
  }
  public long test() {
    return new C().m(2)
  }
}

2. Apply the move method refactoring to move method m(int) from class B to class C.

3. The tool does not apply the transformation and warn the following message:
The visibility of method p0.B.m(int) will changed to default

4. Another refactoring tool applies the same transformation and the resulting program (the program below) preserves the program behavior.

package p1;
public class A {
}

package p0;
import p1.*;
public class B extends A{
  public C f = null;
}

package p0;
public class C extends B {
  long m(B b, int a) {
    return 0;
  }
  protected long m(int a) {
    return 1;
  }
  public long test() {
    return new C().m(2)
  }
}
Comment 1 Martin Mathew CLA 2014-05-15 00:23:08 EDT

*** This bug has been marked as a duplicate of bug 434886 ***
Comment 2 Melina Mongiovi CLA 2016-09-22 09:39:26 EDT
(In reply to Manju Mathew from comment #1)
> 
> *** This bug has been marked as a duplicate of bug 434886 ***

Why do you consider this bug as duplicate of bug 434886? 
In this bug, Eclipse rejects the transformation and reports the warning message: "The visibility of method p0.B.m(int) will changed to default", while in the bug 434886 Eclipse rejects the transformation and reports the message: "A method with * name already exists in the target type". 
Therefore, for each transformation (this bug and bug 434886) a different precondition was unsatisfied. In my point of view each bug is related to a different overly strong condition.

What are the criteria that you use to classify a bug as duplicate of another bug?
Comment 3 Eclipse Genie CLA 2020-04-11 03:39:08 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.