From 450c7a914e237bee4c95154a47e23f03fc4053a7 Mon Sep 17 00:00:00 2001 From: ryenus Date: Wed, 6 Apr 2016 23:11:49 +0800 Subject: [PATCH] avoid duplicate String instance for myDebugName I was playing with MAT on IDEA and found 2500+ instance of this class (subclasses included). and there're 600+ instance of String "collection of library root". So intern() should make sense here. Null check is not performed as it seems not necessary :-) --- .../src/org/jetbrains/jps/model/ex/JpsElementChildRoleBase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jps/model-api/src/org/jetbrains/jps/model/ex/JpsElementChildRoleBase.java b/jps/model-api/src/org/jetbrains/jps/model/ex/JpsElementChildRoleBase.java index 17036f1e9f80..7150cb7708da 100644 --- a/jps/model-api/src/org/jetbrains/jps/model/ex/JpsElementChildRoleBase.java +++ b/jps/model-api/src/org/jetbrains/jps/model/ex/JpsElementChildRoleBase.java @@ -25,7 +25,7 @@ public class JpsElementChildRoleBase extends JpsElementChi private String myDebugName; protected JpsElementChildRoleBase(String debugName) { - myDebugName = debugName; + myDebugName = debugName.intern(); } @Override