int (@NotNull Document document, @NotNull PsiFile file, int start, int end) { PsiElement elementAtStartLineEnd = file.findElementAt(start); if (!PsiUtil.isJavaToken(elementAtStartLineEnd, JavaTokenType.SEMICOLON)) return -1; PsiElement elementAtNextLineStart = file.findElementAt(end); if (elementAtNextLineStart == null) return -1; PsiField firstVar = ObjectUtils.tryCast(elementAtStartLineEnd.getParent(), PsiField.class); if (firstVar == null) return -1; PsiField secondVar = PsiTreeUtil.getParentOfType(elementAtNextLineStart, PsiField.class); if (secondVar == null || secondVar == firstVar) return -1; if (PsiTreeUtil.skipWhitespacesForward(firstVar) != secondVar) return -1; return VariableJoinLinesHandler.joinVariables(document, elementAtStartLineEnd, firstVar, secondVar); }