77836b
--- sun/tools/javazic/Mappings.java.orig	2015-04-13 12:44:10.000000000 -0400
77836b
+++ sun/tools/javazic/Mappings.java	2015-04-13 12:45:28.000000000 -0400
77836b
@@ -1,5 +1,5 @@
77836b
 /*
77836b
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
77836b
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
77836b
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
77836b
  *
77836b
  * This code is free software; you can redistribute it and/or modify it
77836b
@@ -26,6 +26,7 @@
77836b
 package sun.tools.javazic;
77836b
 
77836b
 import	java.util.ArrayList;
77836b
+import java.util.HashMap;
77836b
 import	java.util.LinkedList;
77836b
 import	java.util.List;
77836b
 import	java.util.Map;
77836b
@@ -162,6 +163,20 @@
77836b
 	for (String key : toBeRemoved) {
77836b
 	    aliases.remove(key);
77836b
 	}
77836b
+        // Eliminate any alias-to-alias mappings. For example, if
77836b
+        // there are A->B and B->C, A->B is changed to A->C.
77836b
+        Map<String, String> newMap = new HashMap<String, String>();
77836b
+        for (String key : aliases.keySet()) {
77836b
+            String realid = aliases.get(key);
77836b
+            String leaf = realid;
77836b
+            while (aliases.get(leaf) != null) {
77836b
+                leaf = aliases.get(leaf);
77836b
+            }
77836b
+            if (!realid.equals(leaf)) {
77836b
+                newMap.put(key, leaf);
77836b
+            }
77836b
+        }
77836b
+        aliases.putAll(newMap);
77836b
     }
77836b
 
77836b
     Map<String,String> getAliases() {