Closed Zuplyx closed 1 year ago
I intentionally skipped the repair for those cases. See the updated document here because I thought it would be extremely rare for them to appear in practice.
However, if it is essential for your use case, I can implement them.
0 == myCollection.size()
: I have a few of those in the code I am transforming, but I would not say it's essential to add them. However I would appreciate it if you could surpress the exception for these cases and not count them towards the total in the summary message.myCollection.size() <= 0;
: IMHO this should be fixed, as Sorald currently generates wrong code for it.Sure. I will proceed to add them. Wait for a fix :)
@Zuplyx fixed! It should be out in release 0.8.4
.
EDIT: https://github.com/ASSERT-KTH/sorald/releases/tag/sorald-0.8.4
Thank you. The repair of my code now completed without issues.
thanks a lot @algomaster99
To verify the solution for #1025, I decided to test Sorald with SonarJava's test file and I unfortunately found two new bugs with the processor:
b = myCollection.size() <= 0;
wrongly generates a negated callb = !myCollection.isEmpty();
when it should be justb = myCollection.isEmpty();
.b = 0 == myCollection.size();
cause a ClassCastException in Sorald with the following stacktrace. Additionally it seems that the summary message after processing still counts these statements as fixed.It might also be a good idea to compare Sorald's tests for the other processors with the ones from SonarJava to ensure the processors can handle all situations where SonarJava is expected to report an issue.