Bug 211755 - [push down] Push down method changes program behavior
Summary: [push down] Push down method changes program behavior
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
: 211860 316828 355324 356684 356698 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-12-03 09:50 EST by Torbjörn Ekman CLA
Modified: 2023-01-24 18:49 EST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Torbjörn Ekman CLA 2007-12-03 09:50:22 EST
Build ID: M20071023-1652

Steps To Reproduce:
Pushing down the method y() from X to SubX succeeds but does not preserve the behaviour.

class SuperX {
	void x() { System.out.println("SuperX: x()"); }
}
class X extends SuperX {
	void x() { System.out.println("X: x()"); }
	void y() {
		super.x();
	}
}
class SubX extends X {
	public static void main(String[] args) {
		new SubX().y();
	}

}


More information:
Comment 1 Torbjörn Ekman CLA 2007-12-03 10:02:41 EST
Here is another example that does not preserve behaviour. Pushing down x() from X to SubX changes the printed message from 1 to 2.

class X {
	void x() { System.out.println(y); }
	public int y = 1;
}
class SubX extends X {
	public int y = 2;
	public static void main(String[] args) {
		new SubX().x();
	}
}
Comment 2 Deepak Azad CLA 2010-06-15 15:55:28 EDT
*** Bug 211860 has been marked as a duplicate of this bug. ***
Comment 3 Deepak Azad CLA 2010-06-15 15:56:14 EDT
*** Bug 316828 has been marked as a duplicate of this bug. ***
Comment 4 Deepak Azad CLA 2010-06-15 15:59:55 EDT
Though you can argue that user wants to change the program behavior, a warning on the preview page would be nice.
Comment 5 Dani Megert CLA 2010-06-16 03:08:11 EDT
>Though you can argue that user wants to change the program behavior, a warning
>on the preview page would be nice.
The point (and main difference to a quick assist) is that it must be preserving. In the past we started to lift that a little bit but in all those cases we switch to the preview page and show a warning.
Comment 6 Markus Keller CLA 2011-09-05 12:21:30 EDT
*** Bug 356684 has been marked as a duplicate of this bug. ***
Comment 7 Markus Keller CLA 2011-09-05 12:23:11 EDT
*** Bug 356698 has been marked as a duplicate of this bug. ***
Comment 8 Raksha Vasisht CLA 2011-10-24 13:03:48 EDT
*** Bug 355324 has been marked as a duplicate of this bug. ***
Comment 9 Eclipse Genie CLA 2018-10-01 05:37:00 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 10 Stephan Herrmann CLA 2018-10-01 14:53:59 EDT
Statements that could cause changes in behaviour:

- super calls (comment 0)

- access to a field that is hidden in the subclass (comment 1)

See also the duplicates for additional relevant situations.

Anyone up to the task to implement corresponding warnings?
Comment 11 Eclipse Genie CLA 2020-10-09 19:05:47 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 12 Eclipse Genie CLA 2023-01-24 18:49:34 EST
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.