From 4cdf6d94de01609858795c9ab7f48252e2215bd0 Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 1 Aug 2012 15:48:53 +0200 Subject: [PATCH] check for conflicts with escalate visibility setting on (IDEA-88719) --- .../refactoring/memberPullUp/PullUpConflictsUtil.java | 2 +- .../refactoring/pullUp/EscalateVisibility.java | 10 ++++++++++ .../refactoring/pullUp/EscalateVisibility_after.java | 10 ++++++++++ .../testSrc/com/intellij/refactoring/PullUpTest.java | 4 ++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 java/java-tests/testData/refactoring/pullUp/EscalateVisibility.java create mode 100644 java/java-tests/testData/refactoring/pullUp/EscalateVisibility_after.java diff --git a/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpConflictsUtil.java b/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpConflictsUtil.java index e1d2f4a31f95..4d5d8b5b1a59 100644 --- a/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpConflictsUtil.java +++ b/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpConflictsUtil.java @@ -104,7 +104,7 @@ public class PullUpConflictsUtil { } } } - RefactoringConflictsUtil.analyzeAccessibilityConflicts(movedMembers, superClass, conflicts, null, targetRepresentativeElement, abstrMethods); + RefactoringConflictsUtil.analyzeAccessibilityConflicts(movedMembers, superClass, conflicts, VisibilityUtil.ESCALATE_VISIBILITY, targetRepresentativeElement, abstrMethods); if (superClass != null) { if (movedMembers2Super) { checkSuperclassMembers(superClass, infos, conflicts); diff --git a/java/java-tests/testData/refactoring/pullUp/EscalateVisibility.java b/java/java-tests/testData/refactoring/pullUp/EscalateVisibility.java new file mode 100644 index 000000000000..cf7514f4ab92 --- /dev/null +++ b/java/java-tests/testData/refactoring/pullUp/EscalateVisibility.java @@ -0,0 +1,10 @@ +class Foo { + +} + +class FooImpl extends Foo { + private void foo(){} + void bar() { + foo(); + } +} \ No newline at end of file diff --git a/java/java-tests/testData/refactoring/pullUp/EscalateVisibility_after.java b/java/java-tests/testData/refactoring/pullUp/EscalateVisibility_after.java new file mode 100644 index 000000000000..3a24c9d5d681 --- /dev/null +++ b/java/java-tests/testData/refactoring/pullUp/EscalateVisibility_after.java @@ -0,0 +1,10 @@ +class Foo { + + protected void foo(){} +} + +class FooImpl extends Foo { + void bar() { + foo(); + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java b/java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java index 141ca3afd68c..2ea5421629c9 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java @@ -117,6 +117,10 @@ public class PullUpTest extends LightRefactoringTestCase { public void testTypeParamsConflictingNames() throws Exception { doTest(false, new RefactoringTestUtil.MemberDescriptor("foo", PsiMethod.class)); + } + + public void testEscalateVisibility() throws Exception { + doTest(false, new RefactoringTestUtil.MemberDescriptor("foo", PsiMethod.class)); } private void doTest(RefactoringTestUtil.MemberDescriptor... membersToFind) throws Exception {