Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj	(revision 15934)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj	(revision 15935)
@@ -702,5 +702,5 @@
                     <PLUS> { type = Selector.ChildOrParentSelectorType.SIBLING; }
                 )
-                ( ( c=condition(Context.LINK) | c=class_or_pseudoclass(Context.LINK) ) { conditions.add(c); } )*
+                ( ( c=condition(Context.LINK) | c=class_or_pseudoclass(Context.LINK) ) { if (c!= null) conditions.add(c); } )*
             |
                 <SUBSET_OR_EQUAL> { type = Selector.ChildOrParentSelectorType.SUBSET_OR_EQUAL; }
@@ -735,5 +735,5 @@
     ( base=<IDENT> | base=<STAR> )
     ( r=zoom() )?
-    ( ( c=condition(Context.PRIMITIVE) | c=class_or_pseudoclass(Context.PRIMITIVE) ) { conditions.add(c); } )*
+    ( ( c=condition(Context.PRIMITIVE) | c=class_or_pseudoclass(Context.PRIMITIVE) ) { if (c!= null) conditions.add(c); } )*
     ( sub=subpart() )?
     { return new GeneralSelector(base.image, r, conditions, sub); }
@@ -887,7 +887,14 @@
     )
     s=ident()
-    { return pseudo
-        ? ConditionFactory.createPseudoClassCondition(s, not, context)
-        : ConditionFactory.createClassCondition(s, not, context); }
+    {
+        if (pseudo && sheet != null && sheet.isRemoveAreaStylePseudoClass() && s.matches("areaStyle|area-style|area_style")) {
+            Logging.warn("Removing 'areaStyle' pseudo-class. This class is only meant for validator");
+            return null;
+        } else if (pseudo) {
+            return ConditionFactory.createPseudoClassCondition(s, not, context);
+        } else {
+            return ConditionFactory.createClassCondition(s, not, context);
+        }
+    }
 }
 
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java	(revision 15934)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java	(revision 15935)
@@ -55,7 +55,5 @@
 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyMatchType;
 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyValueCondition;
-import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.PseudoClassCondition;
 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.SimpleKeyValueCondition;
-import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.AbstractSelector;
 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.ChildOrParentSelector;
 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.GeneralSelector;
@@ -119,4 +117,6 @@
     private ZipFile zipFile;
 
+    private boolean removeAreaStylePseudoClass;
+
     /**
      * This lock prevents concurrent execution of {@link MapCSSRuleIndex#clear() } /
@@ -430,4 +430,6 @@
             multipolygonRules.clear();
             canvasRules.clear();
+            // remove "areaStyle" pseudo classes intended only for validator (causes StackOverflowError otherwise), see #16183
+            removeAreaStylePseudoClass = true;
             try (InputStream in = getSourceInputStream()) {
                 try (Reader reader = new BufferedReader(UTFInputStreamReader.create(in))) {
@@ -445,6 +447,4 @@
                         loadSettings();
                     }
-                    // remove "areaStyle" pseudo classes intended only for validator (causes StackOverflowError otherwise)
-                    removeAreaStyleClasses();
                 } finally {
                     closeSourceInputStream(in);
@@ -770,39 +770,9 @@
 
     /**
-     * Removes "areaStyle" pseudo-classes. Only needed for validator.
-     * @since 13633
-     */
-    public void removeAreaStyleClasses() {
-        for (Iterator<MapCSSRule> it = rules.iterator(); it.hasNext();) {
-            removeAreaStyleClasses(it.next().selector);
-        }
-    }
-
-    private static void removeAreaStyleClasses(Selector sel) {
-        if (sel instanceof ChildOrParentSelector) {
-            removeAreaStyleClasses((ChildOrParentSelector) sel);
-        } else if (sel instanceof AbstractSelector) {
-            removeAreaStyleClasses((AbstractSelector) sel);
-        }
-    }
-
-    private static void removeAreaStyleClasses(ChildOrParentSelector sel) {
-        removeAreaStyleClasses(sel.left);
-        removeAreaStyleClasses(sel.right);
-    }
-
-    private static void removeAreaStyleClasses(AbstractSelector sel) {
-        if (sel.conds != null) {
-            for (Iterator<Condition> it = sel.conds.iterator(); it.hasNext();) {
-                Condition c = it.next();
-                if (c instanceof PseudoClassCondition) {
-                    PseudoClassCondition cc = (PseudoClassCondition) c;
-                    if ("areaStyle".equals(cc.method.getName())) {
-                        Logging.warn("Removing 'areaStyle' pseudo-class from "+sel+". This class is only meant for validator");
-                        it.remove();
-                    }
-                }
-            }
-        }
+     * Whether to remove "areaStyle" pseudo classes. Only for use in MapCSSParser!
+     * @return whether to remove "areaStyle" pseudo classes
+     */
+    public boolean isRemoveAreaStylePseudoClass() {
+        return removeAreaStylePseudoClass;
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java	(revision 15934)
+++ trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java	(revision 15935)
@@ -648,3 +648,16 @@
         assertNotNull(getParser("|z16-15").zoom());
     }
+
+    /**
+     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/16183">Bug #16183</a>.
+     */
+    @Test
+    public void testTicket16183() {
+        MapCSSStyleSource sheet = new MapCSSStyleSource(
+                "area:closed:areaStyle ⧉ area:closed:areaStyle {throwOther: \"xxx\";}");
+        sheet.loadStyleSource();
+        final String rule = sheet.rules.get(0).toString();
+        assertTrue(rule.contains("closed"));
+        assertFalse(rule.contains("areaStyle"));
+    }
 }
