Skip to content

Commit 9bdec21

Browse files
committed
Clean test files and add new test cases
1 parent 246c827 commit 9bdec21

File tree

3 files changed

+10
-47
lines changed

3 files changed

+10
-47
lines changed

java/ql/test/query-tests/EmptyMethod/Class1.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ public void f2() { } // $ Alert
2020
public void f4() {
2121
}
2222

23+
/**
24+
* COMPLIANT - empty method with javadoc
25+
*/
26+
public void f5() {
27+
}
28+
2329
public abstract class TestInner {
2430

2531
public abstract void f(); // COMPLIANT - intentionally empty
@@ -41,6 +47,8 @@ public interface TestInterface {
4147

4248
// NON_COMPLIANT
4349
default void method() { } // $ Alert
50+
51+
void method2(); // COMPLIANT
4452
}
4553

4654
}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
#select
21
| Class1.java:16:15:16:16 | f2 | Empty method found. |
3-
| Class1.java:43:18:43:23 | method | Empty method found. |
4-
| Test.java:43:18:43:23 | method | Empty method found. |
5-
testFailures
6-
| Test.java:16:24:16:33 | // $ Alert | Missing result: Alert |
2+
| Class1.java:49:18:49:23 | method | Empty method found. |
Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,5 @@
1-
import org.aspectj.lang.annotation.Pointcut;
2-
31
public class Test {
4-
5-
// COMPLIANT
2+
// COMPLIANT: allow empty method in test class
63
public void f() {
7-
int i = 0;
84
}
9-
10-
// COMPLIANT
11-
public void f1() {
12-
// intentionally empty
13-
}
14-
15-
// NON_COMPLIANT
16-
public void f2() { } // $ Alert
17-
18-
// COMPLIANT - exception
19-
@Pointcut()
20-
public void f4() {
21-
}
22-
23-
public abstract class TestInner {
24-
25-
public abstract void f(); // COMPLIANT - intentionally empty
26-
27-
}
28-
29-
public class Derived extends TestInner {
30-
31-
// COMPLIANT: with annotation
32-
@Override
33-
public void f() {
34-
}
35-
36-
// COMPLIANT: native
37-
public native int nativeMethod();
38-
}
39-
40-
public interface TestInterface {
41-
42-
// NON_COMPLIANT
43-
default void method() { } // $ Alert
44-
}
45-
465
}

0 commit comments

Comments
 (0)