albertogoffi / toradocu

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

Wrong translation of overridden and inherited comments #75

Closed albertogoffi closed 7 years ago

albertogoffi commented 7 years ago

Toradocu produces wrong translations for comments that are inherited in overriding methods. Consider the method org.apache.commons.math3.complex.Complex#divide(Complex). Toradocu extracts the following tag:

{
  "exception": {
    "qualifiedName": "org.apache.commons.math3.exception.MathArithmeticException",
    "name": "MathArithmeticException",
    "isArray": false
  },
  "codeTags": [
    "a"
  ],
  "comment": "if a is zero",
  "kind": "THROWS",
  "condition": "target.add()==0 || target.abs()==0 || target.tan()==0"
}

The translation is wrong. The problem is due to the fact that the comment written by developers if a is zero has a meaning when applied to the supertype method. The supertype method is overridden and the parameter, originally named a in the supertype, is renamed to divisor in the subtype. Since Toradocu uses the parameter list of the method in the subtype, there is no match between a and divisor. As a consequence, the translated condition is wrong.

albertogoffi commented 7 years ago

Toradocu no longer inherits methods and comments, i.e., it produces procedure specifications for the methods and the comments that are present in the target class.

This issue is no longer valid.