Skip to content

UnnecessaryThrows does not detect exceptions thrown by try-with-resources #728

@kthoms

Description

@kthoms

What version of OpenRewrite are you using?

I am using

  • Maven plugin v6.12.0

org.openrewrite.recipe:rewrite-static-analysis 2.16.0

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a multi module project.

<plugin>
        <groupId>org.openrewrite.maven</groupId>
        <artifactId>rewrite-maven-plugin</artifactId>
        <version>6.12.0</version>
        <configuration>
          <activeRecipes>
            <recipe>org.operaton.recipe.CodeCleanup</recipe>
          </activeRecipes>
 ...
        </configuration>
</plugin>

With rewrite.yml

type: specs.openrewrite.org/v1beta/recipe
name: org.operaton.recipe.CodeCleanup
displayName: Code cleanup
description: Automatically cleanup code and common SAST issues, e.g. remove unnecessary parentheses, simplify expressions.
recipeList:
  - org.openrewrite.staticanalysis.UnnecessaryThrows

What is the smallest, simplest way to reproduce the problem?

Image

What did you expect to see?

void customStripSpaceXSL() throws Exception {

What did you see instead?

void customStripSpaceXSL() {

Are you interested in contributing a fix to OpenRewrite?

not on this one

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions