def ~ = Object
, def - Object, (Object , def a Groovy) - http://www.groovy-lang.org/semantics.html#_variable_definition , def Object, , JVM def Object,
test.groovy script :
def name = "John"
String surname = "Doe"
println "$name $surname"
test.class , :
Compiled from "test.groovy"
public class test extends groovy.lang.Script {
public static transient boolean __$stMC;
public test();
LocalVariableTable:
Start Length Slot Name Signature
4 4 0 this Ltest;
public test(groovy.lang.Binding);
LocalVariableTable:
Start Length Slot Name Signature
0 9 0 this Ltest;
0 9 1 context Lgroovy/lang/Binding;
public static void main(java.lang.String...);
LocalVariableTable:
Start Length Slot Name Signature
0 19 0 args [Ljava/lang/String;
public java.lang.Object run();
LineNumberTable:
line 1: 4
line 3: 9
line 5: 14
LocalVariableTable:
Start Length Slot Name Signature
0 63 0 this Ltest;
7 56 2 name Ljava/lang/Object;
12 51 3 surname Ljava/lang/String;
protected groovy.lang.MetaClass $getStaticMetaClass();
}
IDE
IDE, Groovy (, IntelliJ IDEA), , IDE .
def
def Groovy. , Java Object.
, . API . def :
- , ,
- Spock unit , .
def "should do something"() { }