mirror of
https://github.com/github/codeql.git
synced 2025-12-21 03:06:31 +01:00
Model isNotEmpty from Apache Commons Collections
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import java
|
||||
import SSA
|
||||
private import semmle.code.java.controlflow.internal.GuardsLogic
|
||||
private import semmle.code.java.frameworks.apache.Collections
|
||||
private import RangeUtils
|
||||
private import IntegerGuards
|
||||
|
||||
@@ -144,11 +145,7 @@ predicate nullCheckMethod(Method m, boolean branch, boolean isnull) {
|
||||
branch = false and
|
||||
isnull = false
|
||||
or
|
||||
(
|
||||
m.getDeclaringType().hasQualifiedName("org.apache.commons.collections4", "CollectionUtils") or
|
||||
m.getDeclaringType().hasQualifiedName("org.apache.commons.collections", "CollectionUtils")
|
||||
) and
|
||||
m.hasName("isNotEmpty") and
|
||||
m instanceof MethodApacheCollectionsIsNotEmpty and
|
||||
branch = true and
|
||||
isnull = false
|
||||
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