groovy

Questionable code in ReflectionCache

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.5.2, 1.5.3, 1.5.4
  • Fix Version/s: 1.5.5
  • Component/s: None
  • Labels:
    None
  • Patch Submitted:
    Yes
  • Number of attachments :
    3

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.

Activity

Hide
Jim White added a comment -

Thinking more about what the question about the missing Byte.TYPE for isPrimitive meant lead me to a test case that demonstrates that there is still a bug after the fix for GROOVY-2553.

Attached is a test case (which I think is a good replacement for Groovy2553Bug.java).

Show
Jim White added a comment - Thinking more about what the question about the missing Byte.TYPE for isPrimitive meant lead me to a test case that demonstrates that there is still a bug after the fix for GROOVY-2553. Attached is a test case (which I think is a good replacement for Groovy2553Bug.java).
Hide
Jim White added a comment -

This is a bug now, but I don't know how to change the issue type. Attaching a fix and will also attach a test case with a better name and nicely formatted.

Show
Jim White added a comment - This is a bug now, but I don't know how to change the issue type. Attaching a fix and will also attach a test case with a better name and nicely formatted.
Hide
Jim White added a comment -

A better name and formatting.

Show
Jim White added a comment - A better name and formatting.
Hide
Jim White added a comment -

Patch to fix the bug.

Show
Jim White added a comment - Patch to fix the bug.
Hide
Jim White added a comment -

Last time fiddling the name...

Show
Jim White added a comment - Last time fiddling the name...
Hide
blackdrag blackdrag added a comment -

I changed this to issue type bug

Show
blackdrag blackdrag added a comment - I changed this to issue type bug
Hide
Jim White added a comment -

Is there a reason that my fix hasn't been applied to SVN yet?

Show
Jim White added a comment - Is there a reason that my fix hasn't been applied to SVN yet?
Hide
Alex Tkachman added a comment -

Because there are a lot of things with much higher priority. I really appreciate your willingness to help with this fix, but truly speaking you put to much pressure for me. I will have a look at some point, when it will be natural according to my schedule.

Show
Alex Tkachman added a comment - Because there are a lot of things with much higher priority. I really appreciate your willingness to help with this fix, but truly speaking you put to much pressure for me. I will have a look at some point, when it will be natural according to my schedule.
Hide
Jim White added a comment -

Patch applied.

Show
Jim White added a comment - Patch applied.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: