mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Java: Add initial version of empty method query
This commit is contained in:
@@ -0,0 +1 @@
|
||||
| Test.java:16:17:16:18 | f2 | Empty method found. |
|
||||
1
java/ql/test/query-tests/EmptyMethod/EmptyMethod.qlref
Normal file
1
java/ql/test/query-tests/EmptyMethod/EmptyMethod.qlref
Normal file
@@ -0,0 +1 @@
|
||||
Language Abuse/EmptyMethod.ql
|
||||
29
java/ql/test/query-tests/EmptyMethod/Test.java
Normal file
29
java/ql/test/query-tests/EmptyMethod/Test.java
Normal file
@@ -0,0 +1,29 @@
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
|
||||
public class Test {
|
||||
|
||||
// COMPLIANT
|
||||
public void f() {
|
||||
int i = 0;
|
||||
}
|
||||
|
||||
// COMPLIANT
|
||||
public void f1() {
|
||||
// intentionally empty
|
||||
}
|
||||
|
||||
// NON_COMPLIANT
|
||||
public void f2() {}
|
||||
|
||||
// COMPLIANT - exception
|
||||
@Pointcut()
|
||||
public void f4() {}
|
||||
|
||||
public abstract class TestInner {
|
||||
|
||||
public abstract void f(); // COMPLIANT - intentionally empty
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
1
java/ql/test/query-tests/EmptyMethod/options
Normal file
1
java/ql/test/query-tests/EmptyMethod/options
Normal file
@@ -0,0 +1 @@
|
||||
//semmle-extractor-options: --javac-args -cp ${testdir}/../../stubs/aspectj
|
||||
Reference in New Issue
Block a user