Bug 339913 - [compiler] Misleading error message for annotations inside a method body
Summary: [compiler] Misleading error message for annotations inside a method body
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-14 11:38 EDT by Olivier Thomann CLA
Modified: 2011-04-25 05:55 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix + updated regression test (3.64 KB, patch)
2011-03-14 12:48 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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