[groovy] fix warnings in StringPartInfo

GitOrigin-RevId: 0beced554224da4aba320edea8e6289d230e07c6
This commit is contained in:
Daniil Ovchinnikov
2019-11-15 07:34:12 +00:00
committed by intellij-monorepo-bot
parent fd3aa35384
commit 170dc73bbb
@@ -37,6 +37,7 @@ import org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* @author Max Medvedev
@@ -202,23 +203,19 @@ public class StringPartInfo {
try {
if (prefixExists && suffixExists) {
return ((GrBinaryExpression)((GrBinaryExpression)replaced).getLeftOperand()).getRightOperand();
return Objects.requireNonNull(((GrBinaryExpression)((GrBinaryExpression)replaced).getLeftOperand()).getRightOperand());
}
if (!prefixExists && suffixExists) {
return ((GrBinaryExpression)replaced).getLeftOperand();
}
if (prefixExists && !suffixExists) {
return ((GrBinaryExpression)replaced).getRightOperand();
}
if (!prefixExists && !suffixExists) {
return replaced;
if (prefixExists) {
return Objects.requireNonNull(((GrBinaryExpression)replaced).getRightOperand());
}
return replaced;
}
catch (ClassCastException c) {
throw new IncorrectOperationException(buffer.toString());
}
throw new IncorrectOperationException(buffer.toString());
}
private String prepareSelected() {