mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
contract nulls are compatible with array return types (IDEA-137323)
This commit is contained in:
+1
-1
@@ -65,7 +65,7 @@ public class InferenceFromSourceUtil {
|
||||
returnValue == MethodContract.ValueConstraint.FALSE_VALUE;
|
||||
}
|
||||
|
||||
if (returnType instanceof PsiClassType) {
|
||||
if (!(returnType instanceof PsiPrimitiveType)) {
|
||||
return returnValue == MethodContract.ValueConstraint.NULL_VALUE ||
|
||||
returnValue == MethodContract.ValueConstraint.NOT_NULL_VALUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
class Zoo {
|
||||
@Contract( "null->null" )
|
||||
static byte[] bar( String s )
|
||||
{
|
||||
if ( s == null )
|
||||
return null;
|
||||
return new byte[0];
|
||||
}}
|
||||
@@ -42,4 +42,5 @@ public class ContractCheckTest extends LightCodeInsightFixtureTestCase {
|
||||
public void testSignatureIssues() { doTest(); }
|
||||
public void testVarargInferred() { doTest(); }
|
||||
public void testDoubleParameter() { doTest(); }
|
||||
public void testReturnPrimitiveArray() { doTest(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user