Skip to content

Catch clauses should (maybe) not be enclosed by their try stmt #3709

@intrigus-lgtm

Description

@intrigus-lgtm

Description of the issue
CodeQL models CatchClauses as being part of TryStmts.
I personally find this counter-intuitive since the {} braces of the try {} block do not enclose the catch() {}in any way.

try {
} catch() {
}

Here catch(){} would be enclosed by try {}

import java

from CatchClause c, TryStmt try
where c.getEnclosingStmt() = try
select c, try

Link to query:
https://lgtm.com/query/2349457352250693633/

Metadata

Metadata

Assignees

No one assigned

    Labels

    JavaquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions