Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 233796 - [use supertype] changes to static binding, changing program behaviour
Summary: [use supertype] changes to static binding, changing program behaviour
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-24 03:35 EDT by Friedrich Steimann CLA
Modified: 2020-04-15 11:39 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Friedrich Steimann CLA 2008-05-24 03:35:06 EDT
Build ID: M20071023-1652

Steps To Reproduce:

public class A {
	B b;
	private void m() {System.out.println("A");}
	void run() {
		b = new B();
		b.m();
	}
	public static void main(String args[]) {
		(new A()).run();
	}
}

public class B extends A {
	public void m() {System.out.println("B");}
}

Using A instead of B changes declaration of b. This is fatal, since a refactoring should never change behaviour.

More information:

Appears to be the same problem as reported for generalize type: see http://bugs.eclipse.org/233437 (which includes more, less obvious examples).
Comment 1 Martin Aeschlimann CLA 2008-05-28 08:47:14 EDT
Not a blocker, but a major bug.
Comment 2 Markus Keller CLA 2009-09-14 13:36:31 EDT
Looks like the induhvidual who wrote SuperTypeConstraintsCreator.getOriginalMethods(..) reinvented the wheel but forgot to test the method modifiers.

Should use helpers from Bindings, e.g. findOverriddenMethod(IMethodBinding, boolean).
Comment 3 Eclipse Genie CLA 2020-04-15 11:39:50 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.