mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
provide accessibility fixes for problems inside annotations (IDEA-148864)
This commit is contained in:
+3
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@SomeAnnotation(<error descr="'Foo.Bar' has private access in 'Foo'">Foo.Bar.class</error>)
|
||||
@SomeAnnotation(<error descr="'Foo.Bar' has private access in 'Foo'">Foo.Bar</error>.class)
|
||||
public class Foo{
|
||||
private static class Bar {
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Make 'Inner' protected" "true"
|
||||
@MyAnnotation(Outer.Inner.class)
|
||||
public class Outer {
|
||||
|
||||
protected static class Inner {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@interface MyAnnotation {
|
||||
Class<?> value();
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Make 'Inner' protected" "true"
|
||||
@MyAnnotation(Outer.I<caret>nner.class)
|
||||
public class Outer {
|
||||
|
||||
private static class Inner {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@interface MyAnnotation {
|
||||
Class<?> value();
|
||||
}
|
||||
+24
@@ -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";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user