RangeHighlighterEx () { final Document document = getCachedDocument(); if (document == null) return null; RangeHighlighterEx result = SoftReference.dereference(myHighlighterRef); if (result != null) { return result; } MarkupModelEx markup = (MarkupModelEx)DocumentMarkupModel.forDocument(document, myTarget.getProject(), true); final Document markupDocument = markup.getDocument(); final int startOffset = 0; final int endOffset = markupDocument.getTextLength(); final Ref<RangeHighlighterEx> found = new Ref<>(); markup.processRangeHighlightersOverlappingWith(startOffset, endOffset, highlighter -> { GutterMark renderer = highlighter.getGutterIconRenderer(); if (renderer instanceof MyGutterIconRenderer && ((MyGutterIconRenderer)renderer).myBookmark == this) { found.set(highlighter); return false; } return true; }); result = found.get(); myHighlighterRef = result == null ? null : new WeakReference<>(result); return result; }