mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
preserve annotation attributes on override (IDEA-187940)
This commit is contained in:
+4
-1
@@ -50,7 +50,10 @@ public interface OverrideImplementsAnnotationsHandler {
|
||||
if (AnnotationUtil.isAnnotated(source, annotation, flags) && !AnnotationUtil.isAnnotated(target, annotation, flags)) {
|
||||
PsiModifierList modifierList = target.getModifierList();
|
||||
assert modifierList != null : target;
|
||||
AddAnnotationPsiFix.addPhysicalAnnotation(annotation, PsiNameValuePair.EMPTY_ARRAY, modifierList);
|
||||
PsiAnnotation srcAnnotation = AnnotationUtil.findAnnotation(source, annotation);
|
||||
PsiNameValuePair[] valuePairs = srcAnnotation != null ? srcAnnotation.getParameterList().getAttributes()
|
||||
: PsiNameValuePair.EMPTY_ARRAY;
|
||||
AddAnnotationPsiFix.addPhysicalAnnotation(annotation, valuePairs, modifierList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ class Test implements A {
|
||||
}
|
||||
|
||||
void testCustomOverrideImplementsHandler() throws Exception {
|
||||
myFixture.addClass """package a; public @interface A { }"""
|
||||
myFixture.addClass """package a; public @interface A { String value();}"""
|
||||
|
||||
PlatformTestUtil.registerExtension(Extensions.getRootArea(), OverrideImplementsAnnotationsHandler.EP_NAME, new OverrideImplementsAnnotationsHandler() {
|
||||
@Override
|
||||
@@ -297,7 +297,7 @@ class Test implements A {
|
||||
import a.*;
|
||||
|
||||
interface I {
|
||||
@A List<String> i(@A String p);
|
||||
@A("") List<String> i(@A("a") String p);
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
@@ -311,13 +311,13 @@ class Test implements A {
|
||||
import a.*;
|
||||
|
||||
interface I {
|
||||
@A List<String> i(@A String p);
|
||||
@A("") List<String> i(@A("a") String p);
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
@A
|
||||
@A("")
|
||||
@Override
|
||||
public List<String> i(@A String p) {
|
||||
public List<String> i(@A("a") String p) {
|
||||
return null;
|
||||
}
|
||||
}""".stripIndent()
|
||||
|
||||
Reference in New Issue
Block a user