fest-assert-2.x icon indicating copy to clipboard operation
fest-assert-2.x copied to clipboard

Make Fest Assertions more type safe

Open joel-costigliola opened this issue 12 years ago • 1 comments

Each class/interface that has S (self type) parameter should specify an upper bound. it makes the code more type safe as the returned assertion object is considered by the compiler as the upper bound type.

This was done for EnumerableAssert :

public interface EnumerableAssert<S extends EnumerableAssert<S, T>, T>

As S extends EnumerableAssert, the compiler knows that the returned object in assertion (S) can be considered as of EnumerableAssert type.

We should od the same for ComparableAssert (and probably some other interface/class) :

public interface ComparableAssert<S, A extends Comparable<? super A>>

joel-costigliola avatar Jun 02 '12 19:06 joel-costigliola

You meant

public interface ComparableAssert<S extends ComparableAssert<A>, A extends Comparable<? super A>>

ash2k avatar Sep 14 '12 07:09 ash2k