Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Follow up from GROOVY-10277. Consider the following:
@groovy.transform.TypeChecked void test() { Comparator<Integer> cmp = (int one, int two) -> Integer.compare(one,two) }
Instead of an error for mismatched generics – which was the previous disposition of the compiler – there could be an error for each typed parameter that does not match expectations. ecj produces the following error for the above's Java equivalent: "Lambda expression's parameter one is expected to be of type Integer"
These checks should extend to lambdas or closures that are cast, coerced or passed as arguments.
Attachments
Issue Links
- is related to
-
GROOVY-10277 STC fails to catch type error on the return type of lambdas
- Closed
-
GROOVY-9910 STC: no error for incorrect parameter type if not referenced in lambda
- Closed