diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java
index c372cdfa6b2..ad98340fe9a 100644
--- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java
+++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java
@@ -605,6 +605,8 @@ public interface Errors {
// Error sets
ImmutableSet extends DiagnosticFactory>> UNRESOLVED_REFERENCE_DIAGNOSTICS = ImmutableSet.of(
UNRESOLVED_REFERENCE, NAMED_PARAMETER_NOT_FOUND, UNRESOLVED_REFERENCE_WRONG_RECEIVER);
+ ImmutableSet extends DiagnosticFactory>> INVISIBLE_REFERENCE_DIAGNOSTICS = ImmutableSet.of(
+ INVISIBLE_MEMBER, INVISIBLE_MEMBER_FROM_INLINE, INVISIBLE_REFERENCE, INVISIBLE_SETTER);
ImmutableSet extends DiagnosticFactory>> UNUSED_ELEMENT_DIAGNOSTICS = ImmutableSet.of(
UNUSED_VARIABLE, UNUSED_PARAMETER, ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE);
ImmutableSet extends DiagnosticFactory>> TYPE_INFERENCE_ERRORS = ImmutableSet.of(
diff --git a/idea/src/org/jetbrains/jet/plugin/refactoring/JetRefactoringBundle.properties b/idea/src/org/jetbrains/jet/plugin/refactoring/JetRefactoringBundle.properties
index 2f60b4d0d88..506747d3320 100644
--- a/idea/src/org/jetbrains/jet/plugin/refactoring/JetRefactoringBundle.properties
+++ b/idea/src/org/jetbrains/jet/plugin/refactoring/JetRefactoringBundle.properties
@@ -38,5 +38,6 @@ package.private.0.will.no.longer.be.accessible.from.1=Package-private {0} will n
0.uses.package.private.1={0} uses package-private {1}
0.will.no.longer.be.accessible.after.extraction={0} will no longer be accessible after extraction
0.will.become.invisible.after.extraction={0} will become invisible after extraction
+setter.of.0.will.become.invisible.after.extraction = Setter of {0} will become invisible after extraction
naming.convention.will.be.violated.after.rename=Naming conventions will be violated after rename
\ No newline at end of file
diff --git a/idea/src/org/jetbrains/jet/plugin/refactoring/extractFunction/extractableAnalysisUtil.kt b/idea/src/org/jetbrains/jet/plugin/refactoring/extractFunction/extractableAnalysisUtil.kt
index 984adf01fda..2a27ec76130 100644
--- a/idea/src/org/jetbrains/jet/plugin/refactoring/extractFunction/extractableAnalysisUtil.kt
+++ b/idea/src/org/jetbrains/jet/plugin/refactoring/extractFunction/extractableAnalysisUtil.kt
@@ -721,14 +721,22 @@ fun ExtractableCodeDescriptor.validate(): ExtractableCodeDescriptorWithConflicts
continue
}
- diagnostics.firstOrNull { it.getFactory() == Errors.INVISIBLE_MEMBER }?.let {
- conflicts.putValue(
- resolveResult.originalRefExpr,
+ diagnostics.firstOrNull { it.getFactory() in Errors.INVISIBLE_REFERENCE_DIAGNOSTICS }?.let {
+ val message = when (it.getFactory()) {
+ Errors.INVISIBLE_SETTER ->
+ JetRefactoringBundle.message(
+ "setter.of.0.will.become.invisible.after.extraction",
+ RefactoringUIUtil.getDescription(resolveResult.declaration, true)
+ )
+
+ else ->
JetRefactoringBundle.message(
"0.will.become.invisible.after.extraction",
RefactoringUIUtil.getDescription(resolveResult.declaration, true).capitalize()
)
- )
+ }
+
+ conflicts.putValue(resolveResult.originalRefExpr, message)
}
}
diff --git a/idea/testData/refactoring/extractFunction/basic/privateMemberInClassObject.kt b/idea/testData/refactoring/extractFunction/basic/privateMemberInClassObject.kt
new file mode 100644
index 00000000000..3b46b6cbb10
--- /dev/null
+++ b/idea/testData/refactoring/extractFunction/basic/privateMemberInClassObject.kt
@@ -0,0 +1,9 @@
+// SIBLING:
+public class A {
+ class object {
+ private val t: Int = 1
+ }
+ fun f() {
+ t
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/refactoring/extractFunction/basic/privateMemberInClassObject.kt.conflicts b/idea/testData/refactoring/extractFunction/basic/privateMemberInClassObject.kt.conflicts
new file mode 100644
index 00000000000..cd10b5c7925
--- /dev/null
+++ b/idea/testData/refactoring/extractFunction/basic/privateMemberInClassObject.kt.conflicts
@@ -0,0 +1 @@
+Property A.t will become invisible after extraction
\ No newline at end of file
diff --git a/idea/testData/refactoring/extractFunction/basic/privateNestedClass.kt b/idea/testData/refactoring/extractFunction/basic/privateNestedClass.kt
new file mode 100644
index 00000000000..1ae6bcd4079
--- /dev/null
+++ b/idea/testData/refactoring/extractFunction/basic/privateNestedClass.kt
@@ -0,0 +1,7 @@
+// SIBLING:
+public class A {
+ private class B
+ fun f() {
+ val b: A.B
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/refactoring/extractFunction/basic/privateNestedClass.kt.conflicts b/idea/testData/refactoring/extractFunction/basic/privateNestedClass.kt.conflicts
new file mode 100644
index 00000000000..6a0715f3bb2
--- /dev/null
+++ b/idea/testData/refactoring/extractFunction/basic/privateNestedClass.kt.conflicts
@@ -0,0 +1 @@
+Class A.B will become invisible after extraction
\ No newline at end of file
diff --git a/idea/testData/refactoring/extractFunction/basic/privateSetter.kt b/idea/testData/refactoring/extractFunction/basic/privateSetter.kt
new file mode 100644
index 00000000000..2dd637d4375
--- /dev/null
+++ b/idea/testData/refactoring/extractFunction/basic/privateSetter.kt
@@ -0,0 +1,9 @@
+// SIBLING:
+class A {
+ var t = 1
+ private set
+
+ fun test() {
+ t = 5
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/refactoring/extractFunction/basic/privateSetter.kt.conflicts b/idea/testData/refactoring/extractFunction/basic/privateSetter.kt.conflicts
new file mode 100644
index 00000000000..dcbb6a6a5af
--- /dev/null
+++ b/idea/testData/refactoring/extractFunction/basic/privateSetter.kt.conflicts
@@ -0,0 +1 @@
+Setter of property A.t will become invisible after extraction
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/jet/plugin/refactoring/introduce/introduceVariable/JetExtractionTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/refactoring/introduce/introduceVariable/JetExtractionTestGenerated.java
index 88853a660e2..a1fb47bd9cd 100644
--- a/idea/tests/org/jetbrains/jet/plugin/refactoring/introduce/introduceVariable/JetExtractionTestGenerated.java
+++ b/idea/tests/org/jetbrains/jet/plugin/refactoring/introduce/introduceVariable/JetExtractionTestGenerated.java
@@ -288,11 +288,26 @@ public class JetExtractionTestGenerated extends AbstractJetExtractionTest {
doExtractFunctionTest("idea/testData/refactoring/extractFunction/basic/noConflictWithInnerFunction.kt");
}
+ @TestMetadata("privateMemberInClassObject.kt")
+ public void testPrivateMemberInClassObject() throws Exception {
+ doExtractFunctionTest("idea/testData/refactoring/extractFunction/basic/privateMemberInClassObject.kt");
+ }
+
@TestMetadata("privateMemberRef.kt")
public void testPrivateMemberRef() throws Exception {
doExtractFunctionTest("idea/testData/refactoring/extractFunction/basic/privateMemberRef.kt");
}
+ @TestMetadata("privateNestedClass.kt")
+ public void testPrivateNestedClass() throws Exception {
+ doExtractFunctionTest("idea/testData/refactoring/extractFunction/basic/privateNestedClass.kt");
+ }
+
+ @TestMetadata("privateSetter.kt")
+ public void testPrivateSetter() throws Exception {
+ doExtractFunctionTest("idea/testData/refactoring/extractFunction/basic/privateSetter.kt");
+ }
+
@TestMetadata("refInReturn.kt")
public void testRefInReturn() throws Exception {
doExtractFunctionTest("idea/testData/refactoring/extractFunction/basic/refInReturn.kt");