albertogoffi / toradocu

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

generated condition uses value with type inconsistent with the parameter type #65

Closed bjkeller closed 7 years ago

bjkeller commented 7 years ago

The condition for org.apache.commons.math3.analysis.differentiation.DerivativeStructure org.apache.commons.math3.analysis.differentiation.DerivativeStructure.divide(org.apache.commons.math3.analysis.differentiation.DerivativeStructure a) assumes that zero translates to the corresponding int value. However, the class has a zero object that is different from the int, and may be difficult to figure out from the class.

This is the generated condition method:

// org.apache.commons.math3.analysis.differentiation.DerivativeStructure org.apache.commons.math3.analysis.differentiation.DerivativeStructure.divide(org.apache.commons.math3.analysis.differentiation.DerivativeStructure a)
    public static boolean m22_t2(org.apache.commons.math3.analysis.differentiation.DerivativeStructure receiver22_t2, org.apache.commons.math3.analysis.differentiation.DerivativeStructure a) {
        // @throws org.apache.commons.math3.exception.MathArithmeticException if a is zero ==> args[0]==0
        return a == 0;
    }
bjkeller commented 7 years ago

With Apache Commons Math there is a general problem of badly typed conditions some more like the example above and some like issue #66.

Others where type has a "zero": org.apache.commons.math3.analysis.differentiation.SparseGradient.divide(org.apache.commons.math3.analysis.differentiation.SparseGradient a)