Java: move a few tests

This commit is contained in:
yh-semmle
2018-11-01 20:29:46 -04:00
parent 8b866ade0e
commit f3fbc8a153
29 changed files with 0 additions and 295 deletions

View File

@@ -1,6 +0,0 @@
| 3 | 1 | annotations/C.java:3:1:3:61 | Pair | 1 |
| 3 | 14 | annotations/C.java:3:14:3:31 | Ann | 1 |
| 3 | 42 | annotations/C.java:3:42:3:60 | Ann | 1 |
| 4 | 1 | annotations/C.java:4:1:4:68 | Container | 1 |
| 4 | 25 | annotations/C.java:4:25:4:46 | Ann | 1 |
| 4 | 49 | annotations/C.java:4:49:4:65 | Ann | 1 |

View File

@@ -1,15 +0,0 @@
/**
* @name Annotations
* @description Check that annotation ids are distinct
*/
import default
private int numberOfLocations(Annotation a) { result = count(a.getLocation()) }
from Annotation a, RefType c, Location loc
where
c.hasQualifiedName("annotations", "C") and
c.getAnAnnotation() = a.getParent*() and
loc = a.getLocation()
select loc.getStartLine(), loc.getStartColumn(), a, numberOfLocations(a)

View File

@@ -1,43 +0,0 @@
| annotations/A.java:4:14:4:14 | A | key | annotations/A.java:3:10:3:16 | "value" |
| annotations/A.java:4:14:4:14 | A | unused1 | annotations/A.class:0:0:0:0 | {...} |
| annotations/A.java:4:14:4:14 | A | unused2 | annotations/A.class:0:0:0:0 | {...} |
| annotations/A.java:8:7:8:9 | Sub | key | annotations/A.java:3:10:3:16 | "value" |
| annotations/A.java:8:7:8:9 | Sub | unused1 | annotations/A.class:0:0:0:0 | {...} |
| annotations/A.java:8:7:8:9 | Sub | unused2 | annotations/A.class:0:0:0:0 | {...} |
| annotations/A.java:11:11:11:11 | I | key | annotations/A.java:10:10:10:15 | "IAnn" |
| annotations/A.java:11:11:11:11 | I | unused1 | annotations/I.class:0:0:0:0 | {...} |
| annotations/A.java:11:11:11:11 | I | unused2 | annotations/I.class:0:0:0:0 | {...} |
| annotations/A.java:14:7:14:10 | Sub2 | key | annotations/A.java:3:10:3:16 | "value" |
| annotations/A.java:14:7:14:10 | Sub2 | unused1 | annotations/A.class:0:0:0:0 | {...} |
| annotations/A.java:14:7:14:10 | Sub2 | unused2 | annotations/A.class:0:0:0:0 | {...} |
| annotations/A.java:18:7:18:10 | Sub3 | key | annotations/A.java:17:10:17:18 | "Sub3Ann" |
| annotations/A.java:18:7:18:10 | Sub3 | unused1 | annotations/Sub3.class:0:0:0:0 | {...} |
| annotations/A.java:18:7:18:10 | Sub3 | unused2 | annotations/Sub3.class:0:0:0:0 | {...} |
| annotations/B.java:3:42:3:42 | B | value | annotations/B.java:3:19:3:26 | "unused" |
| annotations/C.java:3:1:3:61 | Pair | key | annotations/C.java:3:25:3:30 | "Left" |
| annotations/C.java:3:1:3:61 | Pair | key | annotations/C.java:3:53:3:59 | "Right" |
| annotations/C.java:3:1:3:61 | Pair | unused1 | annotations/C.class:0:0:0:0 | {...} |
| annotations/C.java:3:1:3:61 | Pair | unused1 | annotations/C.class:0:0:0:0 | {...} |
| annotations/C.java:3:1:3:61 | Pair | unused2 | annotations/C.class:0:0:0:0 | {...} |
| annotations/C.java:3:1:3:61 | Pair | unused2 | annotations/C.class:0:0:0:0 | {...} |
| annotations/C.java:4:23:4:67 | {...} | key | annotations/C.java:4:36:4:45 | "On" + "e" |
| annotations/C.java:4:23:4:67 | {...} | key | annotations/C.java:4:60:4:64 | "Two" |
| annotations/C.java:4:23:4:67 | {...} | unused1 | annotations/C.class:0:0:0:0 | {...} |
| annotations/C.java:4:23:4:67 | {...} | unused1 | annotations/C.class:0:0:0:0 | {...} |
| annotations/C.java:4:23:4:67 | {...} | unused2 | annotations/C.class:0:0:0:0 | {...} |
| annotations/C.java:4:23:4:67 | {...} | unused2 | annotations/C.class:0:0:0:0 | {...} |
| annotations/C.java:5:14:5:14 | C | children | annotations/C.java:4:23:4:67 | {...} |
| annotations/C.java:5:14:5:14 | C | left | annotations/C.java:3:14:3:31 | Ann |
| annotations/C.java:5:14:5:14 | C | right | annotations/C.java:3:42:3:60 | Ann |
| annotations/FieldAnnotations.java:4:35:4:43 | listField | key | annotations/FieldAnnotations.java:4:11:4:17 | "value" |
| annotations/FieldAnnotations.java:4:35:4:43 | listField | unused1 | annotations/FieldAnnotations.class:0:0:0:0 | {...} |
| annotations/FieldAnnotations.java:4:35:4:43 | listField | unused2 | annotations/FieldAnnotations.class:0:0:0:0 | {...} |
| annotations/LocalVarAnnotations.java:5:3:5:41 | int unusedLocal | key | annotations/LocalVarAnnotations.java:5:12:5:18 | "value" |
| annotations/LocalVarAnnotations.java:5:3:5:41 | int unusedLocal | unused1 | annotations/LocalVarAnnotations.class:0:0:0:0 | {...} |
| annotations/LocalVarAnnotations.java:5:3:5:41 | int unusedLocal | unused2 | annotations/LocalVarAnnotations.class:0:0:0:0 | {...} |
| annotations/ParameterAnnotations.java:6:11:6:46 | listParameter | key | annotations/ParameterAnnotations.java:6:20:6:26 | "value" |
| annotations/ParameterAnnotations.java:6:11:6:46 | listParameter | unused1 | annotations/ParameterAnnotations.class:0:0:0:0 | {...} |
| annotations/ParameterAnnotations.java:6:11:6:46 | listParameter | unused2 | annotations/ParameterAnnotations.class:0:0:0:0 | {...} |
| annotations/SuppressWarningsExample.java:7:14:7:14 | g | value | annotations/SuppressWarningsExample.java:6:20:6:34 | {...} |
| annotations/SuppressWarningsExample.java:12:14:12:14 | h | value | annotations/SuppressWarningsExample.java:11:20:11:32 | "deprecation" |
| annotations/SuppressWarningsExample.java:17:14:17:14 | k | value | annotations/SuppressWarningsExample.java:16:20:16:46 | {...} |

View File

@@ -1,9 +0,0 @@
/**
* @name GetAnnotationValue
*/
import default
from Annotatable a, string key
where a.fromSource()
select a, key, a.getAnAnnotation().getValue(key)

View File

@@ -1,16 +0,0 @@
| annotations/A.java:4:14:4:14 | A | annotations/A.java:3:1:3:17 | Ann | annotations.Ann | key |
| annotations/A.java:4:14:4:14 | A | annotations/A.java:3:1:3:17 | Ann | annotations.Ann | unused1 |
| annotations/A.java:4:14:4:14 | A | annotations/A.java:3:1:3:17 | Ann | annotations.Ann | unused2 |
| annotations/A.java:8:7:8:9 | Sub | annotations/A.java:3:1:3:17 | Ann | annotations.Ann | key |
| annotations/A.java:8:7:8:9 | Sub | annotations/A.java:3:1:3:17 | Ann | annotations.Ann | unused1 |
| annotations/A.java:8:7:8:9 | Sub | annotations/A.java:3:1:3:17 | Ann | annotations.Ann | unused2 |
| annotations/A.java:14:7:14:10 | Sub2 | annotations/A.java:3:1:3:17 | Ann | annotations.Ann | key |
| annotations/A.java:14:7:14:10 | Sub2 | annotations/A.java:3:1:3:17 | Ann | annotations.Ann | unused1 |
| annotations/A.java:14:7:14:10 | Sub2 | annotations/A.java:3:1:3:17 | Ann | annotations.Ann | unused2 |
| annotations/A.java:18:7:18:10 | Sub3 | annotations/A.java:17:1:17:19 | Ann | annotations.Ann | key |
| annotations/A.java:18:7:18:10 | Sub3 | annotations/A.java:17:1:17:19 | Ann | annotations.Ann | unused1 |
| annotations/A.java:18:7:18:10 | Sub3 | annotations/A.java:17:1:17:19 | Ann | annotations.Ann | unused2 |
| annotations/B.java:3:42:3:42 | B | annotations/B.java:3:1:3:27 | SuppressWarnings | java.lang.SuppressWarnings | value |
| annotations/C.java:5:14:5:14 | C | annotations/C.java:3:1:3:61 | Pair | annotations.Pair | left |
| annotations/C.java:5:14:5:14 | C | annotations/C.java:3:1:3:61 | Pair | annotations.Pair | right |
| annotations/C.java:5:14:5:14 | C | annotations/C.java:4:1:4:68 | Container | annotations.Container | children |

View File

@@ -1,13 +0,0 @@
/**
* @name GetLibraryAnnotationElement
*/
import default
from Class cl, Annotation ann, AnnotationType anntp, AnnotationElement anne
where
cl.fromSource() and
ann = cl.getAnAnnotation() and
anntp = ann.getType() and
anne = anntp.getAnAnnotationElement()
select cl, ann, anntp.getQualifiedName(), anne.getName()

View File

@@ -1,5 +0,0 @@
| annotations/B.java:3:1:3:27 | SuppressWarnings | "unused" |
| annotations/SuppressWarningsExample.java:6:2:6:35 | SuppressWarnings | "deprecation" |
| annotations/SuppressWarningsExample.java:11:2:11:33 | SuppressWarnings | "deprecation" |
| annotations/SuppressWarningsExample.java:16:2:16:47 | SuppressWarnings | "deprecation" |
| annotations/SuppressWarningsExample.java:16:2:16:47 | SuppressWarnings | "rawtypes" |

View File

@@ -1,4 +0,0 @@
import semmle.code.java.JDKAnnotations
from SuppressWarningsAnnotation swa
select swa, swa.getASuppressedWarning()

View File

@@ -1,18 +0,0 @@
package annotations;
@Ann(key="value")
public class A {
}
// Sub inherits the Ann annotation from A
class Sub extends A {}
@Ann(key="IAnn")
interface I {}
// Sub2 inherits the Ann annotation from A, but not from I
class Sub2 extends Sub implements I {}
// Sub3 does not inherit any Ann annotations since it has its own
@Ann(key="Sub3Ann")
class Sub3 extends Sub2 {}

View File

@@ -1,10 +0,0 @@
package annotations;
import java.lang.annotation.Inherited;
@Inherited
public @interface Ann {
String key();
String[] unused1() default {};
String[] unused2() default {};
}

View File

@@ -1,4 +0,0 @@
package annotations;
@SuppressWarnings("unused") public class B {
}

View File

@@ -1,5 +0,0 @@
package annotations;
@Pair(left = @Ann(key = "Left"), right = @Ann(key = "Right"))
@Container(children = { @Ann(key = "On" + "e"), @Ann(key = "Two") })
public class C { }

View File

@@ -1,5 +0,0 @@
package annotations;
public @interface Container {
Ann[] children();
}

View File

@@ -1,5 +0,0 @@
package annotations;
public class FieldAnnotations {
@Ann(key="value") java.util.List listField;
}

View File

@@ -1,7 +0,0 @@
package annotations;
public class LocalVarAnnotations {
{
@Ann(key="value") int unusedLocal = 23;
}
}

View File

@@ -1,6 +0,0 @@
package annotations;
public @interface Pair {
Ann left();
Ann right();
}

View File

@@ -1,7 +0,0 @@
package annotations;
import java.util.List;
public class ParameterAnnotations {
void foo(@Ann(key="value") List listParameter) {}
}

View File

@@ -1,20 +0,0 @@
package annotations;
public class SuppressWarningsExample {
@Deprecated void f() {}
@SuppressWarnings({"deprecation"})
public void g() {
f();
}
@SuppressWarnings("deprecation")
public void h() {
f();
}
@SuppressWarnings({"deprecation", "rawtypes"})
public void k(java.util.List l) {
f();
}
}