tests for IDEA-CR-29186

This commit is contained in:
Alexey Kudravtsev
2018-02-13 14:19:12 +03:00
parent d20f061afe
commit 95ffe16d50
3 changed files with 40 additions and 2 deletions
@@ -13,7 +13,6 @@ import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
import com.intellij.psi.impl.JavaConstantExpressionEvaluator;
@@ -353,7 +352,6 @@ abstract class DeprecationInspectionBase extends AbstractBaseJavaLocalInspection
.map(resolved -> (PsiMethod)(resolved instanceof PsiMethod ? resolved : null))
.filter(Objects::nonNull)
.filter(tagMethod -> !tagMethod.isDeprecated())
.filter(tagMethod -> !StringUtil.equals(tagMethod.getName(), method.getName()))
.filter(tagMethod -> !tagMethod.isEquivalentTo(method))
.filter(tagMethod -> areReplaceable(method, tagMethod, call))
.collect(MoreCollectors.onlyOne())
@@ -0,0 +1,20 @@
// "Replace method call with Test.mmm2" "true"
class Test {
static void example() {
Test t = new Test();
t.mmm2("");
}
/**
* @deprecated use {@link #mmm1(int)} or {@link #mmm2(String)} instead
*/
void mmm(String t) {
}
void mmm1(int string) {
}
void mmm2(String string) {
}
}
@@ -0,0 +1,20 @@
// "Replace method call with Test.mmm2" "true"
class Test {
static void example() {
Test t = new Test();
t.m<caret>mm("");
}
/**
* @deprecated use {@link #mmm1(int)} or {@link #mmm2(String)} instead
*/
void mmm(String t) {
}
void mmm1(int string) {
}
void mmm2(String string) {
}
}