// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package com.intellij.profile.codeInspection.ui.inspectionsTree;

import java.util.Comparator;

public class InspectionsConfigTreeComparator {
  public static final Comparator<InspectionConfigTreeNode> INSTANCE =
    Comparator.<InspectionConfigTreeNode>comparingInt(n -> n instanceof InspectionConfigTreeNode.Group ? 0 : 1)
      .thenComparing(n -> getDisplayTextToSort(n.getText()), String.CASE_INSENSITIVE_ORDER);

  public static String getDisplayTextToSort(String s) {
    if (s.length() == 0) {
      return s;
    }
    while (!Character.isLetterOrDigit(s.charAt(0))) {
      s = s.substring(1);
      if (s.length() == 0) {
        return s;
      }
    }
    return s;
  }
}
@@ -200,16 +200,74 @@
 sTree;%0A%0A
+import com.intellij.openapi.util.text.NaturalComparator;%0A%0A
 import j
@@ -582,37 +582,34 @@
 )), 
-String.CASE_INSENSITIVE_ORDER
+NaturalComparator.INSTANCE
 );%0A%0A

use NaturalComparator in downstream to properly order Java 9 and Java 10