System.out.println(symbol_b.symbolName + " " + symbol_b.pointsTo.size());
// change the fieldpointsTo set of all above symbols
for (int i = 0; i < samePointsTo.size(); i++)
{
for (int j = 0; j < samePointsTo.elementAt(i).size(); j++)
{
Symbol symbol = samePointsTo.elementAt(i).elementAt(j);
System.out.println(symbol.symbolName);
// if field information is already present
if (symbol.fieldPointsTo.containsKey(fieldObj))
{
symbol.fieldPointsTo.get(fieldObj).clear();
symbol.fieldPointsTo.get(fieldObj).addAll(symbol_b.pointsTo);
}
else
{
// we have to create field information
symbol.fieldPointsTo.put(fieldObj, symbol_b.pointsTo);
}
}
}
System.out.println(symbol_b.symbolName + " " + symbol_b.pointsTo.size());
在for循环之前symbol_b.pointsTo的大小是2,但在for 循环之后它的值从2 更改为 0。它是如何发生的,谁能告诉我。我没有对 symbol_b.pointsTo 做任何事情,而 symbol_b.pointsTo 是一个投票者。