disable wrap with Integer.parseInt for null type (IDEA-164942)

This commit is contained in:
Anna Kozlova
2018-06-18 18:37:27 +03:00
parent 3f970d976e
commit f6853fecd7
2 changed files with 10 additions and 2 deletions

View File

@@ -148,12 +148,12 @@ public class WrapExpressionFix implements IntentionAction {
for (int j = 0; j < expressions.length; j++) {
PsiExpression expression = expressions[j];
final PsiType exprType = expression.getType();
if (exprType != null) {
if (exprType != null && !PsiType.NULL.equals(exprType)) {
PsiType paramType = parameters[Math.min(j, parameters.length - 1)].getType();
if (paramType instanceof PsiEllipsisType) {
paramType = ((PsiEllipsisType)paramType).getComponentType();
}
paramType = substitutor != null ? substitutor.substitute(paramType) : paramType;
paramType = substitutor.substitute(paramType);
if (paramType.isAssignableFrom(exprType)) continue;
final PsiClassType classType = getClassType(paramType, expression);
if (expectedType == null && classType != null && findWrapper(exprType, classType, paramType instanceof PsiPrimitiveType) != null) {

View File

@@ -0,0 +1,8 @@
// "Wrap using 'Integer.parseInt()'" "false"
public class Test {
void ba() {
fa(<caret>null);
}
void fa(int... i){}
}