Details
-
Suggestion
-
Resolution: Won't Fix
-
None
Description
No matter what "-source" value is set, Clover instruments both expression-like and block-like lambdas.
It's a behaviour slightly different from the one we have for e.g.:
- -source 1.3 (it handles 'assert' as not a keyword) or
- -source 1.4 (no 'enums').
Ways to improve it:
1) change Java grammar so that handling lambda functions is optional - only for source >= 1.8; otherwise Clover should throw a parse error
2) or parse lambdas also for source < 1.8 (no parse errors would be thrown, only javac will raise a compilation error), but do not add Clover's instrumentation to it
private LambdaBlockEntryEmitter instrEnterLambdaBlock(MethodSignature lambdaSignature, CloverToken leftCurly) { if (cfg.getInstrumentLambda() == LambdaInstrumentation.ALL || cfg.getInstrumentLambda() == LambdaInstrumentation.BLOCK /* add source level check*/ ) { ...