diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java
index 0c0b10478a5..95fc9598c90 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java
@@ -36,7 +36,6 @@
import org.apache.avro.specific.FixedSize;
import org.apache.avro.specific.SpecificData;
import org.apache.avro.util.ClassUtils;
-import org.apache.avro.util.MapUtil;
import java.io.IOException;
import java.lang.annotation.Annotation;
@@ -839,7 +838,7 @@ public static Schema makeNullable(Schema schema) {
// Return of this class and its superclasses to serialize.
private static Field[] getCachedFields(Class> recordClass) {
- return MapUtil.computeIfAbsent(FIELDS_CACHE, recordClass, rc -> getFields(rc, true));
+ return FIELDS_CACHE.computeIfAbsent(recordClass, rc -> getFields(rc, true));
}
private static Field[] getFields(Class> recordClass, boolean excludeJava) {
diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java
index c30616e17a3..a9dbbcbb5b6 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java
@@ -30,7 +30,6 @@
import org.apache.avro.io.DecoderFactory;
import org.apache.avro.io.EncoderFactory;
import org.apache.avro.util.ClassUtils;
-import org.apache.avro.util.MapUtil;
import org.apache.avro.util.SchemaUtil;
import org.apache.avro.util.internal.ClassValueCache;
@@ -379,7 +378,7 @@ public Class getClass(Schema schema) {
String name = schema.getFullName();
if (name == null)
return null;
- Class> c = MapUtil.computeIfAbsent(classCache, name, n -> {
+ Class> c = classCache.computeIfAbsent(name, n -> {
try {
return ClassUtils.forName(getClassLoader(), getClassName(schema));
} catch (ClassNotFoundException e) {
diff --git a/lang/java/avro/src/main/java/org/apache/avro/util/MapUtil.java b/lang/java/avro/src/main/java/org/apache/avro/util/MapUtil.java
index 1bdbfaf9a0a..394aa2b3a63 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/util/MapUtil.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/util/MapUtil.java
@@ -27,13 +27,14 @@ private MapUtil() {
}
/**
- * A temporary workaround for Java 8 specific performance issue JDK-8161372
- * .
- * This class should be removed once we drop Java 8 support.
+ * A temporary workaround for Java 8 specific performance issue JDK-8161372.
*
* @see JDK-8161372
+ * @deprecated As of JDK 1.9 this issue has been resolved.
*/
+ // TODO: Remove for 1.13.0 or later
+ @Deprecated
public static V computeIfAbsent(ConcurrentMap map, K key, Function mappingFunction) {
V value = map.get(key);
if (value != null) {