renamed all modules
This commit is contained in:
27
testdata-groovy/src/clinitg/Four.groovy
Normal file
27
testdata-groovy/src/clinitg/Four.groovy
Normal file
@@ -0,0 +1,27 @@
|
||||
package clinitg;
|
||||
|
||||
public class Four {
|
||||
|
||||
static {
|
||||
System.out.println("original clinit");
|
||||
bar()
|
||||
}
|
||||
|
||||
public static String run() {
|
||||
bar()
|
||||
boo()
|
||||
baz()
|
||||
}
|
||||
|
||||
public static void bar() {
|
||||
print '1'
|
||||
}
|
||||
|
||||
public static void boo() {
|
||||
print '2'
|
||||
}
|
||||
|
||||
public static void baz() {
|
||||
print '3'
|
||||
}
|
||||
}
|
||||
37
testdata-groovy/src/clinitg/Four2.groovy
Normal file
37
testdata-groovy/src/clinitg/Four2.groovy
Normal file
@@ -0,0 +1,37 @@
|
||||
package clinitg;
|
||||
|
||||
public class Four2 {
|
||||
|
||||
public static void biz() {
|
||||
print '1'
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static {
|
||||
bar()
|
||||
FourHelper.doo()
|
||||
}
|
||||
|
||||
public static String run() {
|
||||
bar()
|
||||
baz()
|
||||
biz()
|
||||
boo()
|
||||
}
|
||||
|
||||
public static void bar() {
|
||||
print '1'
|
||||
}
|
||||
|
||||
|
||||
public static void baz() {
|
||||
print '3'
|
||||
}
|
||||
|
||||
public static void boo() {
|
||||
print '2'
|
||||
}
|
||||
}
|
||||
10
testdata-groovy/src/clinitg/FourHelper.groovy
Normal file
10
testdata-groovy/src/clinitg/FourHelper.groovy
Normal file
@@ -0,0 +1,10 @@
|
||||
package clinitg;
|
||||
|
||||
public class FourHelper {
|
||||
|
||||
public static void doo() {
|
||||
print 'a'
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
10
testdata-groovy/src/clinitg/One.groovy
Normal file
10
testdata-groovy/src/clinitg/One.groovy
Normal file
@@ -0,0 +1,10 @@
|
||||
package clinitg;
|
||||
|
||||
public class One {
|
||||
|
||||
public static int i = 5;
|
||||
|
||||
public static String run() {
|
||||
return Integer.toString(i);
|
||||
}
|
||||
}
|
||||
10
testdata-groovy/src/clinitg/One2.groovy
Normal file
10
testdata-groovy/src/clinitg/One2.groovy
Normal file
@@ -0,0 +1,10 @@
|
||||
package clinitg;
|
||||
|
||||
public class One2 {
|
||||
|
||||
public static int i = 7;
|
||||
|
||||
public static String run() {
|
||||
return Integer.toString(i);
|
||||
}
|
||||
}
|
||||
10
testdata-groovy/src/clinitg/Three.groovy
Normal file
10
testdata-groovy/src/clinitg/Three.groovy
Normal file
@@ -0,0 +1,10 @@
|
||||
package clinitg;
|
||||
|
||||
public class Three {
|
||||
|
||||
// i have no clinit
|
||||
|
||||
public static String run() {
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
10
testdata-groovy/src/clinitg/Three2.groovy
Normal file
10
testdata-groovy/src/clinitg/Three2.groovy
Normal file
@@ -0,0 +1,10 @@
|
||||
package clinitg;
|
||||
|
||||
public class Three2 {
|
||||
|
||||
// still no clinit
|
||||
|
||||
public static String run() {
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
13
testdata-groovy/src/clinitg/Three3.groovy
Normal file
13
testdata-groovy/src/clinitg/Three3.groovy
Normal file
@@ -0,0 +1,13 @@
|
||||
package clinitg;
|
||||
|
||||
public class Three3 {
|
||||
|
||||
static int i;
|
||||
{
|
||||
i = 4;
|
||||
}
|
||||
|
||||
public static String run() {
|
||||
return Integer.toString(i);
|
||||
}
|
||||
}
|
||||
10
testdata-groovy/src/clinitg/Two.groovy
Normal file
10
testdata-groovy/src/clinitg/Two.groovy
Normal file
@@ -0,0 +1,10 @@
|
||||
package clinitg;
|
||||
|
||||
public class Two {
|
||||
|
||||
public final static int i = 55;
|
||||
|
||||
public static String run() {
|
||||
return Integer.toString(i);
|
||||
}
|
||||
}
|
||||
10
testdata-groovy/src/clinitg/Two2.groovy
Normal file
10
testdata-groovy/src/clinitg/Two2.groovy
Normal file
@@ -0,0 +1,10 @@
|
||||
package clinitg;
|
||||
|
||||
public class Two2 {
|
||||
|
||||
public final static int i = 99;
|
||||
|
||||
public static String run() {
|
||||
return Integer.toString(i);
|
||||
}
|
||||
}
|
||||
117
testdata-groovy/src/controller/Controller.groovy
Normal file
117
testdata-groovy/src/controller/Controller.groovy
Normal file
@@ -0,0 +1,117 @@
|
||||
package controller
|
||||
|
||||
class Controller {
|
||||
|
||||
def index = {
|
||||
run(action: "list", params: "2")
|
||||
}
|
||||
|
||||
public void printSomethingRandom() {
|
||||
System.out.println("abcde")
|
||||
}
|
||||
|
||||
public void run(Map m) {
|
||||
System.out.println(m);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new Controller().index() // prints [action:list, params:2]
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
new Controller().index() // prints [action:list, params:2]
|
||||
}
|
||||
|
||||
|
||||
// def list = {
|
||||
// params.max = Math.min(params.max ? params.int('max') : 10, 100)
|
||||
// [testInstanceList: Test.list(params), testInstanceTotal: Test.count()]
|
||||
// }
|
||||
//
|
||||
// def create = {
|
||||
// def testInstance = new Test()
|
||||
// testInstance.properties = params
|
||||
// return [testInstance: testInstance]
|
||||
// }
|
||||
//
|
||||
// def save = {
|
||||
// def testInstance = new Test(params)
|
||||
// if (testInstance.save(flush: true)) {
|
||||
// flash.message = "${message(code: 'default.created.message', args: [message(code: 'test.label', default: 'Test'), testInstance.id])}"
|
||||
// redirect(action: "show", id: testInstance.id)
|
||||
// }
|
||||
// else {
|
||||
// render(view: "create", model: [testInstance: testInstance])
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def show = {
|
||||
// def testInstance = Test.get(params.id)
|
||||
// if (!testInstance) {
|
||||
// flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// else {
|
||||
// [testInstance: testInstance]
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def edit = {
|
||||
// def testInstance = Test.get(params.id)
|
||||
// if (!testInstance) {
|
||||
// flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// else {
|
||||
// return [testInstance: testInstance]
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def update = {
|
||||
// def testInstance = Test.get(params.id)
|
||||
// if (testInstance) {
|
||||
// if (params.version) {
|
||||
// def version = params.version.toLong()
|
||||
// if (testInstance.version > version) {
|
||||
//
|
||||
// testInstance.errors.rejectValue("version", "default.optimistic.locking.failure", [message(code: 'test.label', default: 'Test')] as Object[], "Another user has updated this Test while you were editing")
|
||||
// render(view: "edit", model: [testInstance: testInstance])
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// testInstance.properties = params
|
||||
// if (!testInstance.hasErrors() && testInstance.save(flush: true)) {
|
||||
// flash.message = "${message(code: 'default.updated.message', args: [message(code: 'test.label', default: 'Test'), testInstance.id])}"
|
||||
// redirect(action: "show", id: testInstance.id)
|
||||
// }
|
||||
// else {
|
||||
// render(view: "edit", model: [testInstance: testInstance])
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def delete = {
|
||||
// def testInstance = Test.get(params.id)
|
||||
// if (testInstance) {
|
||||
// try {
|
||||
// testInstance.delete(flush: true)
|
||||
// flash.message = "${message(code: 'default.deleted.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// catch (org.springframework.dao.DataIntegrityViolationException e) {
|
||||
// flash.message = "${message(code: 'default.not.deleted.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "show", id: params.id)
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
117
testdata-groovy/src/controller/Controller2.groovy
Normal file
117
testdata-groovy/src/controller/Controller2.groovy
Normal file
@@ -0,0 +1,117 @@
|
||||
package controller
|
||||
|
||||
class Controller2 {
|
||||
|
||||
def index = {
|
||||
run(action: "custard", params: "345")
|
||||
}
|
||||
|
||||
public void printSomethingRandom() {
|
||||
System.out.println("abcde")
|
||||
}
|
||||
|
||||
public void run(Map m) {
|
||||
System.out.println(m);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new Controller2().index() // prints [action:list, params:2]
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
new Controller2().index() // prints [action:list, params:2]
|
||||
}
|
||||
|
||||
|
||||
// def list = {
|
||||
// params.max = Math.min(params.max ? params.int('max') : 10, 100)
|
||||
// [testInstanceList: Test.list(params), testInstanceTotal: Test.count()]
|
||||
// }
|
||||
//
|
||||
// def create = {
|
||||
// def testInstance = new Test()
|
||||
// testInstance.properties = params
|
||||
// return [testInstance: testInstance]
|
||||
// }
|
||||
//
|
||||
// def save = {
|
||||
// def testInstance = new Test(params)
|
||||
// if (testInstance.save(flush: true)) {
|
||||
// flash.message = "${message(code: 'default.created.message', args: [message(code: 'test.label', default: 'Test'), testInstance.id])}"
|
||||
// redirect(action: "show", id: testInstance.id)
|
||||
// }
|
||||
// else {
|
||||
// render(view: "create", model: [testInstance: testInstance])
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def show = {
|
||||
// def testInstance = Test.get(params.id)
|
||||
// if (!testInstance) {
|
||||
// flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// else {
|
||||
// [testInstance: testInstance]
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def edit = {
|
||||
// def testInstance = Test.get(params.id)
|
||||
// if (!testInstance) {
|
||||
// flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// else {
|
||||
// return [testInstance: testInstance]
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def update = {
|
||||
// def testInstance = Test.get(params.id)
|
||||
// if (testInstance) {
|
||||
// if (params.version) {
|
||||
// def version = params.version.toLong()
|
||||
// if (testInstance.version > version) {
|
||||
//
|
||||
// testInstance.errors.rejectValue("version", "default.optimistic.locking.failure", [message(code: 'test.label', default: 'Test')] as Object[], "Another user has updated this Test while you were editing")
|
||||
// render(view: "edit", model: [testInstance: testInstance])
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// testInstance.properties = params
|
||||
// if (!testInstance.hasErrors() && testInstance.save(flush: true)) {
|
||||
// flash.message = "${message(code: 'default.updated.message', args: [message(code: 'test.label', default: 'Test'), testInstance.id])}"
|
||||
// redirect(action: "show", id: testInstance.id)
|
||||
// }
|
||||
// else {
|
||||
// render(view: "edit", model: [testInstance: testInstance])
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def delete = {
|
||||
// def testInstance = Test.get(params.id)
|
||||
// if (testInstance) {
|
||||
// try {
|
||||
// testInstance.delete(flush: true)
|
||||
// flash.message = "${message(code: 'default.deleted.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// catch (org.springframework.dao.DataIntegrityViolationException e) {
|
||||
// flash.message = "${message(code: 'default.not.deleted.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "show", id: params.id)
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
122
testdata-groovy/src/controller/Controller3.groovy
Normal file
122
testdata-groovy/src/controller/Controller3.groovy
Normal file
@@ -0,0 +1,122 @@
|
||||
package controller
|
||||
|
||||
class Controller3 {
|
||||
|
||||
def preIndex = {
|
||||
printSomethingRandom()
|
||||
}
|
||||
|
||||
def index = {
|
||||
run(action: "custard", params: "345")
|
||||
}
|
||||
|
||||
public void printSomethingRandom() {
|
||||
System.out.println("abcde")
|
||||
}
|
||||
|
||||
public void run(Map m) {
|
||||
System.out.println(m)
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new Controller3().index() // prints [action:list, params:2]
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
new Controller3().index() // prints [action:list, params:2]
|
||||
}
|
||||
|
||||
|
||||
|
||||
// def list = {
|
||||
// params.max = Math.min(params.max ? params.int('max') : 10, 100)
|
||||
// [testInstanceList: Test.list(params), testInstanceTotal: Test.count()]
|
||||
// }
|
||||
//
|
||||
// def create = {
|
||||
// def testInstance = new Test()
|
||||
// testInstance.properties = params
|
||||
// return [testInstance: testInstance]
|
||||
// }
|
||||
//
|
||||
// def save = {
|
||||
// def testInstance = new Test(params)
|
||||
// if (testInstance.save(flush: true)) {
|
||||
// flash.message = "${message(code: 'default.created.message', args: [message(code: 'test.label', default: 'Test'), testInstance.id])}"
|
||||
// redirect(action: "show", id: testInstance.id)
|
||||
// }
|
||||
// else {
|
||||
// render(view: "create", model: [testInstance: testInstance])
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def show = {
|
||||
// def testInstance = Test.get(params.id)
|
||||
// if (!testInstance) {
|
||||
// flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// else {
|
||||
// [testInstance: testInstance]
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def edit = {
|
||||
// def testInstance = Test.get(params.id)
|
||||
// if (!testInstance) {
|
||||
// flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// else {
|
||||
// return [testInstance: testInstance]
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def update = {
|
||||
// def testInstance = Test.get(params.id)
|
||||
// if (testInstance) {
|
||||
// if (params.version) {
|
||||
// def version = params.version.toLong()
|
||||
// if (testInstance.version > version) {
|
||||
//
|
||||
// testInstance.errors.rejectValue("version", "default.optimistic.locking.failure", [message(code: 'test.label', default: 'Test')] as Object[], "Another user has updated this Test while you were editing")
|
||||
// render(view: "edit", model: [testInstance: testInstance])
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// testInstance.properties = params
|
||||
// if (!testInstance.hasErrors() && testInstance.save(flush: true)) {
|
||||
// flash.message = "${message(code: 'default.updated.message', args: [message(code: 'test.label', default: 'Test'), testInstance.id])}"
|
||||
// redirect(action: "show", id: testInstance.id)
|
||||
// }
|
||||
// else {
|
||||
// render(view: "edit", model: [testInstance: testInstance])
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// def delete = {
|
||||
// def testInstance = Test.get(params.id)
|
||||
// if (testInstance) {
|
||||
// try {
|
||||
// testInstance.delete(flush: true)
|
||||
// flash.message = "${message(code: 'default.deleted.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// catch (org.springframework.dao.DataIntegrityViolationException e) {
|
||||
// flash.message = "${message(code: 'default.not.deleted.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "show", id: params.id)
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'test.label', default: 'Test'), params.id])}"
|
||||
// redirect(action: "list")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
7
testdata-groovy/src/enums/ExtensibleEnum.groovy
Normal file
7
testdata-groovy/src/enums/ExtensibleEnum.groovy
Normal file
@@ -0,0 +1,7 @@
|
||||
package enums
|
||||
|
||||
interface ExtensibleEnum {
|
||||
|
||||
int getIntValue()
|
||||
|
||||
}
|
||||
7
testdata-groovy/src/enums/ExtensibleEnum3.groovy
Normal file
7
testdata-groovy/src/enums/ExtensibleEnum3.groovy
Normal file
@@ -0,0 +1,7 @@
|
||||
package enums
|
||||
|
||||
interface ExtensibleEnum3 {
|
||||
|
||||
int getValue()
|
||||
|
||||
}
|
||||
7
testdata-groovy/src/enums/ExtensibleEnumB.groovy
Normal file
7
testdata-groovy/src/enums/ExtensibleEnumB.groovy
Normal file
@@ -0,0 +1,7 @@
|
||||
package enums
|
||||
|
||||
interface ExtensibleEnumB {
|
||||
|
||||
int getIntValue()
|
||||
|
||||
}
|
||||
24
testdata-groovy/src/enums/RunnerA.java
Normal file
24
testdata-groovy/src/enums/RunnerA.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package enums;
|
||||
|
||||
public class RunnerA {
|
||||
|
||||
public static void main(String[] args) {
|
||||
run();
|
||||
}
|
||||
|
||||
public static void run() {
|
||||
System.out.println(WhatAnEnum.RED);
|
||||
System.out.println(WhatAnEnum.GREEN);
|
||||
System.out.println(WhatAnEnum.BLUE);
|
||||
WhatAnEnum[] vals = WhatAnEnum.values();
|
||||
System.out.print("[");
|
||||
for (int i = 0; i < vals.length; i++) {
|
||||
if (i > 0) {
|
||||
System.out.print(" ");
|
||||
}
|
||||
System.out.print(vals[i]==null?"NULL":vals[i].toString());//+" "+vals[i].getIntValue());
|
||||
}
|
||||
System.out.println("]");
|
||||
System.out.println("value count = " + vals.length);
|
||||
}
|
||||
}
|
||||
24
testdata-groovy/src/enums/RunnerB.java
Normal file
24
testdata-groovy/src/enums/RunnerB.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package enums;
|
||||
|
||||
public class RunnerB {
|
||||
|
||||
public static void main(String[] args) {
|
||||
run();
|
||||
}
|
||||
|
||||
public static void run() {
|
||||
System.out.println(WhatAnEnumB.HAVING_A_NICE_TIME);
|
||||
System.out.println(WhatAnEnumB.JUMPING_INTO_A_HOOP);
|
||||
System.out.println(WhatAnEnumB.LIVING_ON_A_LOG);
|
||||
WhatAnEnumB[] vals = WhatAnEnumB.values();
|
||||
System.out.print("[");
|
||||
for (int i = 0; i < vals.length; i++) {
|
||||
if (i > 0) {
|
||||
System.out.print(" ");
|
||||
}
|
||||
System.out.print(vals[i]+" "+vals[i].getIntValue());
|
||||
}
|
||||
System.out.println("]");
|
||||
System.out.println("value count = " + vals.length);
|
||||
}
|
||||
}
|
||||
29
testdata-groovy/src/enums/WhatAnEnum.groovy
Normal file
29
testdata-groovy/src/enums/WhatAnEnum.groovy
Normal file
@@ -0,0 +1,29 @@
|
||||
package enums
|
||||
|
||||
enum WhatAnEnum {//implements ExtensibleEnum {
|
||||
|
||||
RED,//(1),
|
||||
GREEN,//(2),
|
||||
BLUE//(3),
|
||||
|
||||
// private WhatAnEnum(String s, int i) {
|
||||
// super(s,i);
|
||||
// print ">>"+s+" "+i
|
||||
// }
|
||||
|
||||
// LIVING_ON_A_LOG,//(4),
|
||||
// WHAT_DID_YOU_DO,//(5),
|
||||
// UNKNOWN//(0)
|
||||
|
||||
// final int intValue
|
||||
// private WhatAnEnum(int intValue) {
|
||||
// this.intValue = intValue
|
||||
// }
|
||||
//
|
||||
// private static final Map<Integer, WhatAnEnum> MAP = [:] as Map<Integer, WhatAnEnum>
|
||||
// static {
|
||||
// WhatAnEnum.values().each { WhatAnEnum response ->
|
||||
// MAP.put(response.intValue, response)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
33
testdata-groovy/src/enums/WhatAnEnum2.groovy
Normal file
33
testdata-groovy/src/enums/WhatAnEnum2.groovy
Normal file
@@ -0,0 +1,33 @@
|
||||
package enums
|
||||
|
||||
enum WhatAnEnum2 { // implements ExtensibleEnum {
|
||||
|
||||
RED,GREEN,BLUE,YELLOW;
|
||||
|
||||
// private WhatAnEnum2(String s, int i) {
|
||||
// super(s,i);
|
||||
// print ">>"+s+" "+i
|
||||
// }
|
||||
|
||||
// PETS_AT_THE_DISCO,//(1),
|
||||
// JUMPING_INTO_A_HOOP,//(2),
|
||||
// HAVING_A_NICE_TIME,//(3),
|
||||
// LIVING_ON_A_LOG,//(4),
|
||||
// WHAT_DID_YOU_DO,//(5),
|
||||
// WOBBLE,//(6),
|
||||
// UNKNOWN//(0)
|
||||
|
||||
// final int intValue
|
||||
//
|
||||
// private WhatAnEnum2(int intValue) {
|
||||
// this.intValue = intValue
|
||||
// }
|
||||
//
|
||||
// private static final Map<Integer, WhatAnEnum2> MAP = [:] as Map<Integer, WhatAnEnum2>
|
||||
//
|
||||
// static {
|
||||
// WhatAnEnum2.values().each { WhatAnEnum2 response ->
|
||||
// MAP.put(response.intValue, response)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
26
testdata-groovy/src/enums/WhatAnEnum3.groovy
Normal file
26
testdata-groovy/src/enums/WhatAnEnum3.groovy
Normal file
@@ -0,0 +1,26 @@
|
||||
package enums
|
||||
|
||||
enum WhatAnEnum3 implements ExtensibleEnum3 {
|
||||
|
||||
PETS_AT_THE_DISCO(1),
|
||||
JUMPING_INTO_A_HOOP(2),
|
||||
HAVING_A_NICE_TIME(3),
|
||||
LIVING_ON_A_LOG(4),
|
||||
WHAT_DID_YOU_DO(5),
|
||||
WOBBLE(6),
|
||||
UNKNOWN(0)
|
||||
|
||||
final int value
|
||||
|
||||
private WhatAnEnum3(int intValue) {
|
||||
this.value = intValue
|
||||
}
|
||||
|
||||
private static final Map<Integer, WhatAnEnum3> MAP = [:] as Map<Integer, WhatAnEnum3>
|
||||
|
||||
static {
|
||||
WhatAnEnum3.values().each { WhatAnEnum3 response ->
|
||||
MAP.put(response.value, response)
|
||||
}
|
||||
}
|
||||
}
|
||||
23
testdata-groovy/src/enums/WhatAnEnumB.groovy
Normal file
23
testdata-groovy/src/enums/WhatAnEnumB.groovy
Normal file
@@ -0,0 +1,23 @@
|
||||
package enums
|
||||
|
||||
enum WhatAnEnumB implements ExtensibleEnumB {
|
||||
|
||||
PETS_AT_THE_DISCO(1),
|
||||
JUMPING_INTO_A_HOOP(2),
|
||||
HAVING_A_NICE_TIME(3),
|
||||
LIVING_ON_A_LOG(4),
|
||||
WHAT_DID_YOU_DO(5),
|
||||
UNKNOWN(0)
|
||||
|
||||
final int intValue
|
||||
private WhatAnEnumB(int intValue) {
|
||||
this.intValue = intValue
|
||||
}
|
||||
|
||||
private static final Map<Integer, WhatAnEnumB> MAP = [:] as Map<Integer, WhatAnEnumB>
|
||||
static {
|
||||
WhatAnEnumB.values().each { WhatAnEnumB response ->
|
||||
MAP.put(response.intValue, response)
|
||||
}
|
||||
}
|
||||
}
|
||||
26
testdata-groovy/src/enums/WhatAnEnumB2.groovy
Normal file
26
testdata-groovy/src/enums/WhatAnEnumB2.groovy
Normal file
@@ -0,0 +1,26 @@
|
||||
package enums
|
||||
|
||||
enum WhatAnEnumB2 implements ExtensibleEnumB {
|
||||
|
||||
PETS_AT_THE_DISCO(1),
|
||||
JUMPING_INTO_A_HOOP(2),
|
||||
HAVING_A_NICE_TIME(3),
|
||||
LIVING_ON_A_LOG(4),
|
||||
WHAT_DID_YOU_DO(5),
|
||||
WOBBLE(6),
|
||||
UNKNOWN(0)
|
||||
|
||||
final int intValue
|
||||
|
||||
private WhatAnEnumB2(int intValue) {
|
||||
this.intValue = intValue
|
||||
}
|
||||
|
||||
private static final Map<Integer, WhatAnEnumB2> MAP = [:] as Map<Integer, WhatAnEnumB2>
|
||||
|
||||
static {
|
||||
WhatAnEnumB2.values().each { WhatAnEnumB2 response ->
|
||||
MAP.put(response.intValue, response)
|
||||
}
|
||||
}
|
||||
}
|
||||
6
testdata-groovy/src/simple/Back.groovy
Normal file
6
testdata-groovy/src/simple/Back.groovy
Normal file
@@ -0,0 +1,6 @@
|
||||
package simple
|
||||
|
||||
class Back {
|
||||
|
||||
int var = 35
|
||||
}
|
||||
9
testdata-groovy/src/simple/Back2.groovy
Normal file
9
testdata-groovy/src/simple/Back2.groovy
Normal file
@@ -0,0 +1,9 @@
|
||||
package simple
|
||||
|
||||
class Back2 {
|
||||
|
||||
int var = 35
|
||||
|
||||
int var2= 3355
|
||||
|
||||
}
|
||||
7
testdata-groovy/src/simple/Basic.groovy
Normal file
7
testdata-groovy/src/simple/Basic.groovy
Normal file
@@ -0,0 +1,7 @@
|
||||
package simple
|
||||
|
||||
class Basic {
|
||||
public String run() {
|
||||
return 'hello'
|
||||
}
|
||||
}
|
||||
8
testdata-groovy/src/simple/Basic2.groovy
Normal file
8
testdata-groovy/src/simple/Basic2.groovy
Normal file
@@ -0,0 +1,8 @@
|
||||
package simple
|
||||
|
||||
class Basic2 {
|
||||
public String run() {
|
||||
return 'goodbye'
|
||||
|
||||
}
|
||||
}
|
||||
11
testdata-groovy/src/simple/Basic3.groovy
Normal file
11
testdata-groovy/src/simple/Basic3.groovy
Normal file
@@ -0,0 +1,11 @@
|
||||
package simple
|
||||
|
||||
class Basic3 {
|
||||
public String run() {
|
||||
return getString();
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return 'abc'
|
||||
}
|
||||
}
|
||||
7
testdata-groovy/src/simple/Basic4.groovy
Normal file
7
testdata-groovy/src/simple/Basic4.groovy
Normal file
@@ -0,0 +1,7 @@
|
||||
package simple
|
||||
|
||||
class Basic4 implements Serializable {
|
||||
public String run() {
|
||||
return 'hello'
|
||||
}
|
||||
}
|
||||
11
testdata-groovy/src/simple/BasicB.groovy
Normal file
11
testdata-groovy/src/simple/BasicB.groovy
Normal file
@@ -0,0 +1,11 @@
|
||||
package simple
|
||||
|
||||
class BasicB {
|
||||
public static String run() {
|
||||
return getString();
|
||||
}
|
||||
|
||||
public static String getString() {
|
||||
return "hello"
|
||||
}
|
||||
}
|
||||
15
testdata-groovy/src/simple/BasicB2.groovy
Normal file
15
testdata-groovy/src/simple/BasicB2.groovy
Normal file
@@ -0,0 +1,15 @@
|
||||
package simple
|
||||
|
||||
class BasicB2 {
|
||||
public static String run() {
|
||||
return getOtherString();
|
||||
}
|
||||
|
||||
public static String getString() {
|
||||
return "hello"
|
||||
}
|
||||
|
||||
public static String getOtherString() {
|
||||
return "goodbye"
|
||||
}
|
||||
}
|
||||
11
testdata-groovy/src/simple/BasicC.groovy
Normal file
11
testdata-groovy/src/simple/BasicC.groovy
Normal file
@@ -0,0 +1,11 @@
|
||||
package simple
|
||||
|
||||
class BasicC {
|
||||
public String run() {
|
||||
return getString();
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return "hello"
|
||||
}
|
||||
}
|
||||
15
testdata-groovy/src/simple/BasicC2.groovy
Normal file
15
testdata-groovy/src/simple/BasicC2.groovy
Normal file
@@ -0,0 +1,15 @@
|
||||
package simple
|
||||
|
||||
class BasicC2 {
|
||||
public String run() {
|
||||
return getOtherString();
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return "hello"
|
||||
}
|
||||
|
||||
public String getOtherString() {
|
||||
return "goodbye"
|
||||
}
|
||||
}
|
||||
9
testdata-groovy/src/simple/BasicD.groovy
Normal file
9
testdata-groovy/src/simple/BasicD.groovy
Normal file
@@ -0,0 +1,9 @@
|
||||
package simple
|
||||
|
||||
class BasicD {
|
||||
|
||||
public String run() {
|
||||
return 'hello'
|
||||
}
|
||||
|
||||
}
|
||||
9
testdata-groovy/src/simple/BasicD2.groovy
Normal file
9
testdata-groovy/src/simple/BasicD2.groovy
Normal file
@@ -0,0 +1,9 @@
|
||||
package simple
|
||||
|
||||
class BasicD2 {
|
||||
|
||||
public String run() {
|
||||
return BasicDTarget2.getString()
|
||||
}
|
||||
|
||||
}
|
||||
7
testdata-groovy/src/simple/BasicDTarget.groovy
Normal file
7
testdata-groovy/src/simple/BasicDTarget.groovy
Normal file
@@ -0,0 +1,7 @@
|
||||
package simple
|
||||
|
||||
class BasicDTarget {
|
||||
|
||||
|
||||
|
||||
}
|
||||
7
testdata-groovy/src/simple/BasicDTarget2.groovy
Normal file
7
testdata-groovy/src/simple/BasicDTarget2.groovy
Normal file
@@ -0,0 +1,7 @@
|
||||
package simple
|
||||
|
||||
class BasicDTarget2 {
|
||||
|
||||
static String getString() { return 'abc' }
|
||||
|
||||
}
|
||||
12
testdata-groovy/src/simple/BasicE.groovy
Normal file
12
testdata-groovy/src/simple/BasicE.groovy
Normal file
@@ -0,0 +1,12 @@
|
||||
package simple
|
||||
|
||||
class BasicE {
|
||||
|
||||
public String run() {
|
||||
// BasicETarget t = new BasicETarget()
|
||||
|
||||
// return t.getString()
|
||||
return 'hello'
|
||||
}
|
||||
|
||||
}
|
||||
10
testdata-groovy/src/simple/BasicE2.groovy
Normal file
10
testdata-groovy/src/simple/BasicE2.groovy
Normal file
@@ -0,0 +1,10 @@
|
||||
package simple
|
||||
|
||||
class BasicE2 {
|
||||
|
||||
public String run() {
|
||||
BasicETarget t = new BasicETarget()
|
||||
return t.getString()
|
||||
}
|
||||
|
||||
}
|
||||
5
testdata-groovy/src/simple/BasicETarget.groovy
Normal file
5
testdata-groovy/src/simple/BasicETarget.groovy
Normal file
@@ -0,0 +1,5 @@
|
||||
package simple
|
||||
|
||||
class BasicETarget {
|
||||
|
||||
}
|
||||
7
testdata-groovy/src/simple/BasicETarget2.groovy
Normal file
7
testdata-groovy/src/simple/BasicETarget2.groovy
Normal file
@@ -0,0 +1,7 @@
|
||||
package simple
|
||||
|
||||
class BasicETarget2 {
|
||||
|
||||
String getString() { return 'foobar' }
|
||||
|
||||
}
|
||||
10
testdata-groovy/src/simple/BasicF.groovy
Normal file
10
testdata-groovy/src/simple/BasicF.groovy
Normal file
@@ -0,0 +1,10 @@
|
||||
package simple
|
||||
|
||||
class BasicF {
|
||||
|
||||
public String run() {
|
||||
BasicFTarget t = new BasicFTarget()
|
||||
return t.getString()
|
||||
}
|
||||
|
||||
}
|
||||
8
testdata-groovy/src/simple/BasicFTarget.groovy
Normal file
8
testdata-groovy/src/simple/BasicFTarget.groovy
Normal file
@@ -0,0 +1,8 @@
|
||||
package simple
|
||||
|
||||
class BasicFTarget {
|
||||
int d= 4456;
|
||||
public String getString() {
|
||||
return '123'
|
||||
}
|
||||
}
|
||||
5
testdata-groovy/src/simple/BasicFTarget2.groovy
Normal file
5
testdata-groovy/src/simple/BasicFTarget2.groovy
Normal file
@@ -0,0 +1,5 @@
|
||||
package simple
|
||||
|
||||
class BasicFTarget2 {
|
||||
|
||||
}
|
||||
9
testdata-groovy/src/simple/BasicFTarget4.groovy
Normal file
9
testdata-groovy/src/simple/BasicFTarget4.groovy
Normal file
@@ -0,0 +1,9 @@
|
||||
package simple
|
||||
|
||||
class BasicFTarget4 {
|
||||
int d = 4456;
|
||||
|
||||
int getString() {
|
||||
return d
|
||||
}
|
||||
}
|
||||
9
testdata-groovy/src/simple/BasicG.groovy
Normal file
9
testdata-groovy/src/simple/BasicG.groovy
Normal file
@@ -0,0 +1,9 @@
|
||||
package simple
|
||||
|
||||
class BasicG {
|
||||
|
||||
public String run() {
|
||||
return BasicGTarget.foo()
|
||||
}
|
||||
|
||||
}
|
||||
5
testdata-groovy/src/simple/BasicGTarget.groovy
Normal file
5
testdata-groovy/src/simple/BasicGTarget.groovy
Normal file
@@ -0,0 +1,5 @@
|
||||
package simple
|
||||
|
||||
class BasicGTarget {
|
||||
|
||||
}
|
||||
7
testdata-groovy/src/simple/BasicGTarget2.groovy
Normal file
7
testdata-groovy/src/simple/BasicGTarget2.groovy
Normal file
@@ -0,0 +1,7 @@
|
||||
package simple
|
||||
|
||||
class BasicGTarget2 {
|
||||
|
||||
static String foo() { return 'hw' }
|
||||
|
||||
}
|
||||
25
testdata-groovy/src/simple/BasicH.groovy
Normal file
25
testdata-groovy/src/simple/BasicH.groovy
Normal file
@@ -0,0 +1,25 @@
|
||||
package simple
|
||||
|
||||
class BasicH {
|
||||
|
||||
public String run() {
|
||||
// warmup
|
||||
for (int i=0;i<100000;i++) {
|
||||
m();
|
||||
}
|
||||
// measure
|
||||
long l = System.currentTimeMillis()
|
||||
for (int i=0;i<1000000;i++) {
|
||||
m();
|
||||
}
|
||||
return Long.toString(System.currentTimeMillis()-l);
|
||||
}
|
||||
|
||||
public void m() {
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
println new BasicH().run();
|
||||
}
|
||||
}
|
||||
17
testdata-groovy/src/simple/BasicWithClosure.groovy
Normal file
17
testdata-groovy/src/simple/BasicWithClosure.groovy
Normal file
@@ -0,0 +1,17 @@
|
||||
package simple
|
||||
|
||||
class BasicWithClosure {
|
||||
|
||||
def clos =null;
|
||||
|
||||
public String run() {
|
||||
clos = { println "hello!" }
|
||||
print "Executing:"
|
||||
clos()
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BasicWithClosure().run();
|
||||
}
|
||||
|
||||
}
|
||||
17
testdata-groovy/src/simple/BasicWithClosure2.groovy
Normal file
17
testdata-groovy/src/simple/BasicWithClosure2.groovy
Normal file
@@ -0,0 +1,17 @@
|
||||
package simple
|
||||
|
||||
class BasicWithClosure2 {
|
||||
|
||||
def clos = null;
|
||||
|
||||
public String run() {
|
||||
clos = { println "hello!" }
|
||||
print "Executing:"
|
||||
clos()
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BasicWithClosure2().run();
|
||||
}
|
||||
|
||||
}
|
||||
17
testdata-groovy/src/simple/BasicWithClosure3.groovy
Normal file
17
testdata-groovy/src/simple/BasicWithClosure3.groovy
Normal file
@@ -0,0 +1,17 @@
|
||||
package simple
|
||||
|
||||
class BasicWithClosure3 {
|
||||
|
||||
def clos = null;
|
||||
|
||||
public String run() {
|
||||
clos = { println "goodbye!" }
|
||||
print "Executing:"
|
||||
clos()
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BasicWithClosure3().run();
|
||||
}
|
||||
|
||||
}
|
||||
16
testdata-groovy/src/simple/BasicWithClosureB.groovy
Normal file
16
testdata-groovy/src/simple/BasicWithClosureB.groovy
Normal file
@@ -0,0 +1,16 @@
|
||||
package simple
|
||||
|
||||
class BasicWithClosureB {
|
||||
|
||||
def clos = { println "hello!" }
|
||||
|
||||
public String run() {
|
||||
print "Executing:"
|
||||
clos()
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BasicWithClosureB().run();
|
||||
}
|
||||
|
||||
}
|
||||
16
testdata-groovy/src/simple/BasicWithClosureB2.groovy
Normal file
16
testdata-groovy/src/simple/BasicWithClosureB2.groovy
Normal file
@@ -0,0 +1,16 @@
|
||||
package simple
|
||||
|
||||
class BasicWithClosureB2 {
|
||||
|
||||
def clos = { println "hello!" }
|
||||
|
||||
public String run() {
|
||||
print "Executing:"
|
||||
clos()
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BasicWithClosureB2().run();
|
||||
}
|
||||
|
||||
}
|
||||
16
testdata-groovy/src/simple/BasicWithClosureB3.groovy
Normal file
16
testdata-groovy/src/simple/BasicWithClosureB3.groovy
Normal file
@@ -0,0 +1,16 @@
|
||||
package simple
|
||||
|
||||
class BasicWithClosureB3 {
|
||||
|
||||
def clos = { println "goodbye!" }
|
||||
|
||||
public String run() {
|
||||
print "Executing:"
|
||||
clos()
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BasicWithClosureB3().run();
|
||||
}
|
||||
|
||||
}
|
||||
31
testdata-groovy/src/simple/BasicWithClosureC.groovy
Normal file
31
testdata-groovy/src/simple/BasicWithClosureC.groovy
Normal file
@@ -0,0 +1,31 @@
|
||||
package simple
|
||||
|
||||
class BasicWithClosureC {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BasicWithClosureC().run();
|
||||
}
|
||||
|
||||
public String run() {
|
||||
foo()
|
||||
doit {
|
||||
doitInner {
|
||||
println 'in closure'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doit(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
public void doitInner(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
|
||||
public void foo() {
|
||||
println 'foo() running'
|
||||
}
|
||||
|
||||
}
|
||||
31
testdata-groovy/src/simple/BasicWithClosureC2.groovy
Normal file
31
testdata-groovy/src/simple/BasicWithClosureC2.groovy
Normal file
@@ -0,0 +1,31 @@
|
||||
package simple
|
||||
|
||||
class BasicWithClosureC2 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BasicWithClosureC2().run();
|
||||
}
|
||||
|
||||
public String run() {
|
||||
doit {
|
||||
doitInner {
|
||||
println 'in closure'
|
||||
foo() // moved from top of run() method to here
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doit(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
public void doitInner(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
|
||||
public void foo() {
|
||||
println 'foo() running'
|
||||
}
|
||||
|
||||
}
|
||||
38
testdata-groovy/src/simple/BasicWithClosureD.groovy
Normal file
38
testdata-groovy/src/simple/BasicWithClosureD.groovy
Normal file
@@ -0,0 +1,38 @@
|
||||
package simple
|
||||
|
||||
class BasicWithClosureD {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BasicWithClosureD().run();
|
||||
}
|
||||
|
||||
public void xxx() {
|
||||
|
||||
}
|
||||
|
||||
public String run() {
|
||||
foo()
|
||||
String sone = "abc"
|
||||
String stwo = "def"
|
||||
// doit {
|
||||
doitInner {
|
||||
println 'string is '+sone
|
||||
print "owner is "+(getOwner()==null?"null":"not null")
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public void doit(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
public void doitInner(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
|
||||
public void foo() {
|
||||
println 'foo() running'
|
||||
}
|
||||
|
||||
}
|
||||
34
testdata-groovy/src/simple/BasicWithClosureD2.groovy
Normal file
34
testdata-groovy/src/simple/BasicWithClosureD2.groovy
Normal file
@@ -0,0 +1,34 @@
|
||||
package simple
|
||||
|
||||
class BasicWithClosureD2 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BasicWithClosureD2().run();
|
||||
}
|
||||
|
||||
public String run() {
|
||||
foo()
|
||||
String sone = "abc"
|
||||
String stwo = "def"
|
||||
// doit {
|
||||
doitInner {
|
||||
println 'string is '+stwo
|
||||
print "owner is "+(getOwner()==null?"null":"not null")
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public void doit(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
public void doitInner(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
|
||||
public void foo() {
|
||||
println 'foo() running'
|
||||
}
|
||||
|
||||
}
|
||||
38
testdata-groovy/src/simple/BasicWithClosureE.groovy
Normal file
38
testdata-groovy/src/simple/BasicWithClosureE.groovy
Normal file
@@ -0,0 +1,38 @@
|
||||
package simple
|
||||
|
||||
class BasicWithClosureE {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BasicWithClosureE().run();
|
||||
}
|
||||
|
||||
public void xxx() {
|
||||
|
||||
}
|
||||
|
||||
public String run() {
|
||||
foo()
|
||||
String sone = "abc"
|
||||
String stwo = "def"
|
||||
// doit {
|
||||
doitInner {
|
||||
println 'string is '+sone
|
||||
print "owner is "+(getOwner()==null?"null":"not null")
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public void doit(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
public void doitInner(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
|
||||
public void foo() {
|
||||
println 'foo() running'
|
||||
}
|
||||
|
||||
}
|
||||
38
testdata-groovy/src/simple/BasicWithClosureE2.groovy
Normal file
38
testdata-groovy/src/simple/BasicWithClosureE2.groovy
Normal file
@@ -0,0 +1,38 @@
|
||||
package simple
|
||||
|
||||
class BasicWithClosureE2 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BasicWithClosureE2().run();
|
||||
}
|
||||
|
||||
public void xxx() {
|
||||
|
||||
}
|
||||
|
||||
public String run() {
|
||||
foo()
|
||||
String sone = "abc"
|
||||
String stwo = "def"
|
||||
// doit {
|
||||
doitInner {
|
||||
println 'string is '+sone+" "+stwo
|
||||
print "owner is "+(getOwner()==null?"null":"not null")
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public void doit(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
public void doitInner(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
|
||||
public void foo() {
|
||||
println 'foo() running'
|
||||
}
|
||||
|
||||
}
|
||||
38
testdata-groovy/src/simple/BasicWithClosureE3.groovy
Normal file
38
testdata-groovy/src/simple/BasicWithClosureE3.groovy
Normal file
@@ -0,0 +1,38 @@
|
||||
package simple
|
||||
|
||||
class BasicWithClosureE3 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new BasicWithClosureE3().run();
|
||||
}
|
||||
|
||||
public void xxx() {
|
||||
|
||||
}
|
||||
|
||||
public String run() {
|
||||
foo()
|
||||
String sone = "xyz"
|
||||
String stwo = "def"
|
||||
// doit {
|
||||
doitInner {
|
||||
println 'string is '+sone
|
||||
print "owner is "+(getOwner()==null?"null":"not null")
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public void doit(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
public void doitInner(Closure c) {
|
||||
c.call()
|
||||
}
|
||||
|
||||
|
||||
public void foo() {
|
||||
println 'foo() running'
|
||||
}
|
||||
|
||||
}
|
||||
7
testdata-groovy/src/simple/CopyOfBasicD.groovy
Normal file
7
testdata-groovy/src/simple/CopyOfBasicD.groovy
Normal file
@@ -0,0 +1,7 @@
|
||||
package simple
|
||||
|
||||
class CopyOfBasicD {
|
||||
public String run() {
|
||||
}
|
||||
|
||||
}
|
||||
13
testdata-groovy/src/simple/Front.groovy
Normal file
13
testdata-groovy/src/simple/Front.groovy
Normal file
@@ -0,0 +1,13 @@
|
||||
package simple
|
||||
|
||||
class Front {
|
||||
Back b = new Back()
|
||||
|
||||
public Object run() {
|
||||
return b.var
|
||||
}
|
||||
|
||||
public Object run2() {
|
||||
return b.var2
|
||||
}
|
||||
}
|
||||
14
testdata-groovy/src/simple/LFront.groovy
Normal file
14
testdata-groovy/src/simple/LFront.groovy
Normal file
@@ -0,0 +1,14 @@
|
||||
package simple
|
||||
|
||||
class LFront {
|
||||
|
||||
public Object run() {
|
||||
String x = "abc";
|
||||
return x;
|
||||
}
|
||||
|
||||
public Object run2() {
|
||||
int i = 99;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
14
testdata-groovy/src/simple/LFront2.groovy
Normal file
14
testdata-groovy/src/simple/LFront2.groovy
Normal file
@@ -0,0 +1,14 @@
|
||||
package simple
|
||||
|
||||
class LFront2 {
|
||||
|
||||
public Object run() {
|
||||
String x = "xxx";
|
||||
return x;
|
||||
}
|
||||
|
||||
public Object run2() {
|
||||
int i = 88;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
30
testdata-groovy/src/simple/SelfReflector.groovy
Normal file
30
testdata-groovy/src/simple/SelfReflector.groovy
Normal file
@@ -0,0 +1,30 @@
|
||||
package simple
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
class SelfReflector {
|
||||
|
||||
public static void main(String[] args) {
|
||||
println run();
|
||||
}
|
||||
public int i
|
||||
|
||||
public static String run() {
|
||||
StringBuilder s = new StringBuilder()
|
||||
Field[] fs = getFields()
|
||||
List<String> names = new ArrayList<String>()
|
||||
for (Field f: fs) {
|
||||
names.add(f.getName());
|
||||
}
|
||||
Collections.sort(names);
|
||||
s.append(names.size()).append(" ");
|
||||
for (String n: names) {
|
||||
s.append(n).append(" ");
|
||||
}
|
||||
return s.toString().trim();
|
||||
}
|
||||
|
||||
public static Field[] getFields() {
|
||||
return SelfReflector.class.getDeclaredFields();
|
||||
}
|
||||
}
|
||||
9
testdata-groovy/src/simple/Values.groovy
Normal file
9
testdata-groovy/src/simple/Values.groovy
Normal file
@@ -0,0 +1,9 @@
|
||||
package simple
|
||||
|
||||
class Values {
|
||||
|
||||
public Integer run() {
|
||||
return 123
|
||||
}
|
||||
|
||||
}
|
||||
9
testdata-groovy/src/simple/Values2.groovy
Normal file
9
testdata-groovy/src/simple/Values2.groovy
Normal file
@@ -0,0 +1,9 @@
|
||||
package simple
|
||||
|
||||
class Values2 {
|
||||
|
||||
public Integer run() {
|
||||
return 456
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user