Skip to content

Commit 3723da9

Browse files
Fix #332
get rid of String.intern
1 parent 489becb commit 3723da9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/main/java/com/fasterxml/jackson/core/util/InternCache.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
package com.fasterxml.jackson.core.util;
22

3-
import java.util.LinkedHashMap;
43
import java.util.concurrent.ConcurrentHashMap;
54

65
/**
7-
* Singleton class that adds a simple first-level cache in front of
8-
* regular String.intern() functionality. This is done as a minor
9-
* performance optimization, to avoid calling native intern() method
6+
* Singleton class that adds string deduplication functionality.
7+
* This is done as a minor performance optimization, to avoid extra memory footprint
108
* in cases where same String is being interned multiple times.
119
*<p>
12-
* Note: that this class extends {@link LinkedHashMap} is an implementation
10+
* Note: that this class extends {@link ConcurrentHashMap} is an implementation
1311
* detail -- no code should ever directly call Map methods.
1412
*/
1513
@SuppressWarnings("serial")
@@ -58,7 +56,7 @@ public String intern(String input) {
5856
}
5957
}
6058
}
61-
result = input.intern();
59+
result = input;
6260
put(result, result);
6361
return result;
6462
}

0 commit comments

Comments
 (0)