Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.8.6, 2.0-beta-3, 1.7.11
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Luke brought GRADLE-2045 to my attention and I was able to reproduce the problem using this program:
class Cat {
public static findAll(Integer x, Closure cl) {1}
}
def foo(x) {
x.findAll {}
}
use (Cat) {
println foo(1)
println foo(null)
}
It should actually not matter what method or base class the category uses, important is more that a PojoMetaClassSite will be produced. The code here does this because the receiver in foo is the Pojo integer and since categories are active, the normal way of getting a MetaMethod and using that will not be applied. Instead the fallback action with the long path through the MetaClassImpl will be chosen. PojoMetaClassSite has, as all of those, a check for invalidation which includes meta class changes and a check for the receiver being still of the same class. But the class check requires a non-null receiver, which is not the case anymore at the time that foo is called the second time.
Activity
| Field | Original Value | New Value |
|---|---|---|
| Status | Open [ 1 ] | Closed [ 6 ] |
| Assignee | Jochen Theodorou [ blackdrag ] | |
| Fix Version/s | 2.0-beta-3 [ 18244 ] | |
| Fix Version/s | 1.8.6 [ 18245 ] | |
| Fix Version/s | 1.7.11 [ 17244 ] | |
| Resolution | Fixed [ 1 ] |
Using
seems to fix the issue