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

Eliminate redundant type cast

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.0.0-beta-1
    • bytecode
    • None

    Description

      The ticket is to provide some suggestion to tweak the fix of GROOVY-10034 ( https://github.com/apache/groovy/pull/1556 ):

      It seems that we could make the check simpler, we do not add extra checks but tweak the existing check.

      Current

      https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/classgen/asm/OperandStack.java#L334

              if (targetType == top) return;
      

      Proposed

      https://github.com/apache/groovy/pull/1561

      if (ClassNodeUtils.isCompatibleWith(top, targetType)) return;
      

      Attachments

        Issue Links

          Activity

            People

              daniel_sun Daniel Sun
              emilles Eric Milles
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m