mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
Add tests for `EnhcancedForStmt`s and `InstanceOfExpr`s. Rename LocalVarDeclParent to SingleLocalVarDeclParent
59 lines
1.0 KiB
Java
59 lines
1.0 KiB
Java
/** Another javadoc */
|
|
|
|
/**
|
|
* A class
|
|
*
|
|
* @author someone
|
|
*/
|
|
class A {
|
|
public @interface Ann1 {
|
|
String value() default "b";
|
|
Ann2[] nest() default {};
|
|
}
|
|
|
|
public @interface Ann2 {
|
|
int value() default 3;
|
|
}
|
|
|
|
/** Does something */
|
|
@Deprecated
|
|
static int doSomething(@SuppressWarnings("all") String text) {
|
|
int i=0, j=1;
|
|
|
|
for(i=0, j=1; i<3; i++) {}
|
|
|
|
for(int m=0, n=1; m<3; m++) {}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int counter = 1;
|
|
|
|
{
|
|
counter = doSomething("hi");
|
|
}
|
|
|
|
@Ann1(
|
|
value="a",
|
|
nest={
|
|
@Ann2,
|
|
@Ann2(7)
|
|
})
|
|
String doSomethingElse() { return "c"; }
|
|
|
|
void varDecls(Object[] things) {
|
|
try {
|
|
for(Object thing : things) {
|
|
if (thing instanceof Integer) {
|
|
return;
|
|
}
|
|
if (thing instanceof String s) {
|
|
throw new RuntimeException(s);
|
|
}
|
|
}
|
|
}
|
|
catch (RuntimeException rte) {
|
|
return;
|
|
}
|
|
}
|
|
} |