You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the following loop while using tai-e, where the logic depends on the order in which JField appears in the loop (that is, I assign an index to these fields). However, I found that the order of JField appearances seems inconsistent across different runs.
JClass jclass = ...;
for (JField field : jclass.getDeclaredFields()) {
// some code that relies on the order of these fields
}
My question is whether this behavior is expected or a potential bug? Thanks a lot!
🎯 Expected Behavior
N/A
🐛 Current Behavior
N/A
🔄 Reproducible Example
My issue occurs in a class with a very large number of fields.
⚙️ Tai-e Arguments
No response
📜 Tai-e Log
No response
ℹ️ Additional Information
No response
The text was updated successfully, but these errors were encountered:
A possible cause analysis: jclass.getDeclaredFields() returns a set. The hashcodes of same JField objects change across different analysis sessions. This causes the order of JFields to vary when iterating over a HashSet.
The JField class uses Java's default hashCode implementation, which returns a pseudo-random value that depends on the timing of the hashCode invocation. Since IR construction is multithreaded by default, the timing at which the JVM generates the hashCode for each JField is nondeterministic. As a result, the JField object corresponding to the same field may have different hash codes in different analysis sessions.
📝 Overall Description
I used the following loop while using tai-e, where the logic depends on the order in which
JField
appears in the loop (that is, I assign an index to these fields). However, I found that the order of JField appearances seems inconsistent across different runs.My question is whether this behavior is expected or a potential bug? Thanks a lot!
🎯 Expected Behavior
N/A
🐛 Current Behavior
N/A
🔄 Reproducible Example
My issue occurs in a class with a very large number of fields.
⚙️ Tai-e Arguments
No response
📜 Tai-e Log
No response
ℹ️ Additional Information
No response
The text was updated successfully, but these errors were encountered: