I have seen the following problem with the Groovy error handling: When there is an error in a method call, instead of pointing out the actual error, only the line is highlighted from where the method is called.
For example, working with the following code:
input = new Scanner(System.in);
def problematicCode() {
println notValidVariable // this line doesn’t work
}
N = input.nextInt()
for (i = 0; i < N; ++i) {
telephone = input.next()
}
problematicCode()
The error is shown at the last line, while actually it is the 4th line.
Running the same code on my PC I get the following stacktrace:
Exception in thread "main" groovy.lang.MissingPropertyException: No such property: habla for class: PhoneNumbers at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231) at PhoneNumbers.problematicCode(PhoneNumbers.groovy:4) at PhoneNumbers.run(PhoneNumbers.groovy:13) [snip]
Here, the second line from the bottom shows the proper error.
Would it be possible to check whether this information is available, and fix the editor to jump to the right line?
Thanks