Bug 46943 - refactoring: encapsulate field of local type: references from enclosing type are not replaced by setter
Summary: refactoring: encapsulate field of local type: references from enclosing type ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-19 06:06 EST by Tom Hofmann CLA
Modified: 2003-11-24 07:53 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Hofmann CLA 2003-11-19 06:06:39 EST
I20031119 (M5 test pass)

1. have this code:

public class Test {
	
	public void foobar() {
		class Listener3 {
			public Object fTest2;
			
			public void method() {
				fTest2= null;
			}

		}
		
		Listener3 list= new Listener3() {
			public int bar() {
				return 1;
			}
		};
		
		list.fTest2= this;
	}
}


2. select fTest2
3. Choose Refactor->Encapsulate Field
4. Ensure that "Field access in declaring class" is set to "use setter and
getter" (should be selected per default)
5. Proceed to preview

-> Note that everything looks good, except:
-> the reference inside the top-level type's method does not get replaced by a
setter call
-> the reference inside the local type does not get replaced by a setter call
Comment 1 Dirk Baeumer CLA 2003-11-19 09:02:10 EST
Very likely a search engine bug.
Comment 2 Dirk Baeumer CLA 2003-11-19 11:52:34 EST
Moving to JDT/Core. Searching for references to fTest2 in this scenario 
reports zero matches.
Comment 3 Kent Johnson CLA 2003-11-21 13:46:00 EST
Dirk: Can you double check this in the latest build.

It worked for me.
Comment 4 Kent Johnson CLA 2003-11-21 14:45:29 EST
I believe this is fixed in our latest changes that are in M5.
Comment 5 Kent Johnson CLA 2003-11-21 14:50:15 EST
Marking as fixed in M5.
Comment 6 Dirk Baeumer CLA 2003-11-21 17:38:54 EST
Works in the latest
Comment 7 David Audel CLA 2003-11-24 07:53:28 EST
Verified.