Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-1607

Java8: don't instrument lambda functions when source < 1.8

    XMLWordPrintable

Details

    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    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*/ ) {
          ...
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            mparfianowicz Marek Parfianowicz
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: