Source:
<code>protected void updateMarker(IResource resource, Diagnostic diagnostic, IMarker marker) { try { if (resource.getType() != IResource.FILE) { return; } IFile file = (IFile) resource; ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager(); ITextFileBuffer textFileBuffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE); if (textFileBuffer == null) { manager.connect(file.getFullPath(), LocationKind.IFILE, new NullProgressMonitor()); textFileBuffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE); } IDocument document = textFileBuffer.getDocument(); int start = Math.min(LSPEclipseUtils.toOffset(diagnostic.getRange().getStart(), document), document.getLength()); int end = Math.min(LSPEclipseUtils.toOffset(diagnostic.getRange().getEnd(), document), document.getLength()); if (start == end && document.getLength() > end) { end++; if (document.getLineOfOffset(end) != document.getLineOfOffset(start)) { start--; end--; } } <START> Map<String, Object> targetAttributes = Map.of( <END> LSP_DIAGNOSTIC, diagnostic, LANGUAGE_SERVER_ID, this.languageServerId, IMarker.MESSAGE, diagnostic.getMessage(), IMarker.SEVERITY, LSPEclipseUtils.toEclipseMarkerSeverity(diagnostic.getSeverity()), IMarker.CHAR_START, start, IMarker.CHAR_END, end, IMarker.LINE_NUMBER, document.getLineOfOffset(start) + 1 ); if (!targetAttributes.equals(marker.getAttributes())) { marker.setAttributes(targetAttributes); } } catch (CoreException | BadLocationException e) { LanguageServerPlugin.logError(e); } }</code><technical_language>Map.of is for Java9, no</technical_language>

Target:
protected void updateMarker(IResource resource, Diagnostic diagnostic, IMarker marker) { try { if (resource.getType() != IResource.FILE) { return; } IFile file = (IFile) resource; ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager(); ITextFileBuffer textFileBuffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE); if (textFileBuffer == null) { manager.connect(file.getFullPath(), LocationKind.IFILE, new NullProgressMonitor()); textFileBuffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE); } IDocument document = textFileBuffer.getDocument(); int start = Math.min(LSPEclipseUtils.toOffset(diagnostic.getRange().getStart(), document), document.getLength()); int end = Math.min(LSPEclipseUtils.toOffset(diagnostic.getRange().getEnd(), document), document.getLength()); if (start == end && document.getLength() > end) { end++; if (document.getLineOfOffset(end) != document.getLineOfOffset(start)) { start--; end--; } } Map<String, Object> targetAttributes = new HashMap<>(7); targetAttributes.put(LSP_DIAGNOSTIC, diagnostic); targetAttributes.put(LANGUAGE_SERVER_ID, this.languageServerId); targetAttributes.put(IMarker.MESSAGE, diagnostic.getMessage()); targetAttributes.put(IMarker.SEVERITY, LSPEclipseUtils.toEclipseMarkerSeverity(diagnostic.getSeverity())); targetAttributes.put(IMarker.CHAR_START, start); targetAttributes.put(IMarker.CHAR_END, end); targetAttributes.put(IMarker.LINE_NUMBER, document.getLineOfOffset(start) + 1); if (!targetAttributes.equals(marker.getAttributes())) { marker.setAttributes(targetAttributes); } } catch (CoreException | BadLocationException e) { LanguageServerPlugin.logError(e); } }