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

Questionable code in ReflectionCache

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.2, 1.5.3, 1.5.4
    • 1.5.5
    • None
    • None
    • Patch

    Description

      I've sent this a couple times with no reply, so putting it here so it doesn't get lost.

      The logic in ReflectionCache.getCachedClass is a bit suspect and has been the source of a couple bugs. Attached is a rearranged version that makes the logic clearer and slightly faster (it will never do more tests and will usually do fewer - like half as many).

      In looking at the code (which is functionally identical to 1.5.3 which fixed GROOVY-2553) a question arises that indicates there is still a bug in that the case for primitive Byte.TYPE is missing. This may not be a bug of course since the test for 2553 seems to test it too, but then the question arises why Byte.TYPE is omitted since it appears in primitiveTypesMap as well as Number.byteValue() (I think it the former that is probably relevant here).

      The patch is formatted for the 1_5_X branch to minimize whitespace differences rather than correct indentation.

      Attachments

        1. tweak-reflectioncache-diff.txt
          6 kB
          James P. White
        2. Groovy2568Bug.groovy
          0.5 kB
          James P. White
        3. fix-reflectioncache-diff.txt
          6 kB
          James P. White

        Activity

          People

            jimwhite James P. White
            jimwhite James P. White
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: