File tree Expand file tree Collapse file tree 3 files changed +10
-47
lines changed
java/ql/test/query-tests/EmptyMethod Expand file tree Collapse file tree 3 files changed +10
-47
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ public void f2() { } // $ Alert
20
20
public void f4 () {
21
21
}
22
22
23
+ /**
24
+ * COMPLIANT - empty method with javadoc
25
+ */
26
+ public void f5 () {
27
+ }
28
+
23
29
public abstract class TestInner {
24
30
25
31
public abstract void f (); // COMPLIANT - intentionally empty
@@ -41,6 +47,8 @@ public interface TestInterface {
41
47
42
48
// NON_COMPLIANT
43
49
default void method () { } // $ Alert
50
+
51
+ void method2 (); // COMPLIANT
44
52
}
45
53
46
54
}
Original file line number Diff line number Diff line change 1
- #select
2
1
| 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. |
Original file line number Diff line number Diff line change 1
- import org .aspectj .lang .annotation .Pointcut ;
2
-
3
1
public class Test {
4
-
5
- // COMPLIANT
2
+ // COMPLIANT: allow empty method in test class
6
3
public void f () {
7
- int i = 0 ;
8
4
}
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
-
46
5
}
You can’t perform that action at this time.
0 commit comments