mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
java: missed type cast suggestion on annotated types (IDEA-256942)
GitOrigin-RevId: 86dd16b919e602d375267b868c84384eb4e097cd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d18b2a7398
commit
6a0c39b3ee
@@ -90,8 +90,7 @@ public abstract class ArgumentFixerActionFactory {
|
||||
PsiSubstitutor substitutor = candidate.getSubstitutor();
|
||||
PsiType originalParameterType = PsiTypesUtil.getParameterType(method.getParameterList().getParameters(), i, true);
|
||||
PsiType parameterType = substitutor.substitute(originalParameterType);
|
||||
if (parameterType instanceof PsiWildcardType) continue;
|
||||
if (!GenericsUtil.isFromExternalTypeLanguage(parameterType)) continue;
|
||||
if (!PsiTypesUtil.isDenotableType(parameterType, call)) continue;
|
||||
if (suggestedCasts.contains(parameterType.getCanonicalText())) continue;
|
||||
if (TypeConversionUtil.isPrimitiveAndNotNull(exprType) && parameterType instanceof PsiClassType) {
|
||||
PsiType unboxedParameterType = PsiPrimitiveType.getUnboxedType(parameterType);
|
||||
|
||||
@@ -279,10 +279,6 @@ public final class GenericsUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isFromExternalTypeLanguage(@NotNull PsiType type) {
|
||||
return type.getInternalCanonicalText().equals(type.getCanonicalText());
|
||||
}
|
||||
|
||||
@Contract("null -> null; !null->!null")
|
||||
public static PsiType getVariableTypeByExpressionType(@Nullable PsiType type) {
|
||||
return type == null ? null : getVariableTypeByExpressionType(type, true);
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Cast parameter to 'java.lang.@Anno String'" "true"
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
@Target(ElementType.TYPE_USE)
|
||||
@interface Anno {}
|
||||
class a {
|
||||
void f(@Anno String s) { }
|
||||
void m(Object o) {
|
||||
if (o instanceof String) {
|
||||
f((String) o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Cast parameter to 'java.lang.@Anno String'" "true"
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
@Target(ElementType.TYPE_USE)
|
||||
@interface Anno {}
|
||||
class a {
|
||||
void f(@Anno String s) { }
|
||||
void m(Object o) {
|
||||
if (o instanceof String) {
|
||||
f(<caret>o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user