Skip to content

Commit aca905f

Browse files
committed
Prevent class-could-be-static alerts regarding JUnit Nested tests
1 parent 0e9d36b commit aca905f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

java/ql/src/Performance/InnerClassCouldBeStatic.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ predicate potentiallyStatic(InnerClass c) {
127127
forall(InnerClass superOfNested | superOfNested = nested.getASourceSupertype+() |
128128
potentiallyStatic(superOfNested)
129129
)
130-
)
130+
) and
131+
// JUnit Nested test classes are required to be non-static.
132+
not c.hasAnnotation("org.junit.jupiter.api", "Nested")
131133
}
132134

133135
/**

0 commit comments

Comments
 (0)