Skip to content

Commit

Permalink
perf[storage]: remove the useless cast type
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysunxiao committed Oct 23, 2023
1 parent 068e306 commit b5035ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ public StorageInt(Class<?> clazz, IdDef idDef, Map<String, IndexDef> indexDefMap

this.dataMap = new IntObjectHashMap<>(values.size());
for (var value : values) {
@SuppressWarnings("unchecked")
var id = (K) ReflectionUtils.getField(idDef.getField(), value);
var id = (Integer) ReflectionUtils.getField(idDef.getField(), value);
@SuppressWarnings("unchecked")
var v = (V) value;
dataMap.put((Integer) id, v);
dataMap.put(id, v);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ public StorageLong(Class<?> clazz, IdDef idDef, Map<String, IndexDef> indexDefMa

this.dataMap = new LongObjectHashMap<>(values.size());
for (var value : values) {
@SuppressWarnings("unchecked")
var id = (K) ReflectionUtils.getField(idDef.getField(), value);
var id = (Long) ReflectionUtils.getField(idDef.getField(), value);
@SuppressWarnings("unchecked")
var v = (V) value;
dataMap.put((Long) id, v);
dataMap.put(id, v);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public StorageObject(Class<?> clazz, IdDef idDef, Map<String, IndexDef> indexDef
var id = (K) ReflectionUtils.getField(idDef.getField(), value);
@SuppressWarnings("unchecked")
var v = (V) value;
dataMap.put((K) id, v);
dataMap.put(id, v);
}
}

Expand Down

0 comments on commit b5035ed

Please sign in to comment.