Skip to content

Commit b207ce1

Browse files
Jami CogswellJami Cogswell
Jami Cogswell
authored and
Jami Cogswell
committed
Java: remove mention of abstract classes from qhelp
1 parent 328a56c commit b207ce1

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

java/ql/src/Likely Bugs/Frameworks/JUnit/JUnit5MissingNestedAnnotation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class IntegerOperationTest {
3737

3838
## Implementation Notes
3939

40-
This rule is focused on missing `@Nested` annotations on non-static nested (inner) test classes. Static nested test classes and abstract nested test classes should not be annotated with `@Nested`. As a result, the absence of a `@Nested` annotation on such classes is compliant. Identifying incorrect application of a `@Nested` annotation to static and abstract classes is out of scope for this rule.
40+
This rule is focused on missing `@Nested` annotations on non-static nested (inner) test classes. Static nested test classes should not be annotated with `@Nested`. As a result, the absence of a `@Nested` annotation on such classes is compliant. Identifying incorrect application of a `@Nested` annotation to static nested classes is out of scope for this rule.
4141

4242
## References
4343

java/ql/test/query-tests/Likely Bugs/Frameworks/JUnit/AnnotationTest.java

+4-13
Original file line numberDiff line numberDiff line change
@@ -87,29 +87,20 @@ public void test() {
8787
}
8888
}
8989

90-
// COMPLIANT: Invalid to use `@Nested` on an abstract class, but
91-
// this matter is out of scope (see QHelp Implementation Notes)
92-
@Nested
93-
public abstract class Test8 {
94-
@Test
95-
public void test() {
96-
}
97-
}
98-
99-
interface Test9 {
90+
interface Test8 {
10091
}
10192

10293
public void f() {
10394
// COMPLIANT: anonymous classes are not considered as inner test
10495
// classes by JUnit and therefore don't need `@Nested`
105-
new Test9() {
96+
new Test8() {
10697
@Test
10798
public void test() {
10899
}
109100
};
110101
// COMPLIANT: local classes are not considered as inner test
111102
// classes by JUnit and therefore don't need `@Nested`
112-
class Test10 {
103+
class Test9 {
113104
@Test
114105
void test() {
115106
}
@@ -118,7 +109,7 @@ void test() {
118109

119110
// COMPLIANT: private classes are not considered as inner test
120111
// classes by JUnit and therefore don't need `@Nested`
121-
private class Test11 {
112+
private class Test10 {
122113
@Test
123114
public void test() {
124115
}

0 commit comments

Comments
 (0)