Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.1-beta-1
-
Fix Version/s: 1.1-beta-2
-
Component/s: None
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
This is rather bizarre and took a while to track down. The following code can run in groovy console 1.1 and shows 2 classes, identical other than the name of a property used as a map value. The first fails to load, the second works.
class Test {
// The names of the properties are what cause the problem here
static HOL_ISTANBUL = "b"
static RECOMMENDATIONS = [
"oops": HOL_INSTANBUL
]
}
// Test loading of the class
try {
x = new Test()
println "Test class loaded fine"
} catch (Throwable t) {
println "Class Test would not load: ${t}"
}
class Test2 {
static CONST_B = "b"
static RECOMMENDATIONS = [
"oops": CONST_B
]
}
// Test loading of the second class
try {
x = new Test2()
println "Test2 class loaded fine"
} catch (Throwable t) {
println "Class Test2 would not load: ${t}"
}
I get the output:
Class Test would not load: java.lang.IncompatibleClassChangeError
Test2 class loaded fine
hmm, yes... HOL_ISTANBUL is not HOL_INSTANBUL. That should give a different exception... like missing property Exception or maybe even a compile time error.