mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Inherit type annotations for arrays
Fixes IDEA-240571 "implement method" action works bad with arrays notnulled twice GitOrigin-RevId: 3014f528f6af966153ae4dc8c821240fca3d9d79
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d87f515faa
commit
983a6c1d3a
@@ -446,7 +446,8 @@ public class GenerateMembersUtil {
|
||||
generator.addExistingName(paramName);
|
||||
PsiType expressionType = GenericsUtil.getVariableTypeByExpressionType(substituted);
|
||||
if (expressionType instanceof PsiArrayType && substituted instanceof PsiEllipsisType) {
|
||||
expressionType = new PsiEllipsisType(((PsiArrayType)expressionType).getComponentType());
|
||||
expressionType = new PsiEllipsisType(((PsiArrayType)expressionType).getComponentType())
|
||||
.annotate(expressionType.getAnnotationProvider());
|
||||
}
|
||||
result[i] = factory.createParameter(paramName, expressionType, target);
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ public class GenericsUtil {
|
||||
if (type instanceof PsiWildcardType) {
|
||||
type = ((PsiWildcardType)type).getBound();
|
||||
}
|
||||
return type != null ? type.createArrayType() : arrayType;
|
||||
return type != null ? type.createArrayType().annotate(arrayType.getAnnotationProvider()) : arrayType;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// "Implement methods" "true"
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
abstract class Test {
|
||||
abstract void foo(@NotNull String @NotNull[] data);
|
||||
|
||||
abstract void foo2(@NotNull String @NotNull ... data);
|
||||
}
|
||||
|
||||
class TImple extends Test {
|
||||
@Override
|
||||
void foo(@NotNull String @NotNull [] data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
void foo2(@NotNull String @NotNull ... data) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Target({ElementType.PARAMETER, ElementType.TYPE_USE})
|
||||
@interface NotNull {}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Implement methods" "true"
|
||||
package org.jetbrains.annotations;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
abstract class Test {
|
||||
abstract void foo(@NotNull String @NotNull[] data);
|
||||
|
||||
abstract void foo2(@NotNull String @NotNull ... data);
|
||||
}
|
||||
|
||||
<caret>class TImple extends Test {}
|
||||
|
||||
@Target({ElementType.PARAMETER, ElementType.TYPE_USE})
|
||||
@interface NotNull {}
|
||||
Reference in New Issue
Block a user