Bug 339913

Summary: [compiler] Misleading error message for annotations inside a method body
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: satyam.kandula
Version: 3.7   
Target Milestone: 3.7 M7   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed fix + updated regression test none

Description Olivier Thomann CLA 2011-03-14 11:38:21 EDT
public class X {
	public static String foo() {
		@interface C {}
		return "";
	}
}

Compiling this with HEAD leads to:
The member annotation C can only be defined inside a static context.

It has nothing to do with the static context. Only the error message is wrong. This is detected as an invalid local type.
Comment 1 Olivier Thomann CLA 2011-03-14 12:48:56 EDT
Created attachment 191148 [details]
Proposed fix + updated regression test

This is now consistent with the message for member interfaces.
Comment 2 Olivier Thomann CLA 2011-03-14 17:14:31 EDT
Released for 3.7M7
Comment 3 Satyam Kandula CLA 2011-04-25 05:55:33 EDT
Verified for 3.7M7 using build I20110421-1800