github / github/codeql

Java: Add common base class for SwitchStmt and SwitchExpr

Open
#3,642 0 comments 0 reactions 0 assignees View on GitHub
Java question
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
141

Description

**Description of the issue**
Would it be possible to add a common base class for SwitchStmt and SwitchExpr?
Currently both classes define common predicates and it is often useful to find out whether a switch covers certain values, regardless of whether it is a statement or an expression.
Common predicates:
- `getACase`
- `getAConstCase`
- `getAStmt`
- `getDefaultCase`
- `getExpr`
- `getStmt`

Some built-in QL types and queries would likely profit from this as well (though classes like `ConstSwitchStmt` would have to be redesigned to extend from this new class?).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.