mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-22 07:32:21 +07:00
Fixes IDEA-172844 False positive "Method invocation 'methodName' may produce NPE" in while loop condition
27 lines
645 B
Java
27 lines
645 B
Java
import org.jetbrains.annotations.*;
|
|
|
|
// IDEA-172844
|
|
abstract class SimpleClass {
|
|
|
|
@Nullable
|
|
protected MyType findSelfOrInnerByNonQualifiedName() {
|
|
MyType nearestOuter = getOwnerParentOfType(MyType.class);
|
|
if (nearestOuter != null) {
|
|
MyType currentOuter = nearestOuter;
|
|
while (currentOuter.getOuterClass() != null) { // False positive error here
|
|
currentOuter = currentOuter.getOuterClass();
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
@Nullable
|
|
abstract MyType getOwnerParentOfType(Class<MyType> apexPsiTypeDeclarationClass);
|
|
|
|
static abstract class MyType {
|
|
|
|
@Nullable
|
|
abstract MyType getOuterClass();
|
|
}
|
|
} |