| Summary: | [generalize type] fails to see lack of overriding [Refactoring] | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Friedrich Steimann <steimann> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | daniel_megert, developer, martinae |
| Version: | 3.3.1 | Keywords: | helpwanted |
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | stalebug | ||
The problem is even worse when C is in a:
package a;
public class A {
void m() {} // not public
}
package a;
import b.B;
public class C {
B b;
void m() {
b.m();
}
}
package b;
import a.A;
public class B extends A {
public void m() {}
}
Generalizing b changes program behaviour.
yet another example (all classes in one package):
public class A {
private void m() {} // private!
}
public class B extends A {
public void m() {} // not overridden
}
public class C {
B b;
void m() {
b.m();
}
}
Should not allow B b to be generalized to A b!
and one more, again changing behaviour both in one package):
class A {
B b;
private void m() {
b.m();
}
}
class B extends A {
void m() {}
}
Help would be welcome... In all three examples, "Use supetype where possible" creates the same (wrong) results. 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. |
Build ID: M20071023-1652 Steps To Reproduce: package a; public class A { void m() {} } package b; import a.A; public class B extends A { void m() {} // does not override! } package b; public class C { B b; void m() { b.m(); } } Generalzing declared type of b to A causes an access violation. A should be excluded from list of possible supertypes. More information: