From 76b846609be9d07da357216e5cfad7aa486df644 Mon Sep 17 00:00:00 2001 From: Rob Stryker Date: Tue, 10 Dec 2024 10:18:26 -0500 Subject: [PATCH] Revert "Ensure all parent nodes fully encompass their child nodes" This reverts commit dd17d97223cf005373b6d60ec8a07c065edebb4e. --- .../dom/JavacCompilationUnitResolver.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacCompilationUnitResolver.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacCompilationUnitResolver.java index 95a3d07692e..905b61533f9 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacCompilationUnitResolver.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacCompilationUnitResolver.java @@ -772,20 +772,11 @@ public Void visitClass(ClassTree node, Void p) { @Override public void postVisit(ASTNode node) { // fix some positions if( node.getParent() != null ) { - int myStart = node.getStartPosition(); - int myEnd = myStart + node.getLength(); - int parentStart = node.getParent().getStartPosition(); - int parentEnd = parentStart + node.getParent().getLength(); - int newParentStart = parentStart; - int newParentEnd = parentEnd; - if( myStart >= 0 && myStart < parentStart) { - newParentStart = myStart; - } - if( myStart >= 0 && myEnd > parentEnd) { - newParentEnd = myEnd; - } - if( parentStart != newParentStart || parentEnd != newParentEnd) { - node.getParent().setSourceRange(newParentStart, newParentEnd - newParentStart); + if( node.getStartPosition() < node.getParent().getStartPosition()) { + int parentEnd = node.getParent().getStartPosition() + node.getParent().getLength(); + if( node.getStartPosition() >= 0 ) { + node.getParent().setSourceRange(node.getStartPosition(), parentEnd - node.getStartPosition()); + } } } }