Created
July 21, 2016 16:13
-
-
Save alien11689/8c31b65e42923eb49849e36d55fbf6ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ groovy -version | |
Groovy Version: 2.4.7 JVM: 1.8.0_91 Vendor: Oracle Corporation OS: Linux | |
$ groovy test.groovy | |
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: | |
/home/alien/test.groovy: 6: Apparent variable 'name' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes: | |
You attempted to reference a variable in the binding or an instance variable from a static context. | |
You misspelled a classname or statically imported field. Please check the spelling. | |
You attempted to use a method 'name' but left out brackets in a place not allowed by the grammar. | |
@ line 6, column 16. | |
return name | |
^ | |
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@groovy.transform.CompileStatic | |
class A { | |
String name | |
static String hello() { | |
return name | |
} | |
} | |
println(new A(name: 'aaaa').hello()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment