Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
2f311f58
Commit
2f311f58
authored
8 years ago
by
Tagir Valeev
1
Browse files
Options
Download
Email Patches
Plain Diff
StreamApiMigrationInspection: add guard checks for control flow offsets (EA-90493)
parent
a75cc0fe
Branches unavailable
Tags unavailable
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/java-impl/src/com/intellij/codeInspection/streamMigration/StreamApiMigrationInspection.java
+7
-4
...pection/streamMigration/StreamApiMigrationInspection.java
with
7 additions
and
4 deletions
+7
-4
java/java-impl/src/com/intellij/codeInspection/streamMigration/StreamApiMigrationInspection.java
+
7
-
4
View file @
2f311f58
...
...
@@ -585,12 +585,15 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
catch
(
AnalysisCanceledException
ignored
)
{
return
;
}
int
startOffset
=
tb
.
getStartOffset
(
controlFlow
);
int
endOffset
=
tb
.
getEndOffset
(
controlFlow
);
if
(
startOffset
<
0
||
endOffset
<
0
)
return
;
final
Collection
<
PsiStatement
>
exitPoints
=
ControlFlowUtil
.
findExitPointsAndStatements
(
controlFlow
,
tb
.
getStartOffset
(
controlFlow
),
tb
.
getEndOffset
(
controlFlow
),
new
IntArrayList
(),
PsiContinueStatement
.
class
,
.
findExitPointsAndStatements
(
controlFlow
,
startOffset
,
endOffset
,
new
IntArrayList
(),
PsiContinueStatement
.
class
,
PsiBreakStatement
.
class
,
PsiReturnStatement
.
class
,
PsiThrowStatement
.
class
);
int
startOffset
=
controlFlow
.
getStartOffset
(
body
);
int
endOffset
=
controlFlow
.
getEndOffset
(
body
);
startOffset
=
controlFlow
.
getStartOffset
(
body
);
endOffset
=
controlFlow
.
getEndOffset
(
body
);
if
(
startOffset
<
0
||
endOffset
<
0
)
return
;
PsiElement
surrounder
=
PsiTreeUtil
.
getParentOfType
(
statement
,
PsiLambdaExpression
.
class
,
PsiClass
.
class
);
final
List
<
PsiVariable
>
nonFinalVariables
=
StreamEx
.
of
(
ControlFlowUtil
.
getUsedVariables
(
controlFlow
,
startOffset
,
endOffset
))
.
remove
(
variable
->
PsiTreeUtil
.
getParentOfType
(
variable
,
PsiLambdaExpression
.
class
,
PsiClass
.
class
)
!=
surrounder
)
...
...
This diff is collapsed.
Click to expand it.
小 白蛋
@baidan
mentioned in commit
6fc24417
·
2 years ago
mentioned in commit
6fc24417
mentioned in commit 6fc2441735a055f38c01142c651f2a40b6f5e246
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help