Reuse empty class array constant in ClassUtils

Closes gh-24221
This commit is contained in:
Juergen Hoeller
2020-03-24 00:08:43 +01:00
parent fdc60311ed
commit 2209e7cb92
2 changed files with 11 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -232,7 +232,7 @@ public abstract class ExtendedEntityManagerCreator {
if (emIfc != null) {
interfaces = cachedEntityManagerInterfaces.computeIfAbsent(emIfc, key -> {
Set<Class<?>> ifcs = new LinkedHashSet<>();
Set<Class<?>> ifcs = new LinkedHashSet<>(4);
ifcs.add(key);
ifcs.add(EntityManagerProxy.class);
return ClassUtils.toClassArray(ifcs);
@@ -240,8 +240,7 @@ public abstract class ExtendedEntityManagerCreator {
}
else {
interfaces = cachedEntityManagerInterfaces.computeIfAbsent(rawEm.getClass(), key -> {
Set<Class<?>> ifcs = new LinkedHashSet<>(ClassUtils
.getAllInterfacesForClassAsSet(key, cl));
Set<Class<?>> ifcs = new LinkedHashSet<>(ClassUtils.getAllInterfacesForClassAsSet(key, cl));
ifcs.add(EntityManagerProxy.class);
return ClassUtils.toClassArray(ifcs);
});