Memory optimization: Do not retain LinkedHashSets in caches

LinkedHashSets are replaced with tight ArrayLists
This commit is contained in:
Andrey Breslav
2014-11-01 13:38:24 +02:00
parent bfdb756e22
commit 60ff2df597
2 changed files with 5 additions and 4 deletions
@@ -100,7 +100,7 @@ public abstract class LazyJavaMemberScope(
} }
} }
functions ArrayList(functions)
} }
data class MethodSignatureData( data class MethodSignatureData(
@@ -237,6 +237,7 @@ public abstract class LazyJavaMemberScope(
computeNonDeclaredProperties(name, properties) computeNonDeclaredProperties(name, properties)
properties.trimToSize()
properties properties
} }
@@ -323,7 +324,7 @@ public abstract class LazyJavaMemberScope(
addExtraDescriptors(result) addExtraDescriptors(result)
return result return ArrayList(result)
} }
protected open fun addExtraDescriptors(result: MutableSet<DeclarationDescriptor>) { protected open fun addExtraDescriptors(result: MutableSet<DeclarationDescriptor>) {
@@ -135,7 +135,7 @@ public abstract class DeserializedMemberScope implements JetScope {
private Collection<FunctionDescriptor> computeFunctions(@NotNull Name name) { private Collection<FunctionDescriptor> computeFunctions(@NotNull Name name) {
Collection<FunctionDescriptor> descriptors = computeMembersByName(name, FUNCTION); Collection<FunctionDescriptor> descriptors = computeMembersByName(name, FUNCTION);
computeNonDeclaredFunctions(name, descriptors); computeNonDeclaredFunctions(name, descriptors);
return descriptors; return new ArrayList<FunctionDescriptor>(descriptors);
} }
protected void computeNonDeclaredFunctions(@NotNull Name name, @NotNull Collection<FunctionDescriptor> functions) { protected void computeNonDeclaredFunctions(@NotNull Name name, @NotNull Collection<FunctionDescriptor> functions) {
@@ -152,7 +152,7 @@ public abstract class DeserializedMemberScope implements JetScope {
Collection<PropertyDescriptor> descriptors = computeMembersByName(name, PROPERTY); Collection<PropertyDescriptor> descriptors = computeMembersByName(name, PROPERTY);
computeNonDeclaredProperties(name, descriptors); computeNonDeclaredProperties(name, descriptors);
//noinspection unchecked //noinspection unchecked
return (Collection) descriptors; return new ArrayList<VariableDescriptor>((Collection) descriptors);
} }
protected void computeNonDeclaredProperties(@NotNull Name name, @NotNull Collection<PropertyDescriptor> descriptors) { protected void computeNonDeclaredProperties(@NotNull Name name, @NotNull Collection<PropertyDescriptor> descriptors) {