ClassDefinition: fixed case where problems could contain more than one of the same DuplicateSkinStateProblem

(cherry picked from commit a47853b5b51c83bbcd0e57860896017bd6e1e503)
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinition.java b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinition.java
index 9e3f63f..85a6900 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinition.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinition.java
@@ -768,20 +768,27 @@
     {
         Set<String> states = new HashSet<String>();
 
-        // Iterate over this class and its superclasses.
-        for (IClassDefinition c : classIterable(project, true))
+        // Iterate over the superclasses first, but don't worry about duplicates
+        // yet. The superclasses will find their own duplicates!
+        for (IClassDefinition c : classIterable(project, false))
         {
             for (String state : c.getSkinStates(problems))
             {
-                if (states.contains(state))
-                {
-                    ICompilerProblem problem = new DuplicateSkinStateProblem(c, state);
-                    problems.add(problem);
-                }
-
                 states.add(state);
             }
         }
+        // Then, add the states from this class and check for duplicates that
+        // specifically come from this class
+        for (String state : getSkinStates(problems))
+        {
+            if (states.contains(state))
+            {
+                ICompilerProblem problem = new DuplicateSkinStateProblem(this, state);
+                problems.add(problem);
+            }
+
+            states.add(state);
+        }
 
         return states.toArray(new String[states.size()]);
     }