inline parameter: conflict if initializer depends on caller parameter

This commit is contained in:
anna
2010-02-09 16:04:11 +03:00
parent 91bd67e977
commit bd9424a2e7
3 changed files with 21 additions and 0 deletions
@@ -177,6 +177,8 @@ public class InlineParameterExpressionProcessor extends BaseRefactoringProcessor
if (!mySameClass && !((PsiModifierListOwner)element).hasModifierProperty(PsiModifier.STATIC)) {
conflicts.putValue(expression, "Parameter initializer depend on non static member from some other class");
}
} else if (element instanceof PsiParameter) {
conflicts.putValue(expression, "Parameter initializer depends on callers parameter");
}
}
@@ -0,0 +1,9 @@
class Outer {
public void withClass(Object <caret>o) {
System.out.println(o.toString());
}
public void foor(Object objct) {
withClass(objct);
}
}
@@ -148,6 +148,16 @@ public class InlineParameterTest extends LightCodeInsightTestCase {
}
}
public void testRefCallerParameter() throws Exception {
try {
doTest(false);
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
assertEquals("Parameter initializer depends on callers parameter", e.getMessage());
}
}
public void testHandleExceptions() throws Exception {
doTest(false);
}