Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 197397

Summary: [quick fix] Fix does offer cast to 'Object'
Product: [Eclipse Project] JDT Reporter: Benno Baumgartner <benno.baumgartner>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 3.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Benno Baumgartner CLA 2007-07-21 11:21:25 EDT
I20070717-1020

Given:
package test;
public class E01 {	
	public interface IFace{}
	public static class MyFace implements IFace {}
	
	public void foo() {
		Object face= new MyFace();
		face.doSmile();
	}
}
1. Ctrl-1 at error at doSmile
2. Select 'Add cast to face'
Is:
 ((Object) face).doSmile();
Should:
 should be offer 2 qf:
 - Create doSmile in IFace
 - Create doSmile in Face
Comment 1 Martin Aeschlimann CLA 2007-07-23 06:16:56 EDT
Currently, the cast quick fix is only proposed if IFace really has a method doSmile.
Comment 2 Benjamin Muskalla CLA 2008-11-09 09:28:13 EST
Cast quick fix is even available without the interface like the following:

package p;

public class A {

	public static void main(String[] args) {
		X x = new X();
		x.doSomething();
	}
}

class X {}
Comment 3 Eclipse Genie CLA 2020-01-27 14:49:03 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. 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.