mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-185445 Cannot return null from method returning BigDecimal
This commit is contained in:
+2
-2
@@ -53,10 +53,10 @@ public class GrNumberConverter extends GrTypeConverter {
|
||||
return isFloatOrDoubleType(targetType) ? OK : null;
|
||||
|
||||
if (TypesUtil.isClassType(targetType, JAVA_MATH_BIG_DECIMAL))
|
||||
return TypesUtil.isNumericType(actualType) ? OK : ERROR;
|
||||
return TypesUtil.isNumericType(actualType) || PsiType.NULL.equals(actualType) ? OK : ERROR;
|
||||
|
||||
if (TypesUtil.isClassType(targetType, JAVA_MATH_BIG_INTEGER))
|
||||
return TypesUtil.isIntegralNumberType(actualType) ? OK : ERROR;
|
||||
return TypesUtil.isIntegralNumberType(actualType) || PsiType.NULL.equals(actualType) ? OK : ERROR;
|
||||
|
||||
if (TypesUtil.isClassType(actualType, JAVA_MATH_BIG_INTEGER))
|
||||
return TypesUtil.isClassType(targetType, JAVA_MATH_BIG_INTEGER) || TypesUtil.isClassType(targetType, JAVA_MATH_BIG_DECIMAL) ? OK : null;
|
||||
|
||||
+19
@@ -134,6 +134,25 @@ class GrAssignAutoTest extends GrHighlightingTestBase {
|
||||
'BigInteger -> int[]', 'BigInteger -> double[]', 'BigInteger -> short', 'int[] -> double[]', 'int[] -> Integer[]']
|
||||
}
|
||||
|
||||
void testReturnAssignValue() {
|
||||
doTest '''
|
||||
@CompileStatic
|
||||
%2$s method%3$s() {
|
||||
return %1$s
|
||||
}
|
||||
''',
|
||||
vectorProduct(values, types),
|
||||
[],
|
||||
['true -> int', 'true -> double', 'true -> short', 'true -> byte', 'false -> int', 'false -> double', 'false -> short',
|
||||
'false -> byte', '(Void)null -> int', '(Void)null -> double', '(Void)null -> BigDecimal', '(Void)null -> BigInteger',
|
||||
'(Void)null -> List', '(Void)null -> Thread', '(Void)null -> List<BigDecimal>', '(Void)null -> List<BigInteger>',
|
||||
'(Void)null -> List<Integer>', '(Void)null -> List<String>', '(Void)null -> List<Object>', '(Void)null -> List<Thread>',
|
||||
'(Void)null -> boolean[]', '(Void)null -> int[]', '(Void)null -> double[]', '(Void)null -> String[]',
|
||||
'(Void)null -> Integer[]', '(Void)null -> List[]', '(Void)null -> Object[]', '(Void)null -> Thread[]',
|
||||
'(Void)null -> short', '(Void)null -> byte', '(Void)null -> Set', '(Void)null -> Set<String>',
|
||||
'(Void)null -> Set<Integer>', '(Void)null -> Set<Object>', '(Void)null -> Set<Thread>']
|
||||
}
|
||||
|
||||
void testLocalAssignValue() {
|
||||
doTest '''
|
||||
@CompileStatic
|
||||
|
||||
Reference in New Issue
Block a user