Bug 24346

Summary: Method declaration not found in field initializer
Product: [Eclipse Project] JDT Reporter: Jerome Lanneluc <jerome_lanneluc>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.1 M2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Jerome Lanneluc CLA 2002-10-03 04:51:18 EDT
Build 20021001

1. Create the following cu p/X.java:
package p;
public class X {
	public void bar() {
	}
	public Object x = new Object() {
		public void foo() {
		}
	};
}
2. Open the Java search dialog.
3. Search for method declaration of "foo"
Observe: None is found
Comment 1 Jerome Lanneluc CLA 2002-10-03 04:52:16 EDT
Removing the declaration of bar() makes it work.
Comment 2 Jerome Lanneluc CLA 2002-10-03 11:50:31 EDT
The HasLocalTypeMASK was not set on the field declaration and thus the "foo" 
reference was not added to the index.

This was due to a bug in the Parser that used to mark only method declarations 
and type declarations in Parser.markCurrentMethodWithLocalType(). Fixed this 
method and renamed it to markEnclosingMemberWithLocalType().
Comment 3 David Audel CLA 2002-10-17 10:26:54 EDT
Verified.