Skip to content

Commit 3e2c9d4

Browse files
mickaelistriaRob Stryker
authored andcommitted
More support for annotation value names
1 parent dd584cc commit 3e2c9d4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/DOMCompletionEngine.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,22 @@ public void run() {
404404
completeMarkerAnnotation(completeAfter);
405405
suggestDefaultCompletions = false;
406406
}
407+
if (context.getLocationInParent() == MemberValuePair.NAME_PROPERTY && context.getParent() instanceof MemberValuePair memberValuePair) {
408+
Set<String> names = new HashSet<>();
409+
if (memberValuePair.getParent() instanceof NormalAnnotation normalAnnotation) {
410+
for (Object o : normalAnnotation.values()) {
411+
if (o instanceof MemberValuePair other && other != memberValuePair) {
412+
names.add(other.getName().getIdentifier());
413+
}
414+
}
415+
}
416+
Arrays.stream(((Annotation)memberValuePair.getParent()).resolveTypeBinding().getDeclaredMethods()) //
417+
.filter(this::isVisible) //
418+
.filter(method -> !names.contains(method.getName()))
419+
.map(this::toAnnotationAttributeRefProposal) //
420+
.forEach(this.requestor::accept);
421+
suggestDefaultCompletions = false;
422+
}
407423
if (context.getParent() instanceof MemberValuePair) {
408424
// TODO: most of the time a constant value is expected,
409425
// however if an enum is expected, we can build out the completion for that

0 commit comments

Comments
 (0)