Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8-beta-3
-
Fix Version/s: 1.9-beta-4, 1.8.4, 1.7.11
-
Component/s: class generator
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
class X {
private A a = new A()
public B b
public X() {
b = new B() {
public String getFoo() {a}
}
}
}
class A {}
class B {
B(){getFoo()}
def getFoo(){}
}
def x = new X()
The code above fails with
Caught: java.lang.NullPointerException at X$1.propertyMissing(TryGroovy.groovy) at X$1.getFoo(TryGroovy.groovy:6) at X$1.getFoo(TryGroovy.groovy) at B.<init>(TryGroovy.groovy:13) at X$1.<init>(TryGroovy.groovy) at X.<init>(TryGroovy.groovy:5) at TryGroovy.run(TryGroovy.groovy:16)
Fixed in master and 1.8.x branch. However, I'm not closing it since backporting to 1.7.x is still under discussion.