/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 */
package org.apache.groovy.util.concurrent;

import java.util.EnumSet;

/**
 * This is a basic implementation of a map able to forget its keys. This
 * map uses internally a ConcurrentHashMap, thus should be safe for concurrency.
 * hashcode and equals are used to find the entries and should thus be implemented
 * properly for the keys. This map does not support null keys.
 *
 * @param <K> the key type
 * @param <V> the value type
 * @since 4.0.0
 */
public class ManagedIdentityConcurrentMap<K, V> extends ConcurrentReferenceHashMap<K, V> {
    public ManagedIdentityConcurrentMap() {
        this(ReferenceType.WEAK);
    }

    public ManagedIdentityConcurrentMap(int initialCapacity) {
        this(ReferenceType.WEAK, initialCapacity);
    }

    public ManagedIdentityConcurrentMap(ReferenceType keyType) {
        super(keyType, ReferenceType.STRONG, EnumSet.of(Option.IDENTITY_COMPARISONS));
    }

    public ManagedIdentityConcurrentMap(ReferenceType keyType, int initialCapacity) {
        super(initialCapacity, keyType, ReferenceType.STRONG, EnumSet.of(Option.IDENTITY_COMPARISONS));
    }

    /**
     * Get the key specified value, or put the default value and return it if the key is absent
     *
     * @param key the key to look up
     * @param value the default value if the key is absent
     * @return the value
     */
    public V getOrPut(K key, V value) {
        return this.applyIfAbsent(key, k -> value);
    }
}

@@ -960,39 +960,70 @@
 keys
-. This%0A * map uses internally a
+ could be weak/soft/strong references. This%0A * bases on %7B@link
  Con
@@ -1033,31 +1033,37 @@
 rent
+Reference
 HashMap
+%7D
 , thus 
-should be
+it is
  saf
@@ -1088,148 +1088,48 @@
 %0A * 
-hashcode and equals are used to find the entries and should thus be implemented%0A * properly for the keys. This map does not support null key
+This map compares keys through reference
 s.%0A 
@@ -1306,367 +1306,1020 @@
    p
-ublic ManagedIdentityConcurrentMap() %7B%0A        this(ReferenceType.WEAK);%0A    %7D%0A%0A    public ManagedIdentityConcurrentMap(int initialCapacity) %7B%0A        this(ReferenceType.WEAK, initialCapacity);%0A    %7D%0A%0A    public ManagedIdentityConcurrentMap(ReferenceType keyType) %7B%0A        super(keyType, ReferenceType.STRONG, EnumSet.of(Option.IDENTITY_COMPARISONS));%0A    %7D%0A
+rivate static final long serialVersionUID = 1046734443288902802L;%0A%0A    /**%0A     * Creates a new, empty map with the key weak reference%0A     */%0A    public ManagedIdentityConcurrentMap() %7B%0A        this(ReferenceType.WEAK);%0A    %7D%0A%0A    /**%0A     * Creates a new, empty map with the key weak reference and the specified initial capacity%0A     *%0A     * @param initialCapacity initial capacity%0A     */%0A    public ManagedIdentityConcurrentMap(int initialCapacity) %7B%0A        this(ReferenceType.WEAK, initialCapacity);%0A    %7D%0A%0A    /**%0A     * Creates a new, empty map with the specified key reference type%0A     *%0A     * @param keyType key reference type%0A     */%0A    public ManagedIdentityConcurrentMap(ReferenceType keyType) %7B%0A        super(keyType, ReferenceType.STRONG, EnumSet.of(Option.IDENTITY_COMPARISONS));%0A    %7D%0A%0A    /**%0A     * Creates a new, empty map with the specified key reference type and initial capacity%0A     *%0A     * @param keyType key reference type%0A     * @param initialCapacity the initial capacity%0A     */
 %0A   

Tweak javadoc for `ManagedIdentityConcurrentMap` and add the missing `serialVersionUID`