From 0f78e2ef600c013a07f21dce38d1805f7f026385 Mon Sep 17 00:00:00 2001 From: Rob Stryker Date: Tue, 21 Apr 2026 14:39:20 -0400 Subject: [PATCH] Partial fix for testBug277204b - field declaration should be marked malformed, not fragment Signed-off-by: Rob Stryker --- .../org/eclipse/jdt/internal/core/search/DOMASTNodeUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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()); }