mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
Java: Add test case for capturing type based summaries.
This commit is contained in:
@@ -199,6 +199,7 @@ class TypeBasedFlowTargetApi extends Specific::TargetApiSpecific {
|
||||
TypeBasedFlowTargetApi() { Specific::isRelevantForTypeBasedFlowModels(this) }
|
||||
|
||||
/**
|
||||
* TODO: Update with Java examples instead.
|
||||
* Gets the string representation of all type based summaries for `this`
|
||||
* inspired by the Theorems for Free approach.
|
||||
*
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
utils/model-generator/CaptureTypeBasedSummaryModels.ql
|
||||
@@ -0,0 +1,23 @@
|
||||
package p;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TypeBasedCollection<T> extends ArrayList<T> {
|
||||
|
||||
public void addT(T x) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public void addManyT(List<T> xs) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public T firstT() {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public List<T> getManyT() {
|
||||
throw null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package p;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class TypeBasedComplex<T> {
|
||||
|
||||
public void addMany(List<T> xs) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public List<T> getMany() {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public Integer apply(Function<T, Integer> f) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public <T1, T2> T2 apply2(T1 x, Function<T1, T2> f) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public TypeBasedComplex<T> flatMap(Function<T, List<T>> f) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public <S> TypeBasedComplex<S> flatMap2(Function<T, List<S>> f) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public <S> S map(Function<T, S> f) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public <S> TypeBasedComplex<S> mapComplex(Function<T, S> f) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public TypeBasedComplex<T> returnComplex(Function<T, TypeBasedComplex<T>> f) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public void set(Integer x, Function<Integer, T> f) {
|
||||
throw null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package p;
|
||||
|
||||
public class TypeBasedSimple<T> {
|
||||
public TypeBasedSimple(T t) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public T get() {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public T get(Object o) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public T id(T x) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public <S> S id2(S x) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public void set(T x) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public void set(int x, T y) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
public <S> void set2(S x) { // No summary as S is unrelated to T
|
||||
throw null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user