mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
StreamApiMigration: check for label not pointing to the statement (Fix for EA-96734 - NPE: TerminalBlock.extractOperation)
This commit is contained in:
@@ -59,7 +59,8 @@ class TerminalBlock {
|
||||
if(statements.length == 1 && statements[0] instanceof PsiBlockStatement) {
|
||||
statements = ((PsiBlockStatement)statements[0]).getCodeBlock().getStatements();
|
||||
} else if(statements.length == 1 && statements[0] instanceof PsiLabeledStatement) {
|
||||
statements = new PsiStatement[] {((PsiLabeledStatement)statements[0]).getStatement()};
|
||||
PsiStatement statement = ((PsiLabeledStatement)statements[0]).getStatement();
|
||||
statements = statement == null ? PsiStatement.EMPTY_ARRAY : new PsiStatement[] {statement};
|
||||
} else break;
|
||||
}
|
||||
myStatements = statements;
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Fix all 'Loop can be collapsed with Stream API' problems in file" "false"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
void test(List<String> list) {
|
||||
for(String l : li<caret>st) {
|
||||
TEST:
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user