From 4ddf41ef2dc0673dc4d77ece098f196d8e080aba Mon Sep 17 00:00:00 2001 From: Rob Stryker Date: Mon, 8 Apr 2024 13:33:34 -0400 Subject: [PATCH] JDT expects semicolon to be part of source range for superconstructor call Signed-off-by: Rob Stryker --- .../src/org/eclipse/jdt/core/dom/JavacConverter.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java index c0d7d1f5e3b..010903a8548 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java @@ -1144,6 +1144,11 @@ private SuperMethodInvocation convertSuperMethodInvocation(JCMethodInvocation ja private SuperConstructorInvocation convertSuperConstructorInvocation(JCMethodInvocation javac) { SuperConstructorInvocation res = this.ast.newSuperConstructorInvocation(); commonSettings(res, javac); + int end = res.getStartPosition() + res.getLength(); + if( end < this.rawText.length() && this.rawText.charAt(end-1) != ';' && this.rawText.charAt(end) == ';') { + // jdt expects semicolon to be part of the range + res.setSourceRange(res.getStartPosition(), res.getLength() + 1); + } javac.getArguments().stream().map(this::convertExpression).forEach(res.arguments()::add); //res.setFlags(javac.getFlags() | ASTNode.MALFORMED);