diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/core/search/DOMASTNodeUtils.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/core/search/DOMASTNodeUtils.java index fd2fb7c5..3db285f1 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/core/search/DOMASTNodeUtils.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/core/search/DOMASTNodeUtils.java @@ -88,10 +88,12 @@ public static ASTNode getEnclosingJavaElementNode(ASTNode node) { || node instanceof AnnotationTypeMemberDeclaration || node instanceof Initializer || node instanceof LambdaExpression - || node.getLocationInParent() == FieldDeclaration.FRAGMENTS_PROPERTY || node.getLocationInParent() == RecordDeclaration.RECORD_COMPONENTS_PROPERTY) { return node; } + if( node.getLocationInParent() == FieldDeclaration.FRAGMENTS_PROPERTY ) { + return node.getParent(); + } if (node instanceof ClassInstanceCreation newInst && newInst.getAnonymousClassDeclaration() != null) { return (newInst.getAnonymousClassDeclaration()); }