Skip to content

Commit 6998a70

Browse files
committed
Replace assert.
1 parent 37531a7 commit 6998a70

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rascal-lsp/src/main/java/org/rascalmpl/vscode/lsp/util/locations/impl/ArrayLineOffsetMap.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ public int translateInverseColumn(int line, int column, boolean isEnd) {
8080

8181
@Override
8282
public Pair<Integer, Integer> calculateInverseOffsetLength(int beginLine, int beginColumn, int endLine, int endColumn) {
83-
assert beginLine <= endLine : "beginLine cannot be larger than endLine";
83+
if (beginLine > endLine || (beginLine == endLine && beginColumn > endColumn)) {
84+
throw new IllegalArgumentException("Begin position must be before end position");
85+
}
8486

8587
int startOffset = lineStartOffsets.get(beginLine) + translateInverseColumn(beginLine, beginColumn, false);
8688
int endOffset = lineStartOffsets.get(endLine) + translateInverseColumn(endLine, endColumn, true);

0 commit comments

Comments
 (0)