mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
leave foreign params untouched (IDEA-119700)
This commit is contained in:
+5
@@ -840,6 +840,11 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
|
||||
final int idx = Arrays.binarySearch(oldParameterNames, oldParamName);
|
||||
return idx >= 0 && idx == method.getParameterList().getParameterIndex(parameter) && changeInfo.getNewParameters()[idx].getOldIndex() == idx;
|
||||
}
|
||||
}, new Condition<String>() {
|
||||
@Override
|
||||
public boolean value(String paramName) {
|
||||
return Arrays.binarySearch(oldParameterNames, paramName) >= 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1048,9 +1048,16 @@ public class RefactoringUtil {
|
||||
fixJavadocsForParams(method, newParameters, Condition.FALSE);
|
||||
}
|
||||
|
||||
public static void fixJavadocsForParams(PsiMethod method,
|
||||
Set<PsiParameter> newParameters,
|
||||
Condition<Pair<PsiParameter, String>> eqCondition) throws IncorrectOperationException {
|
||||
fixJavadocsForParams(method, newParameters, eqCondition, Condition.TRUE);
|
||||
}
|
||||
|
||||
public static void fixJavadocsForParams(PsiMethod method,
|
||||
Set<PsiParameter> newParameters,
|
||||
Condition<Pair<PsiParameter, String>> eqCondition) throws IncorrectOperationException {
|
||||
Condition<Pair<PsiParameter, String>> eqCondition,
|
||||
Condition<String> matchedToOldParam) throws IncorrectOperationException {
|
||||
final PsiDocComment docComment = method.getDocComment();
|
||||
if (docComment == null) return;
|
||||
final PsiParameter[] parameters = method.getParameterList().getParameters();
|
||||
@@ -1082,6 +1089,14 @@ public class RefactoringUtil {
|
||||
}
|
||||
|
||||
List<PsiDocTag> newTags = new ArrayList<PsiDocTag>();
|
||||
|
||||
for (PsiDocTag paramTag : paramTags) {
|
||||
final String paramName = getNameOfReferencedParameter(paramTag);
|
||||
if (!tagForParam.containsValue(paramTag) && !matchedToOldParam.value(paramName)) {
|
||||
newTags.add((PsiDocTag)paramTag.copy());
|
||||
}
|
||||
}
|
||||
|
||||
for (PsiParameter parameter : parameters) {
|
||||
if (tagForParam.containsKey(parameter)) {
|
||||
final PsiDocTag psiDocTag = tagForParam.get(parameter);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
class X {
|
||||
|
||||
/**
|
||||
* Has a method called {@link #mymethod(boolean)}.
|
||||
*/
|
||||
public class TestRefactorLink {
|
||||
/**
|
||||
* @param x aparam
|
||||
*/
|
||||
public void <caret>mymethod(boolean a) { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
class X {
|
||||
|
||||
/**
|
||||
* Has a method called {@link #mymethod(boolean, boolean)}.
|
||||
*/
|
||||
public class TestRefactorLink {
|
||||
/**
|
||||
* @param x aparam
|
||||
* @param b
|
||||
*/
|
||||
public void mymethod(boolean a, boolean b) { }
|
||||
}
|
||||
}
|
||||
@@ -189,6 +189,13 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest {
|
||||
}, false);
|
||||
}
|
||||
|
||||
public void testParamJavadoc3() {
|
||||
doTest(null, new ParameterInfoImpl[]{
|
||||
new ParameterInfoImpl(0, "a", PsiType.BOOLEAN),
|
||||
new ParameterInfoImpl(-1, "b", PsiType.BOOLEAN),
|
||||
}, false);
|
||||
}
|
||||
|
||||
public void testJavadocNoNewLineInserted() {
|
||||
doTest(null, new ParameterInfoImpl[]{
|
||||
new ParameterInfoImpl(0, "newArgs", PsiType.DOUBLE),
|
||||
|
||||
Reference in New Issue
Block a user