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 bd66548a04a..999ddd23d79 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 @@ -49,9 +49,8 @@ import com.sun.tools.javac.parser.ParserFactory; import com.sun.tools.javac.parser.Tokens.Comment; import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle; -import com.sun.tools.javac.tree.JCTree; -import com.sun.tools.javac.tree.TreeInfo; import com.sun.tools.javac.tree.DCTree.DCDocComment; +import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.JCAnnotatedType; import com.sun.tools.javac.tree.JCTree.JCAnnotation; import com.sun.tools.javac.tree.JCTree.JCAnyPattern; @@ -125,6 +124,7 @@ import com.sun.tools.javac.tree.JCTree.JCWildcard; import com.sun.tools.javac.tree.JCTree.JCYield; import com.sun.tools.javac.tree.JCTree.Tag; +import com.sun.tools.javac.tree.TreeInfo; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.JCDiagnostic; import com.sun.tools.javac.util.Log; @@ -2877,7 +2877,8 @@ private IfStatement convertIfStatement(JCIf javac) { Type convertToType(JCTree javac) { if (javac instanceof JCIdent ident) { Name name = convertName(ident.name); - name.setSourceRange(ident.getStartPosition(), ident.name.length()); + int len = FAKE_IDENTIFIER.equals(name.toString()) ? 0 : ident.name.length(); + name.setSourceRange(ident.getStartPosition(), len); SimpleType res = this.ast.newSimpleType(name); commonSettings(res, ident); commonSettings(name, ident);