mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
move members: ignore conflict if resolution was with static problems (IDEA-149968)
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
package com.intellij.refactoring.util;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.module.ModuleUtilCore;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
@@ -217,7 +216,10 @@ public class RefactoringConflictsUtil {
|
||||
}
|
||||
else if (newContext instanceof PsiClass && refMember instanceof PsiField && refMember.getContainingClass() == member.getContainingClass()) {
|
||||
final PsiField fieldInSubClass = ((PsiClass)newContext).findFieldByName(refMember.getName(), false);
|
||||
if (fieldInSubClass != null && fieldInSubClass != refMember) {
|
||||
if (fieldInSubClass != null &&
|
||||
!refMember.hasModifierProperty(PsiModifier.STATIC) &&
|
||||
fieldInSubClass != refMember &&
|
||||
!member.hasModifierProperty(PsiModifier.STATIC)) {
|
||||
conflicts.putValue(refMember, CommonRefactoringUtil.capitalize(RefactoringUIUtil.getDescription(fieldInSubClass, true) +
|
||||
" would hide " + RefactoringUIUtil.getDescription(refMember, true) +
|
||||
" which is used by moved " + RefactoringUIUtil.getDescription(member, false)));
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
class A {
|
||||
|
||||
String myFoo;
|
||||
}
|
||||
|
||||
class B {
|
||||
String myFoo;
|
||||
|
||||
public static void foo(A a) {
|
||||
System.out.println(myFoo);
|
||||
System.out.println(a.myFoo);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class A {
|
||||
public static void foo(A a) {
|
||||
System.out.println(myFoo);
|
||||
System.out.println(a.myFoo);
|
||||
}
|
||||
|
||||
String myFoo;
|
||||
}
|
||||
|
||||
class B {
|
||||
String myFoo;
|
||||
}
|
||||
@@ -194,6 +194,10 @@ public class MoveMembersTest extends MultiFileTestCase {
|
||||
doTest("ImportingClass.Constants", "ImportingClass.ImportantConstants", 0);
|
||||
}
|
||||
|
||||
public void testStaticProblemsShouldNotRaiseAConflict() throws Exception {
|
||||
doTest("A", "B", 0);
|
||||
}
|
||||
|
||||
public void testFromNestedToOuterMethodRef() throws Exception {
|
||||
final LanguageLevelProjectExtension projectExtension = LanguageLevelProjectExtension.getInstance(getProject());
|
||||
final LanguageLevel oldLevel = projectExtension.getLanguageLevel();
|
||||
|
||||
Reference in New Issue
Block a user