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

Constant Optimization is a little off

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8.0, 2.4.0-rc-1
    • 2.3.10, 2.4.1
    • class generator

    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

            melix Cédric Champeau
            roshandawrani Roshan Dawrani
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: