Bug 507615 - [Pull Up field] A behavior preserving transformation (Pull Up Field Refactoring) is rejected. [Field 'p.C.x' declared in type 'p.C' has a different type than its moved counterpart]
Summary: [Pull Up field] A behavior preserving transformation (Pull Up Field Refactori...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5   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: 2016-11-16 09:39 EST by Melina Mongiovi CLA
Modified: 2023-04-26 13:50 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 2016-11-16 09:39:15 EST
Behavior Preserving Transformation is rejected.

Reproducible: Always

Steps to Reproduce:
1. Create the following program
package p;
class A {
}
class B extends A {
  int x;
}
class C extends A {
  boolean x;
}



2. Pull Up Field B.x

3. The tool does not apply the transformation and warn the following message:
Field 'p.C.x' declared in type 'p.C' has a different type than its moved counterpart.

4. However, the following possible resulting program compiles and the transformation preserves the program behavior, which indicates that some refactoring conditions may be overly strong. 

package p;
class A {
  int x;
}
class B extends A {

}
class C extends A {

}
Comment 1 Eclipse Genie CLA 2019-04-28 15:29:27 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.

If you have further information on the current state of the bug, please add it. 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.
Comment 2 Dani Megert CLA 2019-04-29 04:37:05 EDT
As of 4.12 M1 it is actually worse: The unnecessary error is shown and one can continue the refactoring which results in wrong code: it removes C.x!

The error should be changed into a warning and the refactoring should generate:

package p;
class A {

	int x;
}
class B extends A {
}
class C extends A {
	boolean x;
}
Comment 3 Eclipse Genie CLA 2021-04-20 16:33:33 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.

If you have further information on the current state of the bug, please add it. 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.
Comment 4 Eclipse Genie CLA 2023-04-26 13:50:19 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.

If you have further information on the current state of the bug, please add it. 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.