diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/CommentSuppressor.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/CommentSuppressor.java index 6dc76b09b..bf8613c86 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/CommentSuppressor.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/CommentSuppressor.java @@ -28,7 +28,7 @@ import com.puppycrawl.tools.checkstyle.api.FileContents; */ class CommentSuppressor implements MatchSuppressor { /** File contents to check for comments. */ - private FileContents currentContents; + private final FileContents currentContents; /** * Constructor for this suppressor. diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java b/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java index dfbdbafa5..53c145a83 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java @@ -312,7 +312,7 @@ public class SuppressionCommentFilter private final Pattern tagCheckRegexp; /** The parsed message regexp, expanded for the text of this tag. */ - private Pattern tagMessageRegexp; + private final Pattern tagMessageRegexp; /** * Constructs a tag. @@ -343,6 +343,9 @@ public class SuppressionCommentFilter expandFromCoont(text, filter.messageFormat, filter.onRegexp); tagMessageRegexp = Pattern.compile(format); } + else { + tagMessageRegexp = null; + } } else { format = @@ -356,6 +359,9 @@ public class SuppressionCommentFilter filter.offRegexp); tagMessageRegexp = Pattern.compile(format); } + else { + tagMessageRegexp = null; + } } } catch (final PatternSyntaxException e) {