Skip to content

Commit

Permalink
Make Pattern and Splitter static fields
Browse files Browse the repository at this point in the history
Make Pattern and Splitter static fields so that they do not need to created every time a new DiagnosticConverter is injected.
  • Loading branch information
rubenporras authored and szarnekow committed Mar 5, 2024
1 parent 652e4b0 commit 5f8a28c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ protected Severity getSeverity(Diagnostic diagnostic) {
}

// group 1 matches the suffix in an issue code e.g. someCode from org.eclipse.xtext.Xtext.someCode
private final Pattern afterLastDot = Pattern.compile(".*\\W(\\w+)$");
private static final Pattern afterLastDot = Pattern.compile(".*\\W(\\w+)$");
// group 1 matches the codes given in SuppressWarnings[code1, code2], e.g. "code1, code2" is returned
private final Pattern suppressWarnings = Pattern.compile("SuppressWarnings\\[([^]]*)\\]", Pattern.CASE_INSENSITIVE);
private final Splitter splitter = Splitter.on(',').trimResults().omitEmptyStrings();
private static final Pattern suppressWarnings = Pattern.compile("SuppressWarnings\\[([^]]*)\\]", Pattern.CASE_INSENSITIVE);
private static final Splitter splitter = Splitter.on(',').trimResults().omitEmptyStrings();
private static final String ALL = "all";

protected boolean isMarkedAsIgnored(EObject object, String code) {
Expand Down

0 comments on commit 5f8a28c

Please sign in to comment.