mirror of
https://github.com/github/codeql.git
synced 2025-12-21 11:16:30 +01:00
Model isNotEmpty from Apache Commons Collections
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
import java
|
import java
|
||||||
import SSA
|
import SSA
|
||||||
private import semmle.code.java.controlflow.internal.GuardsLogic
|
private import semmle.code.java.controlflow.internal.GuardsLogic
|
||||||
|
private import semmle.code.java.frameworks.apache.Collections
|
||||||
private import RangeUtils
|
private import RangeUtils
|
||||||
private import IntegerGuards
|
private import IntegerGuards
|
||||||
|
|
||||||
@@ -144,11 +145,7 @@ predicate nullCheckMethod(Method m, boolean branch, boolean isnull) {
|
|||||||
branch = false and
|
branch = false and
|
||||||
isnull = false
|
isnull = false
|
||||||
or
|
or
|
||||||
(
|
m instanceof MethodApacheCollectionsIsNotEmpty and
|
||||||
m.getDeclaringType().hasQualifiedName("org.apache.commons.collections4", "CollectionUtils") or
|
|
||||||
m.getDeclaringType().hasQualifiedName("org.apache.commons.collections", "CollectionUtils")
|
|
||||||
) and
|
|
||||||
m.hasName("isNotEmpty") and
|
|
||||||
branch = true and
|
branch = true and
|
||||||
isnull = false
|
isnull = false
|
||||||
or
|
or
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/** Definitions related to the Apache Commons Collections library. */
|
||||||
|
|
||||||
|
import java
|
||||||
|
private import semmle.code.java.dataflow.FlowSteps
|
||||||
|
private import semmle.code.java.dataflow.ExternalFlow
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The method `isNotEmpty` in either `org.apache.commons.collections.CollectionUtils`
|
||||||
|
* or `org.apache.commons.collections4.CollectionUtils`.
|
||||||
|
*/
|
||||||
|
class MethodApacheCollectionsIsNotEmpty extends Method {
|
||||||
|
MethodApacheCollectionsIsNotEmpty() {
|
||||||
|
this.getDeclaringType()
|
||||||
|
.hasQualifiedName(["org.apache.commons.collections", "org.apache.commons.collections4"],
|
||||||
|
"CollectionUtils") and
|
||||||
|
this.hasName("isNotEmpty")
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user