mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
inline method: allow to inline vars ar parameters for negative values (IDEA-154831)
This commit is contained in:
@@ -1148,6 +1148,9 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
|
||||
else if (initializer instanceof PsiLiteralExpression) {
|
||||
return true;
|
||||
}
|
||||
else if (initializer instanceof PsiPrefixExpression && ((PsiPrefixExpression)initializer).getOperand() instanceof PsiLiteralExpression) {
|
||||
return true;
|
||||
}
|
||||
else if (initializer instanceof PsiArrayAccessExpression) {
|
||||
final PsiExpression arrayExpression = ((PsiArrayAccessExpression)initializer).getArrayExpression();
|
||||
final PsiExpression indexExpression = ((PsiArrayAccessExpression)initializer).getIndexExpression();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
void foo(double d1, double d2) {
|
||||
System.out.println(d1, d2);
|
||||
}
|
||||
|
||||
{
|
||||
f<caret>oo(-12.0, 12.0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
|
||||
{
|
||||
System.out.println(-12.0, 12.0);
|
||||
}
|
||||
}
|
||||
@@ -316,6 +316,10 @@ public class InlineMethodTest extends LightRefactoringTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNegativeArguments() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInaccessibleFieldInSuperClass() throws Exception {
|
||||
doTestConflict("Field <b><code>A.i</code></b> that is used in inlined method is not accessible from call site(s) in method <b><code>B.bar()</code></b>");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user