File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
java/ql/lib/semmle/code/java/dataflow Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ private import NullGuards
1717private import semmle.code.java.Collections
1818private import semmle.code.java.controlflow.internal.Preconditions
1919private import semmle.code.java.controlflow.ControlFlowReachability
20+ private import codeql.controlflow.SuccessorType
2021
2122/** Gets an expression that may be `null`. */
2223Expr nullExpr ( ) { result = nullExpr ( _) }
@@ -230,14 +231,8 @@ private Expr nonEmptyExpr() {
230231
231232/** The control flow edge that exits an enhanced for loop if the `Iterable` is empty. */
232233private predicate enhancedForEarlyExit ( EnhancedForStmt for , ControlFlowNode n1 , ControlFlowNode n2 ) {
233- exists ( Expr forExpr |
234- n1 .getANormalSuccessor ( ) = n2 and
235- for .getExpr ( ) = forExpr and
236- forExpr .getAChildExpr * ( ) = n1 .asExpr ( ) and
237- not forExpr .getAChildExpr * ( ) = n2 .asExpr ( ) and
238- n1 .getANormalSuccessor ( ) .asExpr ( ) = for .getVariable ( ) and
239- not n2 .asExpr ( ) = for .getVariable ( )
240- )
234+ n1 .getASuccessor ( any ( EmptinessSuccessor t | t .isEmpty ( ) ) ) = n2 and
235+ for .getExpr ( ) .getControlFlowNode ( ) = n1
241236}
242237
243238/** A control flow edge that cannot be taken. */
You can’t perform that action at this time.
0 commit comments