mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-244926: dont pass implicit static fields as static parameters
GitOrigin-RevId: 74272ab0afe9315626c5aae33c58f5448e5d2ce8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e6c2ee1791
commit
5f0630e50c
+1
-1
@@ -128,7 +128,7 @@ class CodeFragmentAnalyzer(val elements: List<PsiElement>) {
|
||||
}
|
||||
}
|
||||
elements.forEach { it.accept(visitor) }
|
||||
return usedFields.distinct().filterNot { usage -> usage.field.modifierList?.hasExplicitModifier(PsiModifier.STATIC) == true }
|
||||
return usedFields.distinct().filterNot { usage -> usage.field.modifierList?.hasModifierProperty(PsiModifier.STATIC) == true }
|
||||
}
|
||||
|
||||
private fun lastGotoPointFrom(instructionOffset: Int): Int {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
interface Test {
|
||||
int implicitStatic = 42;
|
||||
|
||||
default void test(){
|
||||
<selection>System.out.println(implicitStatic);</selection>
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
interface Test {
|
||||
int implicitStatic = 42;
|
||||
|
||||
default void test(){
|
||||
newMethod();
|
||||
}
|
||||
|
||||
private static void newMethod() {
|
||||
System.out.println(implicitStatic);
|
||||
}
|
||||
}
|
||||
@@ -257,6 +257,10 @@ public class ExtractMethodNewTest extends LightJavaCodeInsightTestCase {
|
||||
doTestPassFieldsAsParams();
|
||||
}
|
||||
|
||||
public void testNotPassedStaticField2() throws Exception {
|
||||
doTestPassFieldsAsParams();
|
||||
}
|
||||
|
||||
public void testExtractAssignmentExpression() throws Exception {
|
||||
try {
|
||||
doTest();
|
||||
|
||||
Reference in New Issue
Block a user