Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.8-beta-1
-
None
-
None
Description
When I run the code
class Test { static main(args) { Int x = 1 def y = x + x } }
I get the errors
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Try.groovy: 3: unable to resolve class Int @ line 3, column 13. Int x = 1 ^ Try.groovy: 4: unable to resolve class Int @ line 4, column 17. def y = x + x ^ Try.groovy: 4: unable to resolve class Int @ line 4, column 21. def y = x + x ^ 3 errors
If the declaration statement has determined that the type couldn't be resolved, I am not sure that calling resolve() again for each use of that variable is of any use. It results in the same error coming multiple times (as many times as that variable is used) and also makes the compilation slower due to these unnecessary resolve() calls (even though the performance is hit only in case of errors, when resolve was unsuccessful.)