mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
use Optional.of() instead ofNullable() in "opt" postfix template when expression is not null
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class Test {
|
||||
@NotNull
|
||||
String foo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
void m() {
|
||||
foo().opt<caret>
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class Test {
|
||||
@NotNull
|
||||
String foo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
void m() {
|
||||
java.util.Optional.of(foo())
|
||||
}
|
||||
}
|
||||
+6
@@ -80,6 +80,12 @@ public class OptionalPostfixTemplateTest extends PostfixTemplateTestCase {
|
||||
public void testLong() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNotNullMethodCall() {
|
||||
myFixture.addClass("package org.jetbrains.annotations;" +
|
||||
"public @interface NotNull {}");
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDoNotExpandOnJavaLess8() {
|
||||
IdeaTestUtil.setModuleLanguageLevel(myModule, LanguageLevel.JDK_1_6, myFixture.getTestRootDisposable());
|
||||
|
||||
Reference in New Issue
Block a user