diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java
index ca0bdef14229..c847534a7de1 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java
@@ -465,7 +465,7 @@ public class AnnotationsHighlightUtil {
final PsiTypeElement operand = expression.getOperand();
final PsiClass classType = PsiUtil.resolveClassInType(operand.getType());
if (classType != null) {
- checkAccessibility(expression, classType, HighlightUtil.formatClass(classType));
+ checkAccessibility(operand.getInnermostComponentReferenceElement(), classType, HighlightUtil.formatClass(classType));
}
}
@@ -478,7 +478,7 @@ public class AnnotationsHighlightUtil {
}
}
- private void checkAccessibility(PsiExpression expression, PsiMember resolve, String memberString) {
+ private void checkAccessibility(PsiJavaCodeReferenceElement expression, PsiMember resolve, String memberString) {
if (resolve.hasModifierProperty(PsiModifier.PRIVATE) &&
PsiTreeUtil.isAncestor(parent, resolve, true)) {
String description = JavaErrorMessages.message("private.symbol",
@@ -486,6 +486,7 @@ public class AnnotationsHighlightUtil {
HighlightUtil.formatClass((PsiClass)parent));
infos[0] =
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(description).create();
+ HighlightUtil.registerAccessQuickFixAction(resolve, expression, infos[0], null);
}
}
});
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/ClassObjectAccessibility.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/ClassObjectAccessibility.java
index de912bc9cd05..929b107d53f6 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/ClassObjectAccessibility.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/ClassObjectAccessibility.java
@@ -1,4 +1,4 @@
-@SomeAnnotation(Foo.Bar.class)
+@SomeAnnotation(Foo.Bar.class)
public class Foo{
private static class Bar {
}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/makePublic/afterInnerInAnnotation.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/makePublic/afterInnerInAnnotation.java
new file mode 100644
index 000000000000..ca28bcbb0af9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/makePublic/afterInnerInAnnotation.java
@@ -0,0 +1,12 @@
+// "Make 'Inner' protected" "true"
+@MyAnnotation(Outer.Inner.class)
+public class Outer {
+
+ protected static class Inner {
+
+ }
+}
+
+@interface MyAnnotation {
+ Class> value();
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/makePublic/beforeInnerInAnnotation.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/makePublic/beforeInnerInAnnotation.java
new file mode 100644
index 000000000000..aedf91b21f49
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/makePublic/beforeInnerInAnnotation.java
@@ -0,0 +1,12 @@
+// "Make 'Inner' protected" "true"
+@MyAnnotation(Outer.Inner.class)
+public class Outer {
+
+ private static class Inner {
+
+ }
+}
+
+@interface MyAnnotation {
+ Class> value();
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AccessibilityFixesTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AccessibilityFixesTest.java
new file mode 100644
index 000000000000..9f7981c03ee7
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AccessibilityFixesTest.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2000-2016 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 com.intellij.codeInsight.daemon.quickFix;
+
+public class AccessibilityFixesTest extends LightQuickFixParameterizedTestCase {
+
+ @Override
+ protected String getBasePath() {
+ return "/codeInsight/daemonCodeAnalyzer/quickFix/makePublic";
+ }
+}