I'm working with one project which is not opensource and I need to modify one or more its classes.
In one class is following collection:
private Map<Integer, TTP> ttp = new HashMap<>();
All what I need to do is use reflection and use concurrenthashmap here.
I've tried following code but it doesnt work.
Field f = ..getClass().getDeclaredField("ttp");
f.setAccessible(true);
f.set(null, new ConcurrentHashMap<>());
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…