Skip to content

Commit abfd8b6

Browse files
brad4dcopybara-github
authored andcommitted
Explicitly use IdentityHashMap
Don't store an object of type IdentityHashMap in a variable typed as Map. Although the type system thinks it's OK, it can mislead readers of the code. PiperOrigin-RevId: 325908128
1 parent f14fb6e commit abfd8b6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/com/google/javascript/jscomp/RemoveUnusedCode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import java.util.IdentityHashMap;
4141
import java.util.Iterator;
4242
import java.util.List;
43-
import java.util.Map;
4443
import java.util.Map.Entry;
4544
import java.util.Set;
4645
import java.util.function.Supplier;
@@ -118,7 +117,7 @@ class RemoveUnusedCode implements CompilerPass {
118117
*/
119118
private final Deque<Continuation> worklist = new ArrayDeque<>();
120119

121-
private final Map<Var, VarInfo> varInfoMap = new IdentityHashMap<>();
120+
private final IdentityHashMap<Var, VarInfo> varInfoMap = new IdentityHashMap<>();
122121

123122
private final Set<String> pinnedPropertyNames = new HashSet<>(IMPLICITLY_USED_PROPERTIES);
124123

0 commit comments

Comments
 (0)