overload resolution: boxing should ignore null types (IDEA-148692)

This commit is contained in:
Anna Kozlova
2015-11-30 19:45:19 +01:00
parent 7bfaeae2e4
commit 878ac5560e
3 changed files with 19 additions and 1 deletions
@@ -154,7 +154,8 @@ public class PsiPolyExpressionUtil {
public static boolean isExpressionOfPrimitiveType(@Nullable PsiExpression arg) {
if (arg != null && !isPolyExpression(arg)) {
return arg.getType() instanceof PsiPrimitiveType;
final PsiType type = arg.getType();
return type instanceof PsiPrimitiveType && type != PsiType.NULL;
}
else if (arg instanceof PsiNewExpression || arg instanceof PsiFunctionalExpression) {
return false;
@@ -0,0 +1,13 @@
class Test {
private void <warning descr="Private method 'foo(java.lang.String, java.lang.Object)' is never used">foo</warning>(String s, Object o) {
System.out.println(s + "; o:" + o);
}
private void foo(String s, boolean b) {
System.out.println(s + "; b:" + b);
}
{
foo(null, false);
}
}
@@ -175,6 +175,10 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testNoBoxingWithNullType() throws Exception {
doTest();
}
private void doTest() {
doTest(true);
}