albertogoffi / toradocu

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

Vacuous self-referential conditions are generated #98

Closed bjkeller closed 7 years ago

bjkeller commented 7 years ago

The following Randoop specification is being generated by Toradocu

  {
    "operation": {
      "classname": "org.apache.commons.collections4.BoundedMap",
      "name": "isFull",
      "parameterTypes": []
    },
    "identifiers": {
      "parameters": [],
      "receiverName": "target",
      "returnName": "result"
    },
    "throwsSpecifications": [],
    "postSpecifications": [
      {
        "property": {
          "conditionText": "result==true",
          "description": "true if the map is full"
        },
        "description": "return true if the map is full",
        "guard": {
          "conditionText": "target.isFull()",
          "description": ""
        }
      }
    ],
    "preSpecifications": []
  }

This is the condition "if target.isFull() then target.isFull()". I don't expect this to cause problems for Randoop, but it certainly isn't very interesting.

mernst commented 7 years ago

This seems nonsensical to me. I could see it leading to an infinite loop in Randoop or other tools.

bjkeller commented 7 years ago

It would only be a problem if the guard were being injected into the method, which we are not doing in Randoop.

albertogoffi commented 7 years ago

Thank you for the report.

Toradocu should not generate specifications for a method that mention the method itself (see commit f0ce683171456fcbd0f30a36793bb20c49854b3a). I'm going to investigate why this is happening.