renamed all modules

This commit is contained in:
Andy Clement
2014-01-15 11:36:24 -08:00
parent 342420b2ed
commit ceef61cf98
1055 changed files with 301 additions and 259 deletions

View 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'
}
}

View 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'
}
}

View File

@@ -0,0 +1,10 @@
package clinitg;
public class FourHelper {
public static void doo() {
print 'a'
}
}

View File

@@ -0,0 +1,10 @@
package clinitg;
public class One {
public static int i = 5;
public static String run() {
return Integer.toString(i);
}
}

View File

@@ -0,0 +1,10 @@
package clinitg;
public class One2 {
public static int i = 7;
public static String run() {
return Integer.toString(i);
}
}

View File

@@ -0,0 +1,10 @@
package clinitg;
public class Three {
// i have no clinit
public static String run() {
return "1";
}
}

View File

@@ -0,0 +1,10 @@
package clinitg;
public class Three2 {
// still no clinit
public static String run() {
return "1";
}
}

View File

@@ -0,0 +1,13 @@
package clinitg;
public class Three3 {
static int i;
{
i = 4;
}
public static String run() {
return Integer.toString(i);
}
}

View File

@@ -0,0 +1,10 @@
package clinitg;
public class Two {
public final static int i = 55;
public static String run() {
return Integer.toString(i);
}
}

View File

@@ -0,0 +1,10 @@
package clinitg;
public class Two2 {
public final static int i = 99;
public static String run() {
return Integer.toString(i);
}
}

View 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")
// }
// }
// }
}

View 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")
// }
// }
// }
}

View 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")
// }
// }
// }
}

View File

@@ -0,0 +1,7 @@
package enums
interface ExtensibleEnum {
int getIntValue()
}

View File

@@ -0,0 +1,7 @@
package enums
interface ExtensibleEnum3 {
int getValue()
}

View File

@@ -0,0 +1,7 @@
package enums
interface ExtensibleEnumB {
int getIntValue()
}

View 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);
}
}

View 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);
}
}

View 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)
// }
// }
}

View 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)
// }
// }
}

View 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)
}
}
}

View 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)
}
}
}

View 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)
}
}
}

View File

@@ -0,0 +1,6 @@
package simple
class Back {
int var = 35
}

View File

@@ -0,0 +1,9 @@
package simple
class Back2 {
int var = 35
int var2= 3355
}

View File

@@ -0,0 +1,7 @@
package simple
class Basic {
public String run() {
return 'hello'
}
}

View File

@@ -0,0 +1,8 @@
package simple
class Basic2 {
public String run() {
return 'goodbye'
}
}

View File

@@ -0,0 +1,11 @@
package simple
class Basic3 {
public String run() {
return getString();
}
public String getString() {
return 'abc'
}
}

View File

@@ -0,0 +1,7 @@
package simple
class Basic4 implements Serializable {
public String run() {
return 'hello'
}
}

View File

@@ -0,0 +1,11 @@
package simple
class BasicB {
public static String run() {
return getString();
}
public static String getString() {
return "hello"
}
}

View 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"
}
}

View File

@@ -0,0 +1,11 @@
package simple
class BasicC {
public String run() {
return getString();
}
public String getString() {
return "hello"
}
}

View File

@@ -0,0 +1,15 @@
package simple
class BasicC2 {
public String run() {
return getOtherString();
}
public String getString() {
return "hello"
}
public String getOtherString() {
return "goodbye"
}
}

View File

@@ -0,0 +1,9 @@
package simple
class BasicD {
public String run() {
return 'hello'
}
}

View File

@@ -0,0 +1,9 @@
package simple
class BasicD2 {
public String run() {
return BasicDTarget2.getString()
}
}

View File

@@ -0,0 +1,7 @@
package simple
class BasicDTarget {
}

View File

@@ -0,0 +1,7 @@
package simple
class BasicDTarget2 {
static String getString() { return 'abc' }
}

View File

@@ -0,0 +1,12 @@
package simple
class BasicE {
public String run() {
// BasicETarget t = new BasicETarget()
// return t.getString()
return 'hello'
}
}

View File

@@ -0,0 +1,10 @@
package simple
class BasicE2 {
public String run() {
BasicETarget t = new BasicETarget()
return t.getString()
}
}

View File

@@ -0,0 +1,5 @@
package simple
class BasicETarget {
}

View File

@@ -0,0 +1,7 @@
package simple
class BasicETarget2 {
String getString() { return 'foobar' }
}

View File

@@ -0,0 +1,10 @@
package simple
class BasicF {
public String run() {
BasicFTarget t = new BasicFTarget()
return t.getString()
}
}

View File

@@ -0,0 +1,8 @@
package simple
class BasicFTarget {
int d= 4456;
public String getString() {
return '123'
}
}

View File

@@ -0,0 +1,5 @@
package simple
class BasicFTarget2 {
}

View File

@@ -0,0 +1,9 @@
package simple
class BasicFTarget4 {
int d = 4456;
int getString() {
return d
}
}

View File

@@ -0,0 +1,9 @@
package simple
class BasicG {
public String run() {
return BasicGTarget.foo()
}
}

View File

@@ -0,0 +1,5 @@
package simple
class BasicGTarget {
}

View File

@@ -0,0 +1,7 @@
package simple
class BasicGTarget2 {
static String foo() { return 'hw' }
}

View 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();
}
}

View 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();
}
}

View 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();
}
}

View 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();
}
}

View 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();
}
}

View 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();
}
}

View 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();
}
}

View 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'
}
}

View 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'
}
}

View 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'
}
}

View 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'
}
}

View 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'
}
}

View 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'
}
}

View 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'
}
}

View File

@@ -0,0 +1,7 @@
package simple
class CopyOfBasicD {
public String run() {
}
}

View 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
}
}

View 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;
}
}

View 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;
}
}

View 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();
}
}

View File

@@ -0,0 +1,9 @@
package simple
class Values {
public Integer run() {
return 123
}
}

View File

@@ -0,0 +1,9 @@
package simple
class Values2 {
public Integer run() {
return 456
}
}