Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4542

@ConditionalInterrupt AST Transformation

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8-beta-3
    • Component/s: None
    • Labels:
      None
    • Flags:
      Patch

      Description

      Write an AST Transformation which allows the user to create custom interrupt conditions, instead of the Thread.currentThread().isInterrupted() check from @ThreadInterrupt.

      N.B : Attached patch is not complete. Documentation is not up to date and no test case is attached. Used for discussion only.

        Activity

        Hide
        melix Cédric Champeau added a comment -

        Working version with test cases. Ready for review + commit I guess.

        Show
        melix Cédric Champeau added a comment - Working version with test cases. Ready for review + commit I guess.
        Hide
        melix Cédric Champeau added a comment -

        Changing assignee for review. Let me know if it's ok.

        Show
        melix Cédric Champeau added a comment - Changing assignee for review. Let me know if it's ok.
        Hide
        hamletdrc Hamlet D'Arcy added a comment -

        OK, I checked in the first revision. a couple comments:
        1. I changed the exception text to be more descriptive. You may want to look at it.
        2. We need more test cases. there is no coverage for the various loop types.
        3. I will update the Javadoc shortly.

        Show
        hamletdrc Hamlet D'Arcy added a comment - OK, I checked in the first revision. a couple comments: 1. I changed the exception text to be more descriptive. You may want to look at it. 2. We need more test cases. there is no coverage for the various loop types. 3. I will update the Javadoc shortly.
        Hide
        hamletdrc Hamlet D'Arcy added a comment -

        fixed in 1.8. checking in javadoc fixes momentarily

        Show
        hamletdrc Hamlet D'Arcy added a comment - fixed in 1.8. checking in javadoc fixes momentarily
        Hide
        hamletdrc Hamlet D'Arcy added a comment -

        checking in final changes now. 2 things:
        1. made the condition method private. There is no need to make it protected, in fact this could open up ways to subvert this annotation (ie it would be unsecure)
        2. Made the condition method return object. That way it participates in Groovy Truth comparisons and not just plain old boolean comparisons.

        Show
        hamletdrc Hamlet D'Arcy added a comment - checking in final changes now. 2 things: 1. made the condition method private. There is no need to make it protected, in fact this could open up ways to subvert this annotation (ie it would be unsecure) 2. Made the condition method return object. That way it participates in Groovy Truth comparisons and not just plain old boolean comparisons.
        Hide
        melix Cédric Champeau added a comment -

        Looks fine to me. Thanks.

        Show
        melix Cédric Champeau added a comment - Looks fine to me. Thanks.

          People

          • Assignee:
            hamletdrc Hamlet D'Arcy
            Reporter:
            melix Cédric Champeau
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development