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

Bug 442871

Summary: [content assist] content assist claims "The annotation @Override is disallowed for this location"
Product: [Eclipse Project] JDT Reporter: Marcel Bruch <marcel.bruch>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, noopur_gupta, srikanth_sankaran
Version: 4.4   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Marcel Bruch CLA 2014-08-29 06:55:25 EDT
When triggering content assist at $m as given in the example below, the status line shows the error "The annotation @Override is disallowed for this location". The code in the editor, however, compiles correctly.




package __test;

import java.util.List;

public class Weird {
	private static void weird() {
		new Other() {

			@Override
			public void $m(String s, L$ist l, Object o) {
			}
		};
	}
}

abstract class Other {
	public abstract void m(String s, List l, Object o);
}
Comment 1 Noopur Gupta CLA 2014-09-01 04:16:59 EDT
The problem is being set in CompletionProposalCollector#completionFailure from CompletionEngine.complete(ICompilationUnit sourceUnit, int completionPosition, int pos, ITypeRoot root). Moving to JDT Core for comments.
Comment 2 Jay Arthanareeswaran CLA 2014-09-11 06:14:50 EDT
I can reproduce, thanks to Noopur. 

When the completion parser is trying to construct the AST, it sees a field when when parsing "public void m$". Remember the completion parser doesn't bother with what follows. As a result, the annotation is flagged as having illegal target. Since the impact is not much, I don't think we should investigate much time on this.

Srikanth, what do you think?
Comment 3 Eclipse Genie CLA 2020-02-06 15:09:49 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.