mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-dfa] Optional.orElse parameter is nullable (IDEA-291604)
GitOrigin-RevId: 1f352520c9e231004f06b6724bba2e00d5377ff4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
764f3515e5
commit
340a56e8af
+12
@@ -0,0 +1,12 @@
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
// IDEA-291604
|
||||
@NonNullByDefault
|
||||
class Test {
|
||||
public @Nullable String test(final Optional<String> optional, final @Nullable String fallback) {
|
||||
return optional.orElse(fallback);
|
||||
}
|
||||
}
|
||||
@@ -308,6 +308,12 @@ public class DataFlowInspection8Test extends DataFlowInspectionTestCase {
|
||||
myFixture.addClass("package org.eclipse.jdt.annotation;public @interface NonNullByDefault {}");
|
||||
doTest();
|
||||
}
|
||||
public void testEclipseDefaultOptionalOrElse() {
|
||||
myFixture.addClass("package org.eclipse.jdt.annotation;public @interface NonNullByDefault {}");
|
||||
myFixture.addClass("package org.eclipse.jdt.annotation;import java.lang.annotation.*;" +
|
||||
"@Target({ElementType.TYPE_USE}) public @interface Nullable {}");
|
||||
doTest();
|
||||
}
|
||||
public void testClassInsideLambda() { doTest(); }
|
||||
public void testMultiDimensionalArrays() {
|
||||
setupTypeUseAnnotations("typeUse", myFixture);
|
||||
|
||||
@@ -3429,6 +3429,7 @@
|
||||
</annotation>
|
||||
</item>
|
||||
<item name='java.util.Optional T orElse(T) 0'>
|
||||
<annotation name='org.jetbrains.annotations.Nullable'/>
|
||||
<annotation name='org.intellij.lang.annotations.Flow'>
|
||||
<val name="targetIsContainer" val="true"/>
|
||||
</annotation>
|
||||
|
||||
Reference in New Issue
Block a user