8153481: tools/jdeps/modules/GenModuleInfo.java and ModuleTest.java fails intermittently
authormchung
Thu, 19 May 2016 10:55:33 -0700
changeset 38523 e8ff97117086
parent 38522 c4fdb181cd64
child 38524 badd925c1d2f
8153481: tools/jdeps/modules/GenModuleInfo.java and ModuleTest.java fails intermittently Reviewed-by: dfuchs
langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Dependencies.java
langtools/test/ProblemList.txt
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Dependencies.java	Thu May 19 17:57:28 2016 +0100
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Dependencies.java	Thu May 19 10:55:33 2016 -0700
@@ -33,6 +33,7 @@
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.regex.Pattern;
 
 import com.sun.tools.classfile.Dependency.Filter;
@@ -561,13 +562,10 @@
     }
 
     static abstract class BasicDependencyFinder implements Finder {
-        private Map<String,Location> locations = new HashMap<>();
+        private Map<String,Location> locations = new ConcurrentHashMap<>();
 
         Location getLocation(String className) {
-            Location l = locations.get(className);
-            if (l == null)
-                locations.put(className, l = new SimpleLocation(className));
-            return l;
+            return locations.computeIfAbsent(className, cn -> new SimpleLocation(cn));
         }
 
         class Visitor implements ConstantPool.Visitor<Void,Void>, Type.Visitor<Void, Void> {
--- a/langtools/test/ProblemList.txt	Thu May 19 17:57:28 2016 +0100
+++ b/langtools/test/ProblemList.txt	Thu May 19 10:55:33 2016 -0700
@@ -94,6 +94,3 @@
 #
 # jdeps 
 
-tools/jdeps/modules/GenModuleInfo.java                                          8152502,8153481    generic-all    fails to clean up files, java.util.HashMap$Node cannot be cast to java.util.HashMap$TreeNode
-tools/jdeps/modules/ModuleTest.java                                             8153481    generic-all    java.util.HashMap$Node cannot be cast to java.util.HashMap$TreeNode
-