Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVRO-4050: Deprecate MapUtil computeIfAbsent #3142

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ private MapUtil() {
}

/**
* A temporary workaround for Java 8 specific performance issue JDK-8161372
* .<br>
* This class should be removed once we drop Java 8 support.
* A temporary workaround for Java 8 specific performance issue JDK-8161372.
*
* @see <a href=
* "https://bugs.openjdk.java.net/browse/JDK-8161372">JDK-8161372</a>
* @deprecated As of JDK 1.9 this issue has been resolved.
*/
// TODO: Remove for 1.13.0 or later
@Deprecated
belugabehr marked this conversation as resolved.
Show resolved Hide resolved
public static <K, V> V computeIfAbsent(ConcurrentMap<K, V> map, K key, Function<K, V> mappingFunction) {
V value = map.get(key);
if (value != null) {
Expand Down
Loading