mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
[java-completion] Allow .opt template in non-top expressions
IDEA-193857 Postfix completion doesn't show up in return expression GitOrigin-RevId: 64dc758c7741d05457ef55c0ee425b053544dab5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4cbcab092b
commit
ba9a625d7f
@@ -22,7 +22,7 @@ public class OptionalPostfixTemplate extends JavaEditablePostfixTemplate {
|
||||
"java.util.$OPTIONAL_CLASS$.$OPTIONAL_METHOD$($EXPR$)",
|
||||
"Optional.ofNullable(expr)",
|
||||
Collections.singleton(new JavaPostfixTemplateExpressionCondition.JavaPostfixTemplateNonVoidExpressionCondition()),
|
||||
LanguageLevel.JDK_1_8, true, provider);
|
||||
LanguageLevel.JDK_1_8, false, provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.util.Optional;
|
||||
|
||||
class Demo {
|
||||
Optional<String> test(String s) {
|
||||
return s.opt<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.util.Optional;
|
||||
|
||||
class Demo {
|
||||
Optional<String> test(String s) {
|
||||
return java.util.Optional.ofNullable(s)<caret>
|
||||
}
|
||||
}
|
||||
@@ -83,6 +83,10 @@ public class OptionalPostfixTemplateTest extends PostfixTemplateTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInReturn() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNotNullMethodCall() {
|
||||
myFixture.addClass("package org.jetbrains.annotations;" +
|
||||
"public @interface NotNull {}");
|
||||
|
||||
Reference in New Issue
Block a user