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

Construction of integral data types

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • None
    • None
    • None

    Description

      • java.lang.Long,
      • java.lang.Integer,
      • java.lang.Short
      • java.lang.Character,
      • java.lang.Byte,
      • java.lang.Boolean,
      • java.math.BigInteger, and
      • java.math.BigDecimal

      have valueOf(<simple type>) methods. The Java Platform API Specification states that

      "If a new [...] instance is not required, this method should generally be used in preference to the constructor [...], as this method is likely to yield significantly better space and time performance by caching frequently requested values.".

      If this is true, Groovy should also use cache instances instead of creating new objects. As long as JDK 1.4 is supported this should be done in Groovy's own cache implementations analog to org.codehaus.groovy.runtime.typehandling.IntegerCache.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              veita Alexander Veit
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: