mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inline parameter: do not warn about inaccessible propagated parameter
This commit is contained in:
+9
-1
@@ -342,7 +342,15 @@ public class InlineParameterExpressionProcessor extends BaseRefactoringProcessor
|
||||
myConflicts.putValue(expression, "Parameter initializer depends on value which is not available inside method");
|
||||
}
|
||||
} else if (element instanceof PsiParameter) {
|
||||
myConflicts.putValue(expression, "Parameter initializer depends on callers parameter");
|
||||
boolean bound = false;
|
||||
for (PsiParameter parameter : myMethod.getParameterList().getParameters()) {
|
||||
if (parameter.getType().equals(((PsiParameter)element).getType()) && parameter.getName().equals(((PsiParameter)element).getName())) {
|
||||
bound = true;
|
||||
}
|
||||
}
|
||||
if (!bound) {
|
||||
myConflicts.putValue(expression, "Parameter initializer depends on callers parameter");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
class X {
|
||||
void bar(String str){
|
||||
foo(str, str.substring(0));
|
||||
}
|
||||
|
||||
void foo(String str, String st<caret>r1) {
|
||||
System.out.println(str);
|
||||
System.out.println(str1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class X {
|
||||
void bar(String str){
|
||||
foo(str);
|
||||
}
|
||||
|
||||
void foo(String str) {
|
||||
System.out.println(str);
|
||||
System.out.println(str.substring(0));
|
||||
}
|
||||
}
|
||||
@@ -138,6 +138,10 @@ public class InlineParameterTest extends LightRefactoringTestCase {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
public void testPropagatedParams() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
public void testParameterWithWriteAccess() throws Exception {
|
||||
try {
|
||||
doTest(false);
|
||||
|
||||
Reference in New Issue
Block a user