mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed EA-96417 - IOE: PsiJavaParserFacadeImpl.createExpressionFromText
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -378,6 +378,7 @@ public class OptionalIsPresentInspection extends BaseJavaBatchLocalInspectionToo
|
||||
@Override
|
||||
public ProblemType getProblemType(PsiVariable optionalVariable, PsiElement trueElement, PsiElement falseElement) {
|
||||
if (falseElement != null && !(falseElement instanceof PsiEmptyStatement)) return ProblemType.NONE;
|
||||
if (!(trueElement instanceof PsiStatement)) return ProblemType.NONE;
|
||||
if (trueElement instanceof PsiExpressionStatement) {
|
||||
PsiExpression expression = ((PsiExpressionStatement)trueElement).getExpression();
|
||||
if(isOptionalGetCall(expression, optionalVariable)) return ProblemType.NONE;
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace Optional.isPresent() condition with functional style expression" "false"
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class Main {
|
||||
public void test(Optional<String> opt) {
|
||||
System.out.println(opt.<caret>isPresent() ? opt.get():);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user