Skip to content

Commit

Permalink
Suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
rickie committed May 2, 2024
1 parent 72a6871 commit a5995c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package tech.picnic.errorprone.bugpatterns;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import static com.google.errorprone.BugPattern.LinkType.CUSTOM;
import static com.google.errorprone.BugPattern.SeverityLevel.WARNING;
import static com.google.errorprone.BugPattern.StandardTags.STYLE;
Expand Down Expand Up @@ -114,7 +114,7 @@ private static void updateGetLoggerArgument(
matcher = CLASS_ARGUMENT_PATTERN.matcher(argumentName);
}

checkArgument(matcher.matches(), "Invalid argument name.");
checkState(matcher.matches());

Check warning on line 117 in error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/Slf4jLogDeclaration.java

View workflow job for this annotation

GitHub Actions / pitest

A change can be made to line 117 without causing a test to fail

removed call to com/google/common/base/Preconditions::checkState (covered by 3 tests VoidMethodCallMutator)
String argumentClassName = matcher.group(1);
if (!className.contentEquals(argumentClassName)) {
fixBuilder.merge(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ void identification() {
"",
" private static final Logger LOG = LoggerFactory.getLogger(A.class);",
"",
" // BUG: Diagnostic contains:",
" private static final Logger foo = LoggerFactory.getLogger(A.class);",
"",
" static class OverloadedGetLogger {",
" private static final Logger LOG = LoggerFactory.getLogger(\"OverloadedGetLogger\");",
" }",
"",
" interface InterfaceWithNoCanonicalModifiers {",
" Logger LOG = LoggerFactory.getLogger(InterfaceWithNoCanonicalModifiers.class);",
" }",
"",
" // BUG: Diagnostic contains:",
" private static final Logger foo = LoggerFactory.getLogger(A.class);",
"",
" static class WrongOverloadedGetLogger {",
" // BUG: Diagnostic contains:",
" private static final Logger LOG = LoggerFactory.getLogger(\"OverloadedGetLogger\");",
Expand Down Expand Up @@ -62,10 +66,6 @@ void identification() {
" private static final Logger LOG = LoggerFactory.getLogger(String.class);",
" }",
"",
" interface InterfaceWithNoCanonicalModifiers {",
" Logger LOG = LoggerFactory.getLogger(InterfaceWithNoCanonicalModifiers.class);",
" }",
"",
" interface InterfaceWithWrongVariableName {",
" // BUG: Diagnostic contains:",
" Logger BAZ = LoggerFactory.getLogger(InterfaceWithWrongVariableName.class);",
Expand Down Expand Up @@ -106,7 +106,6 @@ void replacement() {
" }",
"",
" static class WrongArgumentOverloadedGetLogger {",
" // BUG: Diagnostic contains:",
" private static final Logger LOG = LoggerFactory.getLogger(\"OverloadedGetLogger\");",
" }",
"",
Expand Down Expand Up @@ -140,7 +139,6 @@ void replacement() {
" }",
"",
" static class WrongArgumentOverloadedGetLogger {",
" // BUG: Diagnostic contains:",
" private static final Logger LOG = LoggerFactory.getLogger(\"WrongArgumentOverloadedGetLogger\");",
" }",
"",
Expand Down

0 comments on commit a5995c8

Please sign in to comment.