Add support for the Preconditions Class in the Guava framework

This commit is contained in:
Alvaro Muñoz
2021-02-10 13:20:29 +01:00
parent 66d0bf6b5e
commit 645b021845
2 changed files with 24 additions and 0 deletions

View File

@@ -5,3 +5,4 @@
import java
import StringUtils
import Collections
import Preconditions

View File

@@ -0,0 +1,23 @@
/** Definitions of flow steps through the Preconditions class in the Guava framework. */
import java
private import semmle.code.java.dataflow.FlowSteps
/**
* The class `com.google.common.base.Preconditions`.
*/
class TypeGuavaPreconditions extends Class {
TypeGuavaPreconditions() { this.hasQualifiedName("com.google.common.base", "Preconditions") }
}
/**
* A method that returns its argumnets.
*/
private class GuavaPreconditionsMethod extends TaintPreservingCallable {
GuavaPreconditionsMethod() {
this.getDeclaringType() instanceof TypeGuavaPreconditions and
this.hasName("checkNotNull")
}
override predicate returnsTaintFrom(int src) { src = 0 }
}