diff --git a/.classpath b/.classpath deleted file mode 100644 index dcec888..0000000 --- a/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.gitignore b/.gitignore deleted file mode 100644 index c48a1b8..0000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -bin/ -dist/full/ -dist/obfuscated/ diff --git a/.project b/.project deleted file mode 100644 index b2139d6..0000000 --- a/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Fernflower - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index b1ddd34..0000000 --- a/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding//test/test/misc/en/InnerTest.java=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab1..0000000 --- a/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/dist/docs/license_en.txt b/dist/docs/license_en.txt deleted file mode 100644 index 4789841..0000000 --- a/dist/docs/license_en.txt +++ /dev/null @@ -1,51 +0,0 @@ -Fernflower Freeware License 1.0 - -This license applies to the Fernflower decompiler (hereafter “Software") -including any associated files, information and examples. - -You are hereby granted a non-exclusive and non-transferable license to -use and distribute the Software in binary form according to the following -terms and conditions. - - -1) Copies and Redistribution - -You may copy and distribute unmodified binary copies of the Software -provided that you keep this license intact. You must NOT charge money -or fees for the Software except to cover the absolutely necessary -distribution costs. - -Any other form of redistribution is prohibited. Especially you are not -allowed to redistribute the Software as part of any other software -collection or other product. - - -2) Use - -You may use the Software "as is" in any commercial or non-commercial environment -for any purpose. - - -3) Contact Information - -The sole author and owner of Fernflower is Stiver. Address all correspondence regarding -this license to: - -fernflower.decompiler@gmail.com - -http://www.reversed-java.com - - -4) Disclaimer of Warranty - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/dist/docs/lizenz_de.txt b/dist/docs/lizenz_de.txt deleted file mode 100644 index a961e05..0000000 --- a/dist/docs/lizenz_de.txt +++ /dev/null @@ -1,62 +0,0 @@ -Fernflower Freeware Lizenz 1.0 - -Gegenstand der vorliegenden Lizenz ist der Fernflower Decompiler (im Folgenden "Software" genannt) -einschließlich aller dazu gehörenden Dateien, Informationen und Beispiele. - -Hiermit erhalten Sie eine nicht-ausschließliche und nicht-übertragbare Lizenz -für die Nutzung und Weitergabe der Software gemäß den nachfolgenden -Bedingungen. - - -1) Kopieren und Weitergeben - -Sie dürfen die Software kopieren und exakte Binärkopien unverändert -weitergeben, vorausgesetzt, diese Lizenz bleibt in der ursprünglichen Form -erhalten. Sie dürfen KEINE wie auch immer geartete Bezahlung oder Gebühren -für die Software verlangen, außer um die absolut unvermeidbaren Selbstkosten -der Weitergabe zu decken. - -Jede andere Form der Weitergabe ist untersagt. Insbesondere ist es nicht gestattet, -die Software als Teil einer anderen Softwaresammlung oder eines anderen Produktes -weiterzugeben. - - -2) Nutzung - -Sie können die Software beliebig in jeder kommerziellen oder nicht-kommerziellen Umgebung -zu jedem Zweck einsetzen. - - -3) Kontaktinformation - -Der einzige Autor und Eigentümer von Fernflower ist Stiver. Alle Rückfragen bezüglich dieser Lizenz -sind an - -fernflower.decompiler@gmail.com - -http://www.reversed-java.com - -zu richten. - - -4) GARANTIE- UND HAFTUNGSBESCHRÄNKUNGEN - -DIESE SOFTWARE WIRD IHNEN AUF DER GRUNDLAGE DES GEGENWÄRTIGEN ZUSTANDS ZUR -VERFÃœGUNG GESTELLT. ES GIBT KEINE GARANTIE, WEDER AUSDRÃœCKLICH NOCH IMPLIZIT. -DIES SCHLIEßT AUCH GARANTIEANSPRÃœCHE BEZÃœGLICH DER VERKAUFSQUALITÄT, -VERKÄUFLICHKEIT ODER EIGNUNG FÃœR EINEN BESTIMMTEN ZWECk AUS, ODER SOLCHE, DIE -DURCH GELTENDES RECHT, GESETZLICHE VORSCHRIFTEN, GESCHÄFTSGEBRAUCH ODER -HANDELSVERKEHR VERURSACHT WERDEN. DAS GESAMTE RISIKO IN BEZUG AUF DIE ERGEBNISSE -UND DIE LEISTUNG DES PROGRAMMS LIEGT BEI IHNEN. WEDER DER AUTOR NOCH IRGENDEIN -AN DEM PROJEKT BETEILIGTER HAT IRGENDEINE HAFTUNGSVERPFLICHTUNG IHNEN ODER -IRGENDEINER ANDEREN PERSON ODER INSTITUTION GEGENÃœBER FÃœR JEDWEDE INDIREKTE, -ZUFÄLLIGE, BESONDERE SCHÄDEN ODER IRGENDWELCHE FOLGESCHÄDEN. DIES GILT AUCH FÃœR -SCHÄDEN AUS ENTGANGENEM GEWINN, VERLORENEN ODER BESCHÄDIGTEN DATEN ODER FÃœR -ANDERE KOMMERZIELLE ODER WIRTSCHAFTLICHE VERLUSTE, SELBST DANN, WENN DER AUTOR -ODER IRGENDEIN AN DEM PROJEKT BETEILIGTER AUF DIE MÖGLICHKEIT DERARTIGER SCHÄDEN -HINGEWIESEN WURDE ODER DIESE VORHERSEHBAR WAREN, ODER FÃœR ANSPRÃœCHE DRITTER. DIE -HIER FESTGELEGTEN HAFTUNGSBESCHRÄNKUNGEN GELTEN UNABHÄNGUG DAVON, OB DER VERMEINTLICHE -ODER TATSÄCHLICHE VERTRAGSBRUCH EINE GRUNDSÄTZLICHE BEDINGUNG ODER -VERTRAGSVEREINBARUNG BERÃœHRT, ODER EIN GRUNDSÄTZLICHER VERTRAGSBRUCH IST. DIESER -ABSATZ IST EIN ESSENZIELLER TEIL DIESER LIZENZ. ES IST VERBOTEN DAS PROGRAMM ZU -BENUTZEN OHNE DASS DIESEM ABSATZ ZUGESTIMMT WIRD. diff --git a/lib/ncss/ccl.jar b/lib/ncss/ccl.jar deleted file mode 100644 index 1407078..0000000 Binary files a/lib/ncss/ccl.jar and /dev/null differ diff --git a/lib/ncss/javacc.jar b/lib/ncss/javacc.jar deleted file mode 100644 index 38f8426..0000000 Binary files a/lib/ncss/javacc.jar and /dev/null differ diff --git a/lib/ncss/javancss.jar b/lib/ncss/javancss.jar deleted file mode 100644 index 58e3adb..0000000 Binary files a/lib/ncss/javancss.jar and /dev/null differ diff --git a/lib/proguard.jar b/lib/proguard.jar deleted file mode 100644 index 887c24f..0000000 Binary files a/lib/proguard.jar and /dev/null differ diff --git a/lib/proguard_4_11.jar b/lib/proguard_4_11.jar deleted file mode 100644 index 256ce79..0000000 Binary files a/lib/proguard_4_11.jar and /dev/null differ diff --git a/lib/timer/hrtlib.dll b/lib/timer/hrtlib.dll deleted file mode 100644 index adf20d8..0000000 Binary files a/lib/timer/hrtlib.dll and /dev/null differ diff --git a/lib/timer/timer.jar b/lib/timer/timer.jar deleted file mode 100644 index 59001f6..0000000 Binary files a/lib/timer/timer.jar and /dev/null differ diff --git a/dist/docs/readme.txt b/readme.txt similarity index 100% rename from dist/docs/readme.txt rename to readme.txt diff --git a/test/test/BradTest.java b/test/test/BradTest.java deleted file mode 100644 index ab9ef7c..0000000 --- a/test/test/BradTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package test; - -import java.util.LinkedList; -import java.util.List; - -public class BradTest { - - public void testForLoop() { - - for(int i = 0; i < 5; i++) { - System.out.println(i); - } - - int[] testArray = new int[] {}; - - for(int i : testArray) { - System.out.println(i); - } - - int k = 0; - int j = 0; - - while(j < 5) { - - System.out.println("Test while."); - - j++; - - if(j < 3) { - continue; - } - - k++; - - } - - List keys = new java.util.ArrayList(); - - for(Object test : keys) { - - System.out.println(test); - - System.out.println(test); - - System.out.println(test); - - } - - List objects = new LinkedList(); - - for(BradTest test : objects) { - System.out.println(test); - - } - } - -} diff --git a/test/test/TestAnnotationsEclipse.java b/test/test/TestAnnotationsEclipse.java deleted file mode 100644 index 42a06c0..0000000 --- a/test/test/TestAnnotationsEclipse.java +++ /dev/null @@ -1,42 +0,0 @@ -package test; - -import java.lang.annotation.Annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; - -public class TestAnnotationsEclipse { - - public String a; - - @Retention(RetentionPolicy.CLASS) - @interface MyAnnotation {} - - public static void main(String[] args) { - - TestInner a = new TestAnnotationsEclipse().new TestInner(); - - for(Constructor mt : a.getClass().getConstructors()) { - - Annotation[][] ann = mt.getParameterAnnotations(); - - System.out.println(ann.length); - } - } - - protected class TestInner { - - public TestInner() {} - - public TestInner(String param1, Object param2, @MyAnnotation boolean param3) { - System.out.println(param1); - System.out.println(param2); - System.out.println(param3); - } - - public void accessField() { - System.out.println(TestAnnotationsEclipse.this.a); - } - } -} diff --git a/test/test/input/TestEclipse7.java b/test/test/input/TestEclipse7.java deleted file mode 100644 index f8bb127..0000000 --- a/test/test/input/TestEclipse7.java +++ /dev/null @@ -1,59 +0,0 @@ -package test.input; - -import java.io.FileReader; -import java.io.IOException; -import java.lang.reflect.Method; - -public class TestEclipse7 { - - -// public void testTryResources() throws IOException { -// -// try (FileReader reader = new FileReader("file"); FileReader reader1 = new FileReader("file")) { -// System.out.println(); -// } -// -// } -// -// public void testTryResources1() throws IOException { -// -// try (FileReader reader = new FileReader("file")) { -// System.out.println("block"); -// } catch(RuntimeException ex) { -// System.out.println(ex.toString()); -// } finally { -// System.out.println("finally"); -// } -// -// } - - public void testMultiCatch() { - - try { - Method method = getClass().getDeclaredMethod("foo"); - } catch (NoSuchMethodException | SecurityException e) { - e.printStackTrace(); - } - } - - -// public void testSwitchString() { -// -// String s = ""; -// switch(s) { -// case "Aa": // "xyz": -// System.out.println("!"); -// break; -// case "BB": // "abc": -// System.out.println("?"); -// break; -// case "__": -// System.out.println("_"); -// break; -// default: -// System.out.println("#"); -// } -// -// } - -} diff --git a/test/test/input/TestJavac7.java b/test/test/input/TestJavac7.java deleted file mode 100644 index fb72d45..0000000 --- a/test/test/input/TestJavac7.java +++ /dev/null @@ -1,59 +0,0 @@ -package test.input; - -import java.io.FileReader; -import java.io.IOException; -import java.lang.reflect.Method; - -public class TestJavac7 { - - - public void testTryResources() throws IOException { - - try (FileReader reader = new FileReader("file"); FileReader reader1 = new FileReader("file")) { - System.out.println(); - } - - } - - public void testTryResources1() throws IOException { - - try (FileReader reader = new FileReader("file")) { - System.out.println("block"); - } catch(RuntimeException ex) { - System.out.println(ex.toString()); - } finally { - System.out.println("finally"); - } - - } - - public void testMultiCatch() { - - try { - Method method = getClass().getDeclaredMethod("foo"); - } catch (NoSuchMethodException | SecurityException e) { - e.printStackTrace(); - } - } - - - public void testSwitchString() { - - String s = ""; - switch(s) { - case "Aa": // "xyz": - System.out.println("!"); - break; - case "BB": // "abc": - System.out.println("?"); - break; - case "__": - System.out.println("_"); - break; - default: - System.out.println("#"); - } - - } - -} diff --git a/test/test/input/TestJavac8.java b/test/test/input/TestJavac8.java deleted file mode 100644 index 068750c..0000000 --- a/test/test/input/TestJavac8.java +++ /dev/null @@ -1,58 +0,0 @@ -package test.input; - -import java.io.FileReader; -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; - -public class TestJavac8 { - -// public static void main(String args[]) { -// new TestJavac8().testLambda(); -// } -// -// public void testTryResources() throws IOException { -// -// try (FileReader reader = new FileReader("file"); FileReader reader1 = new FileReader("file")) { -// System.out.println(); -// } -// -// } -// -// public void testMultiCatch() { -// -// try { -// Method method = getClass().getDeclaredMethod("foo"); -// } catch (NoSuchMethodException | SecurityException e) { -// e.printStackTrace(); -// } -// } -// -// -// private void testSwitchString() { -// -// String s = ""; -// switch(s) { -// case "Aa": // "xyz": -// System.out.println("!"); -// break; -// case "BB": // "abc": -// System.out.println("?"); -// break; -// case "__": -// System.out.println("_"); -// break; -// default: -// System.out.println("#"); -// } -// -// } - - public void testLambda() { - - List list = Arrays.asList(1, 2, 3, 4, 5, 6, 7); - list.forEach(n -> {int a = 2 * n; System.out.println(a);}); - } - -} diff --git a/test/test/misc/ExtTest.java b/test/test/misc/ExtTest.java deleted file mode 100644 index ec3d30c..0000000 --- a/test/test/misc/ExtTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package test.misc; - -import java.io.IOException; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Map.Entry; - -public class ExtTest extends ArrayList { - - public static void main(String[] args) { - - Date d = new Date(); Timestamp t = new Timestamp(d.getTime()); - System.out.println(d.after(t)); - - System.out.println((int)-1); - System.out.println((int)1); - System.out.println((Integer)1); - System.out.println((Integer)1); - - Class c = String.class; - - Integer Integer = 0; - Integer = (Integer)-1; - - int z = 0; - z = z+++(++z); - - Entry ent = (Entry)new HashMap().entrySet().iterator().next(); - - label1: { - System.out.println("1"); - if(Math.random() > 4) { - break label1; - } - System.out.println("2"); - } - System.out.println("3"); - } - - public void test(T o) { - - } - - public void testException() throws IOException { -// if(true) { -// throw new RuntimeException(); -// } else { -// throw new IOException(); -// } -// throw true?new IOException():new IOException(); -// throw true?new ClassCastException():new IOException(); - } - - public static int ttt() { - - Object obj = new Integer(5); - synchronized (new Integer(3)) { - System.out.println(obj); - obj = null; - } - - - System.out.println("1"); - if(Math.random() > 1) { - System.out.println("2"); - } else { - System.out.println("3"); - } - System.out.println("4"); - - int a = 0; - try { - a = 2; - return a; - } finally { - a = 4; - } - } -} diff --git a/test/test/misc/GenericTest.java b/test/test/misc/GenericTest.java deleted file mode 100644 index 3ff6753..0000000 --- a/test/test/misc/GenericTest.java +++ /dev/null @@ -1,65 +0,0 @@ -package test.misc; - -import java.io.Serializable; -import java.util.AbstractCollection; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.List; - -public class GenericTest { - - @test.misc.ann.RequestForEnhancement( - id = 2868724, - synopsis = "Enable time-travel", - engineer = "Mr. Peabody", - date = "4/1/3007", - arr = {"1","2","3"}, - cl = Void.class - ) - @Deprecated - public boolean test(@Deprecated Collection c) { - return true; - } - - public int testparam(boolean t, @Deprecated List lst, double d) { - return 0; - } - -} - -class GenericTestChild extends GenericTest> implements Serializable { - -// public void test(Collection c) { -// T var1 = c.iterator().next(); -// c.add(var1); -// } - - public List[][] field; - - public void test(List list1, List list) { - -// l2: { -// l1: { -// if(Math.random() > 2){ -// break l1; -// } -// -// System.out.println("1"); -// break l2; -// } -// -// System.out.println("2"); -// } - - if(Math.random() > 2){ - System.out.println("2"); - } else { - System.out.println("1"); - } - - - } - -} - diff --git a/test/test/misc/ITest.java b/test/test/misc/ITest.java deleted file mode 100644 index 1924a8d..0000000 --- a/test/test/misc/ITest.java +++ /dev/null @@ -1,9 +0,0 @@ -package test.misc; - -import java.io.Serializable; - -public interface ITest extends Serializable, Comparable { - - public void test(); - -} diff --git a/test/test/misc/MainClass.java b/test/test/misc/MainClass.java deleted file mode 100644 index abb6522..0000000 --- a/test/test/misc/MainClass.java +++ /dev/null @@ -1,115 +0,0 @@ -package test.misc; - -import java.util.ArrayList; -import java.util.List; - -public class MainClass { - - private int intfield; - - private static int stfield; - - private static void statmeth(int t) { - System.out.println(t); - } - - private String maintest(int v) { - System.out.println(v+"test!"); - return ""; - } - - public MainClass() { - super(); - } - - public void mainclosure() { - - final int local1 = (int)Math.random(); - - List l = new ArrayList(new ArrayList()) { - - { - System.out.println(intfield); - } - - public void anontest() { - System.out.println(local1); - } - }; - - class LocalClass { - - public LocalClass(String s) { - System.out.println(s); - statmeth(4); - } - - public void localtest() { - int i = intfield; - intfield = 4; - maintest(i); - - System.out.println(local1); - - System.out.println(stfield); - stfield = 3; - } - - class LocalMemberClass { - - } - - } - - boolean t = false; - if(t) { - LocalClass lc = new LocalClass("1"); - LocalClass.LocalMemberClass rt = lc.new LocalMemberClass();; - } else { - if(Math.random() > 1) { - LocalClass lc1 = new LocalClass("1"); - } - System.out.println(); - } - - } - - - public class MemberClass { - - public MemberClass(String z) { - System.out.println(z); - } - - public void membertest() { - int i = intfield; - maintest(i); - stfield = 5; - - Member2Class.Member3Class t = (new Member2Class()).new Member3Class(); - } - - public class Member2Class1 { - - public class Member3Class1 { - - } - } - - class Member2Class { - - public void member2test() { - int i = intfield; - maintest(i); - Member2Class1.Member3Class1 t; - } - - public class Member3Class { - - } - - } - - } - -} diff --git a/test/test/misc/MiscTest.java b/test/test/misc/MiscTest.java deleted file mode 100644 index c47b3da..0000000 --- a/test/test/misc/MiscTest.java +++ /dev/null @@ -1,83 +0,0 @@ -package test.misc; - -public class MiscTest { - - public static double test = 1 / 0; - - - public static void main(String[] args) { - - System.out.println(test); - - String s = "a b"; - s = s.replaceAll(" ", "  "); - System.out.println(s); - - try { - throw null; - } catch(RuntimeException ex) { - System.out.println(ex); - } - - - int a = 3; - - if(a == 1) { - System.out.println("1"); - } else if(a == 2) { - System.out.println("2"); - } else if(a == 3) { - System.out.println("3"); - } else if(a == 4) { - System.out.println("4"); - } else if(a == 5) { - System.out.println("5"); - } else if(a == 6) { - System.out.println("6"); - } else if(a == 7) { - System.out.println("7"); - } - - if(a == 0) { - return; - } else { - System.out.println("0"); - } - - if(a==4) { - System.out.println("assert"); - assert a==4 && a==5; - } else { - assert false; - } - - assert a==5: Math.random(); - - assert false: Math.random(); - - assert true; - - assert true: Math.random(); - - /* - label: { - if(a == 0) { - System.out.println("0"); - } else if(a == 1) { - System.out.println("01"); - } else { - if(a == -1) { - System.out.println("-1"); - } else { - System.out.println("-2"); - } - break label; - } - - System.out.println("end"); - } - System.out.println("end1"); - */ - } - -} diff --git a/test/test/misc/MultipleClassTest.java b/test/test/misc/MultipleClassTest.java deleted file mode 100644 index ccd9b97..0000000 --- a/test/test/misc/MultipleClassTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package test.misc; - -public class MultipleClassTest { - - public int field = this.hashCode(); - - public void test() { - - class Test1 { - public int t1() { -// System.out.println("1"); - - try { - return 2; - } finally { - System.out.println("1"); - return 3; - } - - } - } - - class Test2 { - public void t2() { - System.out.println("2"); - //new Test1().t1(); - } - } - -// new Test1().t1(); - } - -} diff --git a/test/test/misc/ParentFieldTest.java b/test/test/misc/ParentFieldTest.java deleted file mode 100644 index caccc2a..0000000 --- a/test/test/misc/ParentFieldTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package test.misc; - -public class ParentFieldTest { - - public int test = 0; - - private class Parent extends ParentFieldTest { - - private class Child { - - public void test() { - System.out.println(ParentFieldTest.this.test); - } - - } - - } - -} diff --git a/test/test/misc/SuperTest.java b/test/test/misc/SuperTest.java deleted file mode 100644 index 01fc990..0000000 --- a/test/test/misc/SuperTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package test.misc; - -import java.util.ArrayList; - -public class SuperTest extends ArrayList { - - public SuperTest() { - super(3); - super.modCount = 2; - SuperTest.super.size(); - } - - public int size() { - System.out.println("1"); - return 0; - } - - class SuperTest1 { - - public void test() { - SuperTest.super.size(); - SuperTest.super.modCount = 2; - } - - } - -} diff --git a/test/test/misc/ann/RequestForEnhancement.java b/test/test/misc/ann/RequestForEnhancement.java deleted file mode 100644 index 25c612c..0000000 --- a/test/test/misc/ann/RequestForEnhancement.java +++ /dev/null @@ -1,22 +0,0 @@ -package test.misc.ann; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Describes the Request-For-Enhancement(RFE) that led - * to the presence of the annotated API element. - */ - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface RequestForEnhancement { - int id(); - String synopsis(); - String engineer() default "[unassigned]"; - String date() default "[unimplemented]"; - String[] arr(); - Class cl(); -} diff --git a/test/test/misc/en/AutocastTest.java b/test/test/misc/en/AutocastTest.java deleted file mode 100644 index ea08948..0000000 --- a/test/test/misc/en/AutocastTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package test.misc.en; - -import java.util.HashMap; - -public class AutocastTest { - - public static void main(String[] args) { - - HashMap map = new HashMap(); - - Integer key = new Integer(1); - Integer value = map.containsKey(key)?0:map.get(key); - - System.out.println(value == null); - } - -} diff --git a/test/test/misc/en/FastSetTest.java b/test/test/misc/en/FastSetTest.java deleted file mode 100644 index ab94814..0000000 --- a/test/test/misc/en/FastSetTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package test.misc.en; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; - -import de.fernflower.util.FastSetFactory; -import de.fernflower.util.FastSetFactory.FastSet; - -public class FastSetTest { - - public static void main(String[] args) { - - SortedSet set = new TreeSet(); - - for(int i=0;i<3;i++) { - set.add(i); - } - -// for(Integer s : set) { -// System.out.println(s); -// } - - FastSetFactory factory = new FastSetFactory(set); - -// factory.print(); - -// int index = 1; -// for(int i=0;i<100;i++) { -// if(i % 32 == 0) { -// index = 1; -// } -// -// System.out.println(index); -// index<<=1; -// -// } - - - - FastSet set1 = factory.spawnEmptySet(); - set1.addAll(new HashSet(Arrays.asList(new Integer[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}))); - - FastSet set2 = set1.getCopy(); - set2.remove(4); - set2.remove(5); - set2.add(10); - - set1.symdiff(set2); - Set set3 = new TreeSet(set1.toPlainSet()); - - for(Integer s : set3) { - System.out.println(s); - } - } - - -} diff --git a/test/test/misc/en/FinallyTest.java b/test/test/misc/en/FinallyTest.java deleted file mode 100644 index 2162636..0000000 --- a/test/test/misc/en/FinallyTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package test.misc.en; - -public class FinallyTest { - - public FinallyTest() { - - int i; - try { - try { - i = 0; - } finally { - i = 1; - } - i = 2; - } finally { - i = 3; - } - - System.out.println(i); - } - -} diff --git a/test/test/misc/en/Foo.java b/test/test/misc/en/Foo.java deleted file mode 100644 index 762dcda..0000000 --- a/test/test/misc/en/Foo.java +++ /dev/null @@ -1,52 +0,0 @@ -package test.misc.en; - -class Foo { - - public Foo() {} - - public Foo(String test) {} - - private void foo() { - System.out.println("qwe"); - } - - static class Bar extends Foo { - void bar() { - System.out.println("1"); - //((Foo)this).foo(); - } - } - - static class Bar1 extends Bar { - void bar() { - super.bar(); - //System.out.println("2"); - //((Foo)this).foo(); - } - } - - static class Bar2 extends Bar1 { - void bar1() { - super.bar(); - } - } - - public static void main(String[] args) { - new Bar2().bar(); - } - - public int testfin() { - - int i; - - try { - System.out.println(); - i = 0; - } finally { - System.out.println(); - } - - - return i; - } -} diff --git a/test/test/misc/en/InnerTest$1.java b/test/test/misc/en/InnerTest$1.java deleted file mode 100644 index dd58e8e..0000000 --- a/test/test/misc/en/InnerTest$1.java +++ /dev/null @@ -1,22 +0,0 @@ -package test.misc.en; - - -class InnerTest$1 extends Foo implements Runnable { - - // $FF: synthetic field - final String val$test; - // $FF: synthetic field - final int val$test1; - - - InnerTest$1(String var1, int var2) { - super(); - this.val$test = var1; - this.val$test1 = var2; - } - - public void run() { - System.out.println(this.val$test); - System.out.println(this.val$test1); - } -} diff --git a/test/test/misc/en/InnerTest.java b/test/test/misc/en/InnerTest.java deleted file mode 100644 index 44361ff..0000000 --- a/test/test/misc/en/InnerTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package test.misc.en; - -import test.misc.en.InnerTest$1; - -public class InnerTest { - - public static void main(String[] args) throws Throwable { - String test = args[0]; - int test1 = Integer.parseInt(args[1]); - new InnerTest$1(test, test1); - System.out.println("готово"); - } -} diff --git a/test/test/misc/en/InnerTestOld.java b/test/test/misc/en/InnerTestOld.java deleted file mode 100644 index b3af77c..0000000 --- a/test/test/misc/en/InnerTestOld.java +++ /dev/null @@ -1,20 +0,0 @@ -package test.misc.en; - -public class InnerTestOld { - - public static void main(String[] args) { - - final String test = args[0]; - final int test1 = Integer.parseInt(args[1]); - - Runnable r = new Runnable() { - public void run() { - System.out.println(test); - System.out.println(test1); - } - }; - - System.out.println("done"); - } - -} diff --git a/test/test/misc/en/ListInsertTest.java b/test/test/misc/en/ListInsertTest.java deleted file mode 100644 index ceabe83..0000000 --- a/test/test/misc/en/ListInsertTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package test.misc.en; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.LinkedList; -import java.util.List; - -public class ListInsertTest { - - public static void main(String[] args) { - - List lst1 = new ArrayList(Arrays.asList(new Integer[]{1, 2, 3})); - List lst2 = new LinkedList(Arrays.asList(new Integer[]{1, 2, 3})); - - Date d = new Date(); - - for(int i=0;i<300000;i++) { - lst1.add(1, i); - } - - System.out.println(new Date().getTime() - d.getTime()); - - d = new Date(); - - for(int i=0;i<300000;i++) { - lst2.add(1, i); - } - - System.out.println(new Date().getTime() - d.getTime()); - - } - -} diff --git a/test/test/misc/en/Operation.java b/test/test/misc/en/Operation.java deleted file mode 100644 index 3051fb3..0000000 --- a/test/test/misc/en/Operation.java +++ /dev/null @@ -1,51 +0,0 @@ -package test.misc.en; - -public enum Operation { - - PLUS(2) { - double eval(double x, double y) { return x + y; } - }, - MINUS(7) { - double eval(double x, double y) { return x - y; } - }, - TIMES(8) { - double eval(double x, double y) { return x * y; } - }, - DIVIDED_BY(0) { - double eval(double x, double y) { return x / y; } - }; - - - // Perform the arithmetic operation represented by this constant - - abstract double eval(double x, double y); - - Operation(int t) { - -// class LocalClass { -// -// } -// -// LocalClass e = null; - - System.out.println(); - } - - - public static void main(String args[]) { - double x = Double.parseDouble(args[0]); - double y = Double.parseDouble(args[1]); - - Operation opp = Operation.DIVIDED_BY; - - switch(opp) { - case MINUS: - System.out.println(); - case PLUS: - } - - for (Operation op : Operation.values()) { - System.out.println(x + " " + op + " " + y + " = " + op.eval(x, y)); - } - } -} \ No newline at end of file diff --git a/test/test/misc/en/SwitchInTest.java b/test/test/misc/en/SwitchInTest.java deleted file mode 100644 index 8d04665..0000000 --- a/test/test/misc/en/SwitchInTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package test.misc.en; - -public class SwitchInTest { - - public static void main(String[] args) { - - short t = 2; - switch(t) { - case -56: - case 0: - case 3: - case 129: - System.out.println(); - default: - } - - } - -} diff --git a/test/test/misc/en/TestOperation.java b/test/test/misc/en/TestOperation.java deleted file mode 100644 index c6763b1..0000000 --- a/test/test/misc/en/TestOperation.java +++ /dev/null @@ -1,31 +0,0 @@ -package test.misc.en; - -public class TestOperation { - - public void test() { - - double x = 2; - double y = 3; - - Operation opp = Operation.DIVIDED_BY; - - switch(opp) { - case MINUS: - System.out.println(); - case PLUS: - } - - switch(Operation.MINUS) { - case DIVIDED_BY: - System.out.println(); - case PLUS: - case TIMES: - } - - for (Operation op : Operation.values()) { - System.out.println(x + " " + op + " " + y + " = " + op.eval(x, y)); - } - - } - -} diff --git a/test/test/output/TestEclipse7.java b/test/test/output/TestEclipse7.java deleted file mode 100644 index a37b582..0000000 --- a/test/test/output/TestEclipse7.java +++ /dev/null @@ -1,15 +0,0 @@ -package test.output; - -import java.lang.reflect.Method; - -public class TestEclipse7 { - - public void testMultiCatch() { - try { - Method e = this.getClass().getDeclaredMethod("foo", new Class[0]); - } catch (SecurityException | NoSuchMethodException var2) { - var2.printStackTrace(); - } - - } -} diff --git a/test/test/output/TestJavac7.java b/test/test/output/TestJavac7.java deleted file mode 100644 index 9ddb71e..0000000 --- a/test/test/output/TestJavac7.java +++ /dev/null @@ -1,129 +0,0 @@ -package test.output; - -import java.io.FileReader; -import java.io.IOException; -import java.lang.reflect.Method; - -public class TestJavac7 { - - public void testTryResources() throws IOException { - FileReader var1 = new FileReader("file"); - Throwable var2 = null; - - try { - FileReader var3 = new FileReader("file"); - Throwable var4 = null; - - try { - System.out.println(); - } catch (Throwable var27) { - var4 = var27; - throw var27; - } finally { - if(var3 != null) { - if(var4 != null) { - try { - var3.close(); - } catch (Throwable var26) { - var4.addSuppressed(var26); - } - } else { - var3.close(); - } - } - - } - } catch (Throwable var29) { - var2 = var29; - throw var29; - } finally { - if(var1 != null) { - if(var2 != null) { - try { - var1.close(); - } catch (Throwable var25) { - var2.addSuppressed(var25); - } - } else { - var1.close(); - } - } - - } - - } - - public void testTryResources1() throws IOException { - try { - FileReader var1 = new FileReader("file"); - Throwable var2 = null; - - try { - System.out.println("block"); - } catch (Throwable var20) { - var2 = var20; - throw var20; - } finally { - if(var1 != null) { - if(var2 != null) { - try { - var1.close(); - } catch (Throwable var19) { - var2.addSuppressed(var19); - } - } else { - var1.close(); - } - } - - } - } catch (RuntimeException var22) { - System.out.println(var22.toString()); - } finally { - System.out.println("finally"); - } - - } - - public void testMultiCatch() { - try { - Method var1 = this.getClass().getDeclaredMethod("foo", new Class[0]); - } catch (SecurityException var2) { - var2.printStackTrace(); - } - - } - - public void testSwitchString() { - String var1 = ""; - byte var3 = -1; - switch(var1.hashCode()) { - case 2112: - if(var1.equals("BB")) { - var3 = 1; - } else if(var1.equals("Aa")) { - var3 = 0; - } - break; - case 3040: - if(var1.equals("__")) { - var3 = 2; - } - } - - switch(var3) { - case 0: - System.out.println("!"); - break; - case 1: - System.out.println("?"); - break; - case 2: - System.out.println("_"); - break; - default: - System.out.println("#"); - } - - } -} diff --git a/test/test/output/TestJavac8.java b/test/test/output/TestJavac8.java deleted file mode 100644 index 2b66907..0000000 --- a/test/test/output/TestJavac8.java +++ /dev/null @@ -1,104 +0,0 @@ -package test.output; - -import java.io.FileReader; -import java.io.IOException; -import java.lang.reflect.Method; - -public class TestJavac8 { - - public static void main(String[] var0) { - (new TestJavac8()).testLambda(); - } - - public void testTryResources() throws IOException { - FileReader var1 = new FileReader("file"); - Throwable var2 = null; - - try { - FileReader var3 = new FileReader("file"); - Throwable var4 = null; - - try { - System.out.println(); - } catch (Throwable var27) { - var4 = var27; - throw var27; - } finally { - if(var3 != null) { - if(var4 != null) { - try { - var3.close(); - } catch (Throwable var26) { - var4.addSuppressed(var26); - } - } else { - var3.close(); - } - } - - } - } catch (Throwable var29) { - var2 = var29; - throw var29; - } finally { - if(var1 != null) { - if(var2 != null) { - try { - var1.close(); - } catch (Throwable var25) { - var2.addSuppressed(var25); - } - } else { - var1.close(); - } - } - - } - - } - - public void testMultiCatch() { - try { - Method var1 = this.getClass().getDeclaredMethod("foo", new Class[0]); - } catch (SecurityException var2) { - var2.printStackTrace(); - } - - } - - private void testSwitchString() { - String var1 = ""; - byte var3 = -1; - switch(var1.hashCode()) { - case 2112: - if(var1.equals("BB")) { - var3 = 1; - } else if(var1.equals("Aa")) { - var3 = 0; - } - break; - case 3040: - if(var1.equals("__")) { - var3 = 2; - } - } - - switch(var3) { - case 0: - System.out.println("!"); - break; - case 1: - System.out.println("?"); - break; - case 2: - System.out.println("_"); - break; - default: - System.out.println("#"); - } - - } - - public void testLambda() { - } -} diff --git a/test/test/util/DotExporter.java b/test/test/util/DotExporter.java deleted file mode 100644 index 61ee5eb..0000000 --- a/test/test/util/DotExporter.java +++ /dev/null @@ -1,187 +0,0 @@ -package test.util; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; - - -import de.fernflower.code.cfg.BasicBlock; -import de.fernflower.code.cfg.ControlFlowGraph; -import de.fernflower.modules.decompiler.StatEdge; -import de.fernflower.modules.decompiler.sforms.DirectGraph; -import de.fernflower.modules.decompiler.sforms.DirectNode; -import de.fernflower.modules.decompiler.stats.Statement; -import de.fernflower.modules.decompiler.vars.VarVersionEdge; -import de.fernflower.modules.decompiler.vars.VarVersionNode; -import de.fernflower.modules.decompiler.vars.VarVersionsGraph; - -public class DotExporter { - - - public static String toDotFormat(Statement stat) { - - StringBuffer buffer = new StringBuffer(); - - buffer.append("digraph G {\r\n"); - - for(Statement st : stat.getStats()) { - - String sourceid = st.id + (st.getSuccessorEdges(StatEdge.TYPE_EXCEPTION).isEmpty()?"":"000000"); - - buffer.append(sourceid+" [shape=box,label=\""+sourceid+"\"];\r\n"); - - for(StatEdge edge : st.getSuccessorEdges(Statement.STATEDGE_DIRECT_ALL)) { - String destid = edge.getDestination().id + (edge.getDestination().getSuccessorEdges(StatEdge.TYPE_EXCEPTION).isEmpty()?"":"000000"); - - buffer.append(sourceid+"->"+destid+";\r\n"); - - if(!stat.getStats().contains(edge.getDestination())) { - buffer.append(destid+" [label=\""+destid+"\"];\r\n"); - } - } - - for(StatEdge edge : st.getSuccessorEdges(StatEdge.TYPE_EXCEPTION)) { - String destid = edge.getDestination().id + (edge.getDestination().getSuccessorEdges(StatEdge.TYPE_EXCEPTION).isEmpty()?"":"000000"); - - buffer.append(sourceid+" -> "+destid+" [style=dotted];\r\n"); - - if(!stat.getStats().contains(edge.getDestination())) { - buffer.append(destid+" [label=\""+destid+"\"];\r\n"); - } - } - } - - buffer.append("}"); - - return buffer.toString(); - } - - - public static String toDotFormat(ControlFlowGraph graph, boolean showMultipleEdges) { - - StringBuffer buffer = new StringBuffer(); - - buffer.append("digraph G {\r\n"); - - List blocks = graph.getBlocks(); - for(int i=0;i suc = block.getSuccs(); - if(!showMultipleEdges) { - HashSet set = new HashSet(); - set.addAll(suc); - suc = Collections.list(Collections.enumeration(set)); - } - for(int j=0;j"+((BasicBlock)suc.get(j)).id+";\r\n"); - } - - - suc = block.getSuccExceptions(); - if(!showMultipleEdges) { - HashSet set = new HashSet(); - set.addAll(suc); - suc = Collections.list(Collections.enumeration(set)); - } - for(int j=0;j "+((BasicBlock)suc.get(j)).id+" [style=dotted];\r\n"); - } - } - - buffer.append("}"); - - return buffer.toString(); - } - - public static String toDotFormat(VarVersionsGraph graph) { - - StringBuffer buffer = new StringBuffer(); - - buffer.append("digraph G {\r\n"); - - List blocks = graph.nodes; - for(int i=0;i"+(dest.var*1000+dest.version)+(edge.type==VarVersionEdge.EDGE_PHANTOM?" [style=dotted]":"")+";\r\n"); - } - } - - buffer.append("}"); - - return buffer.toString(); - } - - public static String toDotFormat(DirectGraph graph) { - - StringBuffer buffer = new StringBuffer(); - - buffer.append("digraph G {\r\n"); - - List blocks = graph.nodes; - for(int i=0;i"+directBlockIdToDot(dest.id)+";\r\n"); - } - } - - buffer.append("}"); - - return buffer.toString(); - } - - private static String directBlockIdToDot(String id) { - id = id.replaceAll("_try", "999"); - id = id.replaceAll("_tail", "888"); - - id = id.replaceAll("_init", "111"); - id = id.replaceAll("_cond", "222"); - id = id.replaceAll("_inc", "333"); - return id; - } - - public static void toDotFile(ControlFlowGraph graph, File file, boolean showMultipleEdges) throws FileNotFoundException, IOException { - BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file)); - out.write(toDotFormat(graph, showMultipleEdges).getBytes()); - out.close(); - } - - public static void toDotFile(VarVersionsGraph graph, File file) throws FileNotFoundException, IOException { - - BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file)); - out.write(toDotFormat(graph).getBytes()); - out.close(); - } - - public static void toDotFile(DirectGraph graph, File file) throws FileNotFoundException, IOException { - - BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file)); - out.write(toDotFormat(graph).getBytes()); - out.close(); - } - - public static void toDotFile(Statement stat, File file) throws FileNotFoundException, IOException { - - BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file)); - out.write(toDotFormat(stat).getBytes()); - out.close(); - } - -} diff --git a/test/test/util/MemoryMonitor.java b/test/test/util/MemoryMonitor.java deleted file mode 100644 index 4030383..0000000 --- a/test/test/util/MemoryMonitor.java +++ /dev/null @@ -1,25 +0,0 @@ -package test.util; - -public class MemoryMonitor implements Runnable { - - public static boolean run = false; - - - public void run() { - - while(run) { - try { - Thread.sleep(500); - } catch(InterruptedException ex) { - ex.printStackTrace(); - } - - //Runtime.getRuntime().gc(); - System.err.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())/(1024*1024)); - - } - - } - - -} diff --git a/test/test/util/Timer.java b/test/test/util/Timer.java deleted file mode 100644 index 5a45cc0..0000000 --- a/test/test/util/Timer.java +++ /dev/null @@ -1,31 +0,0 @@ -package test.util; - -import java.util.HashMap; - -public class Timer { - - private static HashMap mapValue = new HashMap(); - - public static void addTime(int index, long value) { - addTime(String.valueOf(index), value); - } - - public static double getTime(int index) { - return mapValue.get(String.valueOf(index)); - } - - public static void addTime(String index, double value) { - Double val = mapValue.get(index); - if(val != null) { - value+=val.doubleValue(); - } - mapValue.put(index, value); - } - - public static double getTime(String index) { - Double value = mapValue.get(index); - return value==null?0:value.doubleValue(); - } - -} - diff --git a/test/test/util/ZipStripper.java b/test/test/util/ZipStripper.java deleted file mode 100644 index 2eeb2c0..0000000 --- a/test/test/util/ZipStripper.java +++ /dev/null @@ -1,71 +0,0 @@ -package test.util; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Enumeration; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; -import java.util.zip.ZipOutputStream; - -public class ZipStripper { - - public static void main(String[] args) { - - try { - String sourceFileName = args[0]; - File sourceFile = new File(sourceFileName); - - File tempFile = new File(sourceFile.getParentFile(), "tmp31415926535.zip"); - tempFile.createNewFile(); - - ZipOutputStream outTemp = new ZipOutputStream(new FileOutputStream(tempFile)); - - ZipFile archive = new ZipFile(sourceFile); - - Enumeration en = archive.entries(); - while(en.hasMoreElements()) { - ZipEntry entr = en.nextElement(); - - outTemp.putNextEntry(new ZipEntry(entr.getName())); - - if(!entr.isDirectory()) { - InputStream in = archive.getInputStream(entr); - - copyInputStream(in, outTemp); - in.close(); - } - } - - outTemp.flush(); - outTemp.close(); - - archive.close(); - - String destFileName = args[1]; - - if(sourceFileName.equals(destFileName)) { - sourceFile.delete(); - } - - tempFile.renameTo(new File(destFileName)); - - } catch(Exception ex) { - ex.printStackTrace(); - } - - } - - public static void copyInputStream(InputStream in, OutputStream out)throws IOException { - - byte[] buffer = new byte[1024]; - int len; - - while((len = in.read(buffer)) >= 0) { - out.write(buffer, 0, len); - } - } - -} diff --git a/timer/HRTimerResolution.java b/timer/HRTimerResolution.java deleted file mode 100644 index 318694f..0000000 --- a/timer/HRTimerResolution.java +++ /dev/null @@ -1,68 +0,0 @@ -import java.text.DecimalFormat; - -import com.vladium.utils.timing.ITimer; -import com.vladium.utils.timing.TimerFactory; - -// ---------------------------------------------------------------------------- -/** - * A demo class to show off the higher resolution available from HRTimer class - * and to investigate the resolution offered by Java "time-related" - * methods other than System.currentTimeMillis().

- * - * Make sure that hrtlib.dll JNI lib is in java.library.path or TimerFactory - * will fall back to the Java system timer: - *

- *  >java -Djava.library.path=(dir containing hrtlib.dll) HRTimerResolution
- * 
- * - * @author (C) Vlad Roubtsov, 2002 - */ -public class HRTimerResolution -{ - // public: ................................................................ - - public static void main (final String [] args) throws Exception - { - final DecimalFormat format = new DecimalFormat (); - format.setMinimumFractionDigits (3); - format.setMaximumFractionDigits (3); - - // create an ITimer using the Factory class: - final ITimer timer = TimerFactory.newTimer (); - - // JIT/hotspot warmup: - for (int i = 0; i < 3000; ++ i) - { - timer.start (); - timer.stop (); - timer.getDuration (); - timer.reset (); - } - - final Object lock = new Object (); // this is used by monitor.wait() below - - for (int i = 0; i < 5; ++ i) - { - timer.start (); - - // uncomment various lines below to see the resolution - // offered by other Java time-related methods; with all - // lines commented out this loop reports time elapsed - // between successive calls to t.start() and t.stop(), thus - // providing an estimate for timer's raw resolution - - synchronized (lock) { lock.wait (1); } - //Thread.currentThread ().sleep (1); - //Thread.currentThread ().sleep (0, 500); - //Thread.currentThread ().join (1); - - timer.stop (); - - System.out.println ("duration = " - + format.format (timer.getDuration ()) + " ms"); - timer.reset (); - } - } - -} // end of class -// ---------------------------------------------------------------------------- diff --git a/timer/SystemTimerResolution.java b/timer/SystemTimerResolution.java deleted file mode 100644 index 56ececd..0000000 --- a/timer/SystemTimerResolution.java +++ /dev/null @@ -1,31 +0,0 @@ -// ---------------------------------------------------------------------------- -/** - * A simple class to see what the Java system timer resolution is on your - * system. - * - * @author (C) Vlad Roubtsov, 2002 - */ -public class SystemTimerResolution -{ - // public: ................................................................ - - public static void main (final String [] args) - { - // JIT/hotspot warmup: - for (int r = 0; r < 3000; ++ r) System.currentTimeMillis (); - - long time = System.currentTimeMillis (), time_prev = time; - - for (int i = 0; i < 5; ++ i) - { - // busy wait until system time changes: - while (time == time_prev) - time = System.currentTimeMillis (); - - System.out.println ("delta = " + (time - time_prev) + " ms"); - time_prev = time; - } - } - -} // end of class -// ---------------------------------------------------------------------------- diff --git a/timer/com/vladium/utils/timing/HRTimer.java b/timer/com/vladium/utils/timing/HRTimer.java deleted file mode 100644 index a3673a1..0000000 --- a/timer/com/vladium/utils/timing/HRTimer.java +++ /dev/null @@ -1,86 +0,0 @@ - -package com.vladium.utils.timing; - -// ---------------------------------------------------------------------------- -/** - * A package-private implementation of {@link ITimer} based around native - * getTime method. It will work on any platform for which a JNI - * implementation of "hrtlib" library is available.

- * - * {@link TimerFactory} acts as the Factory for this class.

- * - * MT-safety: an instance of this class is safe to be used within the same - * thread only. - * - * @author (C) Vlad Roubtsov, 2002 - */ -final class HRTimer implements ITimer, ITimerConstants -{ - // public: ................................................................ - - public void start () - { - if (DO_STATE_CHECKS) - { - if (m_state != STATE_READY) - throw new IllegalStateException (this + ": start() must be called from READY state, current state is " + STATE_NAMES [m_state]); - } - - if (DO_STATE_CHECKS) m_state = STATE_STARTED; - m_data = getTime (); - } - - public void stop () - { - // latch stop time in a local var before doing anything else: - final double data = getTime (); - - if (DO_STATE_CHECKS) - { - if (m_state != STATE_STARTED) - throw new IllegalStateException (this + ": stop() must be called from STARTED state, current state is " + STATE_NAMES [m_state]); - } - - m_data = data - m_data; - if (DO_STATE_CHECKS) m_state = STATE_STOPPED; - } - - public double getDuration () - { - if (DO_STATE_CHECKS) - { - if (m_state != STATE_STOPPED) - throw new IllegalStateException (this + ": getDuration() must be called from STOPPED state, current state is " + STATE_NAMES [m_state]); - } - - return m_data; - } - - public void reset () - { - if (DO_STATE_CHECKS) m_state = STATE_READY; - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - - /* - * This is supposed to return a fractional count of milliseconds elapsed - * since some indeterminate moment in the past. The exact starting point - * is not relevant because this timer class reports time differences only. - * - * JNI code in HRTIMER_LIB library is supposed to implement this. */ - private static native double getTime (); - - - private int m_state; // used to keep track of timer state - private double m_data; // timing data - - private static final String HRTIMER_LIB = "hrtlib"; - - -} // end of class -// ---------------------------------------------------------------------------- diff --git a/timer/com/vladium/utils/timing/ITimer.java b/timer/com/vladium/utils/timing/ITimer.java deleted file mode 100644 index 98029b1..0000000 --- a/timer/com/vladium/utils/timing/ITimer.java +++ /dev/null @@ -1,54 +0,0 @@ - -package com.vladium.utils.timing; - -// ---------------------------------------------------------------------------- -/** - * A simple interface for measuring time intervals. An instance of this goes - * through the following lifecycle states: - *

- *
ready - *
timer is ready to start a new measurement - *
started - *
timer has recorded the starting time interval point - *
stopped - *
timer has recorded the ending time interval point - *
- * See individual methods for details.

- * - * If this library has been compiled with {@link ITimerConstants#DO_STATE_CHECKS} - * set to 'true' the implementation will enforce this lifecycle model and throw - * IllegalStateException when it is violated. - * - * @author (C) Vlad Roubtsov, 2002 - */ -public interface ITimer -{ - // public: ................................................................ - - /** - * Starts a new time interval and advances this timer instance to 'started' - * state. This method can be called from 'ready' state only. */ - void start (); - - /** - * Terminates the current time interval and advances this timer instance to - * 'stopped' state. Interval duration will be available via - * {@link #getDuration()} method. This method can be called from 'started' - * state only. */ - void stop (); - - /** - * Returns the duration of the time interval that elapsed between the last - * calls to {@link #start()} and {@link #stop()}. This method can be called - * any number of times from 'stopped' state and will return the same value - * each time.

- * * @return interval duration in milliseconds */ - double getDuration (); - - /** - * This method can be called from any state and will reset this timer - * instance back to 'ready' state. */ - void reset (); - -} // end of interface -// ---------------------------------------------------------------------------- diff --git a/timer/com/vladium/utils/timing/ITimerConstants.java b/timer/com/vladium/utils/timing/ITimerConstants.java deleted file mode 100644 index 29435ae..0000000 --- a/timer/com/vladium/utils/timing/ITimerConstants.java +++ /dev/null @@ -1,31 +0,0 @@ - -package com.vladium.utils.timing; - -// ---------------------------------------------------------------------------- -/** - * A package-private collection of constants used by {@link ITimer} implementations - * in HRTimer and JavaSystemTimer classes. - * - * @author (C) Vlad Roubtsov, 2002 - */ -interface ITimerConstants -{ - // public: ................................................................ - - /** - * Conditional compilation flag to enable/disable state checking in timer - * implementations. Just about the only reason you might want to disable - * this is to reduce the timer overhead, but in practice the gain is very - * small. */ - static final boolean DO_STATE_CHECKS = true; - - /** - * Timer state enumeration. */ - static final int STATE_READY = 0, STATE_STARTED = 1, STATE_STOPPED = 2; - - /** - * User-friendly timer state names indexed by their state values. */ - static final String [] STATE_NAMES = {"READY", "STARTED", "STOPPED"}; - -} // end of interface -// ---------------------------------------------------------------------------- diff --git a/timer/com/vladium/utils/timing/JavaSystemTimer.java b/timer/com/vladium/utils/timing/JavaSystemTimer.java deleted file mode 100644 index e3f3b48..0000000 --- a/timer/com/vladium/utils/timing/JavaSystemTimer.java +++ /dev/null @@ -1,74 +0,0 @@ - -package com.vladium.utils.timing; - -// ---------------------------------------------------------------------------- -/** - * A package-private implementation of {@link ITimer} based around Java system - * timer [System.currentTimeMillis() method]. It is used when - * HRTimer implementation is unavailable.

- * - * {@link TimerFactory} acts as the Factory for this class.

- * - * MT-safety: an instance of this class is safe to be used within the same - * thread only. - * - * @author (C) Vlad Roubtsov, 2002 - */ -final class JavaSystemTimer implements ITimer, ITimerConstants -{ - // public: ................................................................ - - public void start () - { - if (DO_STATE_CHECKS) - { - if (m_state != STATE_READY) - throw new IllegalStateException (this + ": start() must be called from READY state, current state is " + STATE_NAMES [m_state]); - } - - if (DO_STATE_CHECKS) m_state = STATE_STARTED; - m_data = System.currentTimeMillis (); - } - - public void stop () - { - // latch stop time in a local var before doing anything else: - final long data = System.currentTimeMillis (); - - if (DO_STATE_CHECKS) - { - if (m_state != STATE_STARTED) - throw new IllegalStateException (this + ": stop() must be called from STARTED state, current state is " + STATE_NAMES [m_state]); - } - - m_data = data - m_data; - if (DO_STATE_CHECKS) m_state = STATE_STOPPED; - } - - public double getDuration () - { - if (DO_STATE_CHECKS) - { - if (m_state != STATE_STOPPED) - throw new IllegalStateException (this + ": getDuration() must be called from STOPPED state, current state is " + STATE_NAMES [m_state]); - } - - return m_data; - } - - public void reset () - { - if (DO_STATE_CHECKS) m_state = STATE_READY; - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - - private int m_state; // used to keep track of timer state - private long m_data; // timing data - -} // end of class -// ---------------------------------------------------------------------------- diff --git a/timer/com/vladium/utils/timing/TimerFactory.java b/timer/com/vladium/utils/timing/TimerFactory.java deleted file mode 100644 index ae127c5..0000000 --- a/timer/com/vladium/utils/timing/TimerFactory.java +++ /dev/null @@ -1,74 +0,0 @@ - -package com.vladium.utils.timing; - -// ---------------------------------------------------------------------------- -/** - * This non-instantiable non-extendible class acts as a Factory for {@link ITimer} - * implementations. - * - * @author (C) Vlad Roubtsov, 2002 - */ -public abstract class TimerFactory -{ - // public: ................................................................ - - private static final String HRTIMER_LIB = "hrtlib"; - - /** - * Creates a new instance of {@link ITimer} which is returned in 'ready' - * state. If the JNI-based/high-resolution implementation is not available - * this will return an instance of JavaSystemTimer, so this - * method is guaranteed not to fail. - * - * @return ITimer a new timer instance in 'ready' state [never null] */ - - public static void initialize(String path) { - - UnsatisfiedLinkError exception = null; - - try { - System.loadLibrary (HRTIMER_LIB); - } catch (UnsatisfiedLinkError e) { - if(path != null) { - try { - System.load(path); - } catch (UnsatisfiedLinkError ex) { - exception = ex; - } - } else { - exception = e; - } - } - - if(exception != null) { - System.out.println ("native lib '" + HRTIMER_LIB - + "' not found in 'java.library.path': " - + System.getProperty ("java.library.path") - +path==null?"":(" or in "+path)); - - throw exception; // re-throw - } - } - - public static ITimer newTimer () - { -// try -// { - return new HRTimer (); -// } -// catch (Throwable t) -// { -// return new JavaSystemTimer (); -// } - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - - private TimerFactory () {} // prevent subclassing - -} // end of class -// ---------------------------------------------------------------------------- diff --git a/timer/native/com_vladium_utils_timing_HRTimer.c b/timer/native/com_vladium_utils_timing_HRTimer.c deleted file mode 100644 index 647837d..0000000 --- a/timer/native/com_vladium_utils_timing_HRTimer.c +++ /dev/null @@ -1,71 +0,0 @@ -/* ------------------------------------------------------------------------- */ -/* - * A win32 implementation of JNI methods in com.vladium.utils.timing.HRTimer - * class. The author compiled it using Microsoft Visual C++ but the code - * should be easy to use with any compiler for win32 platform. - * - * For simplicity, this implementaion assumes JNI 1.2+ and omits error handling. - * - * (C) 2002, Vladimir Roubtsov [vroubtsov@illinoisalumni.org] - */ -/* ------------------------------------------------------------------------- */ - -#if !defined NDEBUG -#include -#endif // NDEBUG - -#include - -#include "com_vladium_utils_timing_HRTimer.h" - -// scale factor for converting a performancce counter reading into milliseconds: -static jdouble s_scaleFactor; - -/* ------------------------------------------------------------------------- */ - -/* - * This method was added in JNI 1.2. It is executed once before any other - * methods are called and is ostensibly for negotiating JNI spec versions, but - * can also be conveniently used for initializing variables that will not - * change throughout the lifetime of this process. - */ -JNIEXPORT jint JNICALL -JNI_OnLoad (JavaVM * vm, void * reserved) -{ - LARGE_INTEGER counterFrequency; - - QueryPerformanceFrequency (& counterFrequency); - - // NOTE: counterFrequency will be zero for a machine that does not have - // support for a high-resolution counter. This is only likely for very - // old hardware but for a robust implementation you should handle this - // case. - -#if !defined NDEBUG - printf ("PCFrequency called: %I64d\n", counterFrequency.QuadPart); -#endif - - s_scaleFactor = counterFrequency.QuadPart / 1000.0; - - - return JNI_VERSION_1_2; -} -/* ......................................................................... */ - -/* - * Class: com_vladium_utils_timing_HRTimer - * Method: getTime - * Signature: ()D - */ -JNIEXPORT jdouble JNICALL -Java_com_vladium_utils_timing_HRTimer_getTime (JNIEnv * e, jclass cls) -{ - LARGE_INTEGER counterReading; - - QueryPerformanceCounter (& counterReading); - - return counterReading.QuadPart / s_scaleFactor; -} - -/* ------------------------------------------------------------------------- */ -/* end of file */ diff --git a/timer/native/com_vladium_utils_timing_HRTimer.h b/timer/native/com_vladium_utils_timing_HRTimer.h deleted file mode 100644 index 357db0d..0000000 --- a/timer/native/com_vladium_utils_timing_HRTimer.h +++ /dev/null @@ -1,22 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class com_vladium_utils_timing_HRTimer */ - -#ifndef _Included_com_vladium_utils_timing_HRTimer -#define _Included_com_vladium_utils_timing_HRTimer -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Class: com_vladium_utils_timing_HRTimer - * Method: getTime - * Signature: ()D - */ -JNIEXPORT jdouble JNICALL -Java_com_vladium_utils_timing_HRTimer_getTime (JNIEnv *, jclass); - -#ifdef __cplusplus -} -#endif -#endif