diff options
| author | 2016-06-30 00:49:21 +1000 | |
|---|---|---|
| committer | 2016-06-30 00:49:21 +1000 | |
| commit | 4be005617b3b8c3578cca07c5d085d12916f0d1d (patch) | |
| tree | db163431f38703e26da417ef05eaea2b27a498b9 /src/test/java/cuchaz/enigma/inputs/translation | |
| parent | Some small changes to fix idea importing (diff) | |
| download | enigma-fork-4be005617b3b8c3578cca07c5d085d12916f0d1d.tar.gz enigma-fork-4be005617b3b8c3578cca07c5d085d12916f0d1d.tar.xz enigma-fork-4be005617b3b8c3578cca07c5d085d12916f0d1d.zip | |
Json format (#2)
* Added new format
* Fixed bug
* Updated Version
Diffstat (limited to 'src/test/java/cuchaz/enigma/inputs/translation')
9 files changed, 282 insertions, 0 deletions
diff --git a/src/test/java/cuchaz/enigma/inputs/translation/A_Basic.java b/src/test/java/cuchaz/enigma/inputs/translation/A_Basic.java new file mode 100644 index 0000000..26acac8 --- /dev/null +++ b/src/test/java/cuchaz/enigma/inputs/translation/A_Basic.java | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.inputs.translation; | ||
| 12 | |||
| 13 | public class A_Basic { | ||
| 14 | |||
| 15 | public int one; | ||
| 16 | public float two; | ||
| 17 | public String three; | ||
| 18 | |||
| 19 | public void m1() { | ||
| 20 | } | ||
| 21 | |||
| 22 | public int m2() { | ||
| 23 | return 42; | ||
| 24 | } | ||
| 25 | |||
| 26 | public void m3(int a1) { | ||
| 27 | } | ||
| 28 | |||
| 29 | public int m4(int a1) { | ||
| 30 | return 5; // chosen by fair die roll, guaranteed to be random | ||
| 31 | } | ||
| 32 | } | ||
diff --git a/src/test/java/cuchaz/enigma/inputs/translation/B_BaseClass.java b/src/test/java/cuchaz/enigma/inputs/translation/B_BaseClass.java new file mode 100644 index 0000000..035e329 --- /dev/null +++ b/src/test/java/cuchaz/enigma/inputs/translation/B_BaseClass.java | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.inputs.translation; | ||
| 12 | |||
| 13 | public class B_BaseClass { | ||
| 14 | |||
| 15 | public int f1; | ||
| 16 | public char f2; | ||
| 17 | |||
| 18 | public int m1() { | ||
| 19 | return 5; | ||
| 20 | } | ||
| 21 | |||
| 22 | public int m2() { | ||
| 23 | return 42; | ||
| 24 | } | ||
| 25 | } | ||
diff --git a/src/test/java/cuchaz/enigma/inputs/translation/C_SubClass.java b/src/test/java/cuchaz/enigma/inputs/translation/C_SubClass.java new file mode 100644 index 0000000..6026a8d --- /dev/null +++ b/src/test/java/cuchaz/enigma/inputs/translation/C_SubClass.java | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.inputs.translation; | ||
| 12 | |||
| 13 | public class C_SubClass extends B_BaseClass { | ||
| 14 | |||
| 15 | public char f2; // shadows B_BaseClass.f2 | ||
| 16 | public int f3; | ||
| 17 | public int f4; | ||
| 18 | |||
| 19 | @Override | ||
| 20 | public int m1() { | ||
| 21 | return 32; | ||
| 22 | } | ||
| 23 | |||
| 24 | public int m3() { | ||
| 25 | return 7; | ||
| 26 | } | ||
| 27 | } | ||
diff --git a/src/test/java/cuchaz/enigma/inputs/translation/D_AnonymousTesting.java b/src/test/java/cuchaz/enigma/inputs/translation/D_AnonymousTesting.java new file mode 100644 index 0000000..a1827f9 --- /dev/null +++ b/src/test/java/cuchaz/enigma/inputs/translation/D_AnonymousTesting.java | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.inputs.translation; | ||
| 12 | |||
| 13 | import java.util.ArrayList; | ||
| 14 | import java.util.List; | ||
| 15 | |||
| 16 | public class D_AnonymousTesting { | ||
| 17 | |||
| 18 | public List<Object> getObjs() { | ||
| 19 | List<Object> objs = new ArrayList<Object>(); | ||
| 20 | objs.add(new Object() { | ||
| 21 | @Override | ||
| 22 | public String toString() { | ||
| 23 | return "Object!"; | ||
| 24 | } | ||
| 25 | }); | ||
| 26 | return objs; | ||
| 27 | } | ||
| 28 | } | ||
diff --git a/src/test/java/cuchaz/enigma/inputs/translation/E_Bridges.java b/src/test/java/cuchaz/enigma/inputs/translation/E_Bridges.java new file mode 100644 index 0000000..769eb70 --- /dev/null +++ b/src/test/java/cuchaz/enigma/inputs/translation/E_Bridges.java | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.inputs.translation; | ||
| 12 | |||
| 13 | import java.util.Iterator; | ||
| 14 | |||
| 15 | |||
| 16 | public class E_Bridges implements Iterator<Object> { | ||
| 17 | |||
| 18 | @Override | ||
| 19 | public boolean hasNext() { | ||
| 20 | return false; | ||
| 21 | } | ||
| 22 | |||
| 23 | @Override | ||
| 24 | public String next() { | ||
| 25 | // the compiler will generate a bridge for this method | ||
| 26 | return "foo"; | ||
| 27 | } | ||
| 28 | |||
| 29 | @Override | ||
| 30 | public void remove() { | ||
| 31 | } | ||
| 32 | } | ||
diff --git a/src/test/java/cuchaz/enigma/inputs/translation/F_ObjectMethods.java b/src/test/java/cuchaz/enigma/inputs/translation/F_ObjectMethods.java new file mode 100644 index 0000000..32c246c --- /dev/null +++ b/src/test/java/cuchaz/enigma/inputs/translation/F_ObjectMethods.java | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.inputs.translation; | ||
| 12 | |||
| 13 | public class F_ObjectMethods { | ||
| 14 | |||
| 15 | public void callEmAll() | ||
| 16 | throws Throwable { | ||
| 17 | clone(); | ||
| 18 | equals(this); | ||
| 19 | finalize(); | ||
| 20 | getClass(); | ||
| 21 | hashCode(); | ||
| 22 | notify(); | ||
| 23 | notifyAll(); | ||
| 24 | toString(); | ||
| 25 | wait(); | ||
| 26 | wait(0); | ||
| 27 | wait(0, 0); | ||
| 28 | } | ||
| 29 | } | ||
diff --git a/src/test/java/cuchaz/enigma/inputs/translation/G_OuterClass.java b/src/test/java/cuchaz/enigma/inputs/translation/G_OuterClass.java new file mode 100644 index 0000000..a2e0daf --- /dev/null +++ b/src/test/java/cuchaz/enigma/inputs/translation/G_OuterClass.java | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.inputs.translation; | ||
| 12 | |||
| 13 | |||
| 14 | public class G_OuterClass { | ||
| 15 | |||
| 16 | public class A_InnerClass { | ||
| 17 | |||
| 18 | public int f1; | ||
| 19 | public String f2; | ||
| 20 | |||
| 21 | public void m1() {} | ||
| 22 | |||
| 23 | public class A_InnerInnerClass { | ||
| 24 | |||
| 25 | public int f3; | ||
| 26 | |||
| 27 | public void m2() {} | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | public class B_NamelessClass { | ||
| 32 | public class A_NamedInnerClass { | ||
| 33 | public int f4; | ||
| 34 | } | ||
| 35 | } | ||
| 36 | } | ||
diff --git a/src/test/java/cuchaz/enigma/inputs/translation/H_NamelessClass.java b/src/test/java/cuchaz/enigma/inputs/translation/H_NamelessClass.java new file mode 100644 index 0000000..1b718a5 --- /dev/null +++ b/src/test/java/cuchaz/enigma/inputs/translation/H_NamelessClass.java | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.inputs.translation; | ||
| 12 | |||
| 13 | |||
| 14 | public class H_NamelessClass { | ||
| 15 | |||
| 16 | public class A_InnerClass { | ||
| 17 | |||
| 18 | public int f1; | ||
| 19 | public String f2; | ||
| 20 | |||
| 21 | public void m1() {} | ||
| 22 | |||
| 23 | public class A_InnerInnerClass { | ||
| 24 | |||
| 25 | public int f3; | ||
| 26 | |||
| 27 | public void m2() {} | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | public class B_NamelessClass { | ||
| 32 | public class A_NamedInnerClass { | ||
| 33 | public int f4; | ||
| 34 | public class A_AnotherInnerClass {} | ||
| 35 | public class B_YetAnotherInnerClass {} | ||
| 36 | } | ||
| 37 | } | ||
| 38 | } | ||
diff --git a/src/test/java/cuchaz/enigma/inputs/translation/I_Generics.java b/src/test/java/cuchaz/enigma/inputs/translation/I_Generics.java new file mode 100644 index 0000000..3490f9d --- /dev/null +++ b/src/test/java/cuchaz/enigma/inputs/translation/I_Generics.java | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.inputs.translation; | ||
| 12 | |||
| 13 | import java.util.List; | ||
| 14 | import java.util.Map; | ||
| 15 | |||
| 16 | |||
| 17 | public class I_Generics { | ||
| 18 | |||
| 19 | public class A_Type { | ||
| 20 | } | ||
| 21 | |||
| 22 | public List<Integer> f1; | ||
| 23 | public List<A_Type> f2; | ||
| 24 | public Map<A_Type,A_Type> f3; | ||
| 25 | |||
| 26 | public class B_Generic<T> { | ||
| 27 | public T f4; | ||
| 28 | public T m1() { | ||
| 29 | return null; | ||
| 30 | } | ||
| 31 | } | ||
| 32 | |||
| 33 | public B_Generic<Integer> f5; | ||
| 34 | public B_Generic<A_Type> f6; | ||
| 35 | } | ||