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

Bug 218381

Summary: [convert local] reference to getClass() is updated wrong
Product: [Eclipse Project] JDT Reporter: Mike Haller <mike.haller>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: martinae, nospam, remy.suen
Version: 3.4   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug

Description Mike Haller CLA 2008-02-08 15:51:14 EST
Build ID: I20071213-1700

Steps To Reproduce:
1. Run unit test to verify test succeeds
2. Do the refactoring: Convert member type 'Foo' into top level, standard settings.
3. Run unit test again and see it failing


More information:
package sandbox;

import junit.framework.TestCase;

/**
 * Shows bug in Eclipse refactoring
 * 'Convert membery type to top level'.
 * 
 * Steps: Run refactoring on inner class Foo.
 * Compare test results.
 * 
 * @author mhaller
 */
public class EclipseRefactoring extends TestCase {

	private class Foo {
		public boolean equals(Object obj) {
			// For show case:
			System.out.println("Myself:"
					+ getClass());
			System.out.println("Parent:"
					+ EclipseRefactoring.this.getClass());
			
			// Note the changes here:
			if (getClass() != obj.getClass())
				return false;
			
			return true;
		}
	}

	public void testname() throws Exception {
		Foo foo = new Foo();
		Foo bar = new Foo();
		assertTrue(foo.equals(bar));
	}
}
Comment 1 Jerome Lanneluc CLA 2008-02-11 04:03:43 EST
Moving to JDT/UI
Comment 2 Martin Aeschlimann CLA 2008-02-11 09:52:18 EST
the resulting code is:
   if (this.eclipseRefactoring.getClass() != obj.getClass())
      return false;

getClass() should not change.
Comment 3 Eclipse Genie CLA 2020-02-13 16:52:06 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.