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

Constant Optimization is a little off

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.0, 2.4.0-rc-1
    • Fix Version/s: 2.3.10, 2.4.1
    • Component/s: class generator
    • Labels:

      Description

      class Test {
          static main(String[] args) {
              def x = 2.0
              def y = 2.0
              def z = 2.0
          }
      }
      

      For the code above, optimizer generates the code below which has the optimization for first constant wrong (it should also be Object x = $const$0).

        public static Object main(String[] args)
        {
          Object x = new BigDecimal("2.0");
          Object y = $const$0;
          Object z = $const$0;
        }
      

        Attachments

          Activity

            People

            • Assignee:
              melix C├ędric Champeau
              Reporter:
              roshandawrani Roshan Dawrani
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: