OffsetMap (@NotNull Document anotherDocument) { if (anotherDocument.getTextLength() != myDocument.getTextLength()) { LOG.error("Different document lengths: " + myDocument.getTextLength() + " for " + myDocument + " and " + anotherDocument.getTextLength() + " for " + anotherDocument); } return mapOffsets(anotherDocument, Function.identity()); }