Skip to content

Commit

Permalink
Skip the exception parameters in catch block during unused checker
Browse files Browse the repository at this point in the history
  • Loading branch information
testforstephen committed Aug 30, 2024
1 parent 6b671dd commit c6f9955
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import java.util.Map;
import java.util.Set;

import javax.lang.model.element.ElementKind;

import org.eclipse.jdt.core.compiler.CategorizedProblem;

import com.sun.source.tree.ClassTree;
Expand Down Expand Up @@ -166,6 +168,10 @@ private boolean isPrivateDeclaration(Tree tree) {
if (owner instanceof ClassSymbol) {
return !isSerialVersionConstant(variable) && (variable.getModifiers().flags & Flags.PRIVATE) != 0;
} else if (owner instanceof MethodSymbol) {
if (variable.sym.getKind() == ElementKind.EXCEPTION_PARAMETER) {
return false;
}

return true;
}
}
Expand Down

0 comments on commit c6f9955

Please sign in to comment.