SRR: avoid double brace initialization
authorBas Leijdekkers <basleijdekkers@gmail.com>
Wed, 14 Sep 2016 14:55:42 +0000 (16:55 +0200)
committerBas Leijdekkers <basleijdekkers@gmail.com>
Wed, 14 Sep 2016 15:47:02 +0000 (17:47 +0200)
platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/GlobalCompilingVisitor.java

index 7cd33e256e565db0cf8e79b1369450452943fc6b..c536fd04c423d1582bd4d116524acb6d0ddc3fc0 100644 (file)
@@ -28,13 +28,14 @@ import static com.intellij.structuralsearch.MatchOptions.MODIFIER_ANNOTATION_NAM
 public class GlobalCompilingVisitor {
   @NonNls private static final String SUBSTITUTION_PATTERN_STR = "\\b(__\\$_\\w+)\\b";
   private static final Pattern ourSubstitutionPattern = Pattern.compile(SUBSTITUTION_PATTERN_STR);
-  private static final Set<String> ourReservedWords = new HashSet<String>(Arrays.asList(MODIFIER_ANNOTATION_NAME, INSTANCE_MODIFIER_NAME)) {
-    {
-      for (StructuralSearchProfile profile : Extensions.getExtensions(StructuralSearchProfile.EP_NAME)) {
-        addAll(profile.getReservedWords());
-      }
+  private static final Set<String> ourReservedWords = new HashSet<>(Arrays.asList(MODIFIER_ANNOTATION_NAME, INSTANCE_MODIFIER_NAME));
+
+  static {
+    for (StructuralSearchProfile profile : Extensions.getExtensions(StructuralSearchProfile.EP_NAME)) {
+      ourReservedWords.addAll(profile.getReservedWords());
     }
-  };
+  }
+
   private static final Pattern ourAlternativePattern = Pattern.compile("^\\((.+)\\)$");
   @NonNls private static final String WORD_SEARCH_PATTERN_STR = ".*?\\b(.+?)\\b.*?";
   private static final Pattern ourWordSearchPattern = Pattern.compile(WORD_SEARCH_PATTERN_STR);