albertogoffi / toradocu

Toradocu - automated generation of test oracles from Javadoc documentation
Other
42 stars 21 forks source link

Missing translation of @return comments about "empty" or null argument #121

Open albertogoffi opened 7 years ago

albertogoffi commented 7 years ago

Toradocu does not translate @return comments that involve properties of the arguments.

Some examples:

Empty @return condition. Comment: true if empty or null
Expected condition: args[0].isEmpty()||args[0]==null?result==true
Actual condition: 
Empty @return condition. Comment: true if non-null and non-empty
Expected condition: (args[0]==null)==false&&(args[0].isEmpty())==false?true
Actual condition:
khaeghar commented 7 years ago

Actually there are 3 cases of this kind of comments.

Two like the first one, and one of the second one.

The thing about this kind of comments is that we do not have subject. Therefore, we would have to insert it in the sentence.

{ "containingClass": { "isArray": false, "name": "CollectionUtils", "qualifiedName": "org.apache.commons.collections4.CollectionUtils" }, "isVarArgs": false, "name": "sizeIsEmpty", "paramTags": [ { "comment": "the object to get the size of, may be null", "condition": "", "kind": "@param", "parameter": { "name": "object", "type": { "isArray": false, "name": "Object", "qualifiedName": "java.lang.Object" } } } ], "parameters": [ { "name": "object", "type": { "isArray": false, "name": "Object", "qualifiedName": "java.lang.Object" } } ], "returnTag": { "comment": "true if empty or null", "condition": "args[0].isEmpty() || args[0]==null ? result==true", "kind": "RETURN" }, "returnType": { "isArray": false, "name": "boolean", "qualifiedName": "boolean" }

This is the json for the comment that we would not support. We would know that the subject is the only parameter we have. But we wouldn't provide any translation because the parameter of the method is Object type, and it does not have any isEmpty() method itself.