mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SimpleMethodInliner: support lambdas/method refs/casts/array accesses
This commit is contained in:
+3
-1
@@ -48,7 +48,9 @@ public class SimpleMethodInliner implements CallInliner {
|
||||
boolean allowed = PsiTreeUtil.processElements(value, e -> {
|
||||
if (!(e instanceof PsiExpression)) return true;
|
||||
if (e instanceof PsiInstanceOfExpression || e instanceof PsiParenthesizedExpression || e instanceof PsiLiteralExpression ||
|
||||
e instanceof PsiPolyadicExpression || e instanceof PsiUnaryExpression || e instanceof PsiConditionalExpression) {
|
||||
e instanceof PsiPolyadicExpression || e instanceof PsiUnaryExpression || e instanceof PsiConditionalExpression ||
|
||||
e instanceof PsiTypeCastExpression || e instanceof PsiArrayAccessExpression || e instanceof PsiLambdaExpression ||
|
||||
e instanceof PsiMethodReferenceExpression) {
|
||||
return true;
|
||||
}
|
||||
if (e instanceof PsiReferenceExpression) {
|
||||
|
||||
@@ -32,4 +32,24 @@ class Scratch {
|
||||
private boolean hasData() {
|
||||
return data != null && data.length > 0;
|
||||
}
|
||||
|
||||
int[] array;
|
||||
|
||||
private int readValue() {
|
||||
return array[0];
|
||||
}
|
||||
|
||||
void testArraySize() {
|
||||
if(readValue() > 0 && <warning descr="Condition 'array.length > 0' is always 'true' when reached">array.length > 0</warning>) {}
|
||||
}
|
||||
|
||||
Object element;
|
||||
|
||||
private String getString() {
|
||||
return ((String)element);
|
||||
}
|
||||
|
||||
void testGetString() {
|
||||
if(!getString().isEmpty() && <warning descr="Condition 'element instanceof String' is always 'true' when reached">element instanceof String</warning>) {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user