| Summary: | [content assist] Typing annotation value doesn't work | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Yauheniy Ratkevich <evser11> |
| Component: | Core | Assignee: | Jeff Johnston <jjohnstn> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | jjohnstn |
| Version: | 4.8 | ||
| Target Milestone: | 4.11 | ||
| Hardware: | PC | ||
| OS: | Windows NT | ||
| Whiteboard: | |||
The following annotation:
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD) //can use in method only.
public @interface MyAnnotation {
String enabled() default "false";
String name() default "Jeff";
}
and the following Test:
public class TestAnnotation {
@MyAnnotation(|) // cursor inside parentheses
public void foo() {
}
works fine in latest Eclipse and in 2019-03 a fix was made to add the equal sign for a selection. The content assist proposes the two possible selections: "enabled" and "name"
When either is selected, the code adds "enabled = " or "name = " and once one is added, the other is presented in subsequent content assist
(e.g. @MyAnnotation(enabled = "true", |) <== this will offer name
}
|
When I want a hint for annotation like this: @interface MyAnnotation { Object any() default null; String value default ""; } For this case content assist work correctly: | - cursor @MyAnnotation(value=|) But for this case content assist fails: @MyAnnotation(|) Like no attribute was chosen.