Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods does not respect @SuppressWarnings("all") #331

Closed
blipper opened this issue Aug 16, 2024 · 2 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@blipper
Copy link
Contributor

blipper commented Aug 16, 2024

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

@SuppressWarnings("all")
class A {
    private void foo() {
    }
}

What did you expect to see?

@SuppressWarnings("all")
class A {
    private void foo() {
    }
}

What did you see instead?

@SuppressWarnings("all")
class A {
}

Needs to check for both unused and all.

private boolean unusedWarningsSuppressed(J classDeclaration) {
for (J.Annotation annotation : FindAnnotations.find(classDeclaration, "java.lang.SuppressWarnings")) {
List<Expression> arguments = annotation.getArguments();
if (arguments != null) {
for (Expression argument : arguments) {
if (J.Literal.isLiteralValue(argument, "unused")) {
return true;
}
}
}
}
return false;
}

@blipper blipper added the bug Something isn't working label Aug 16, 2024
@timtebeek timtebeek moved this to Backlog in OpenRewrite Aug 17, 2024
@timtebeek timtebeek added the good first issue Good for newcomers label Aug 17, 2024
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenRewrite Aug 17, 2024
@timtebeek timtebeek self-assigned this Aug 17, 2024
@timtebeek
Copy link
Contributor

Thanks @blipper ; know that you're always welcome to immediately open a PR; no need to open an issue first. :)

@blipper
Copy link
Contributor Author

blipper commented Aug 17, 2024

Yeah. I have a backlog of bugs that I suggested to help out to get to but need to spin up github integrated. Amazon doesn't use git and build system is different so it takes some work to get setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
Archived in project
Development

No branches or pull requests

2 participants