diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml
index 8c9749cb069e..a1045f5e6e68 100644
--- a/plugins/groovy/src/META-INF/plugin.xml
+++ b/plugins/groovy/src/META-INF/plugin.xml
@@ -214,6 +214,8 @@
+
+
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/search/GrPrivateFieldScopeEnlarger.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/search/GrPrivateFieldScopeEnlarger.java
new file mode 100644
index 000000000000..bfec45545892
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/search/GrPrivateFieldScopeEnlarger.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2000-2011 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.plugins.groovy.lang.psi.impl.search;
+
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiField;
+import com.intellij.psi.PsiModifier;
+import com.intellij.psi.impl.PsiManagerEx;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.psi.search.UseScopeEnlarger;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Maxim.Medvedev
+ */
+public class GrPrivateFieldScopeEnlarger extends UseScopeEnlarger {
+ @Override
+ public SearchScope getAdditionalUseScope(@NotNull PsiElement element) {
+ if (element instanceof PsiField && ((PsiField)element).hasModifierProperty(PsiModifier.PRIVATE)) {
+ final PsiManagerEx psiManager = (PsiManagerEx)element.getManager();
+ final GlobalSearchScope maximalUseScope = psiManager.getFileManager().getUseScope(element);
+ return new GrSourceFilterScope(maximalUseScope);
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/rename/RenameTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/rename/RenameTest.groovy
index a6a97945d0ce..cf1b57537073 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/rename/RenameTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/rename/RenameTest.groovy
@@ -425,6 +425,21 @@ class Foo {
assertTrue false
}
+ public void testRenameJavaPrivateField() {
+ myFixture.addFileToProject "Foo.java", """
+public class Foo {
+ private int field;
+}"""
+ myFixture.configureByText "Bar.groovy", """
+print new Foo(field: 2)
+"""
+ myFixture.renameElement myFixture.findClass("Foo").fields[0], "anotherOneName"
+
+ myFixture.checkResult """
+print new Foo(anotherOneName: 2)
+"""
+ }
+
private def doInplaceRenameTest() {
String prefix = TestUtils.getTestDataPath() + "groovy/refactoring/rename/" + getTestName(false)
myFixture.configureByFile prefix + ".groovy";