mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
19 lines
497 B
Plaintext
19 lines
497 B
Plaintext
/**
|
|
* @id java/examples/switchcase
|
|
* @name Switch statement case missing
|
|
* @description Finds switch statements with a missing enum constant case and no default case
|
|
* @tags switch
|
|
* case
|
|
* enum
|
|
*/
|
|
|
|
import java
|
|
|
|
from SwitchStmt switch, EnumType enum, EnumConstant missing
|
|
where
|
|
switch.getExpr().getType() = enum and
|
|
missing.getDeclaringType() = enum and
|
|
not switch.getAConstCase().getValue() = missing.getAnAccess() and
|
|
not exists(switch.getDefaultCase())
|
|
select switch
|