HHH-11495 Return a defensive copy of the array

This commit is contained in:
Guillaume Smet 2018-07-03 13:33:19 +02:00
parent 9684afda76
commit e17491a198
1 changed files with 4 additions and 1 deletions

View File

@ -8,6 +8,7 @@ package org.hibernate.metamodel.internal;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@ -624,7 +625,9 @@ public class MetamodelImpl implements MetamodelImplementor, Serializable {
* @throws MappingException
*/
public String[] getImplementors(String className) throws MappingException {
return implementorsCache.computeIfAbsent( className, this::doGetImplementors );
String[] implementors = implementorsCache.computeIfAbsent( className, this::doGetImplementors );
return Arrays.copyOf( implementors, implementors.length );
}
@Override