From 8776a8ba38123c822530e5f659c626c8db616217 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 24 Sep 2014 01:00:54 -0400 Subject: HOW DO I WRITE SO MANY BUGS?!? --- test/cuchaz/enigma/TestSourceIndex.java | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 test/cuchaz/enigma/TestSourceIndex.java (limited to 'test/cuchaz/enigma/TestSourceIndex.java') diff --git a/test/cuchaz/enigma/TestSourceIndex.java b/test/cuchaz/enigma/TestSourceIndex.java new file mode 100644 index 0000000..dc6ca7e --- /dev/null +++ b/test/cuchaz/enigma/TestSourceIndex.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2014 Jeff Martin. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + * + * Contributors: + * Jeff Martin - initial API and implementation + ******************************************************************************/ +package cuchaz.enigma; + +import java.io.File; +import java.util.Set; + +import org.junit.Test; + +import com.google.common.collect.Sets; +import com.strobel.decompiler.languages.java.ast.CompilationUnit; + +import cuchaz.enigma.mapping.ClassEntry; + +public class TestSourceIndex +{ + @Test + public void indexEverything( ) + throws Exception + { + Deobfuscator deobfuscator = new Deobfuscator( new File( "input/1.8.jar" ) ); + + // get all classes that aren't inner classes + Set classEntries = Sets.newHashSet(); + for( ClassEntry obfClassEntry : deobfuscator.getJarIndex().getObfClassEntries() ) + { + if( !obfClassEntry.isInnerClass() ) + { + classEntries.add( obfClassEntry ); + } + } + + for( ClassEntry obfClassEntry : classEntries ) + { + try + { + CompilationUnit tree = deobfuscator.getSourceTree( obfClassEntry.getName() ); + String source = deobfuscator.getSource( tree ); + deobfuscator.getSourceIndex( tree, source ); + } + catch( Throwable t ) + { + throw new Error( "Unable to index " + obfClassEntry, t ); + } + } + } +} -- cgit v1.2.3 From 035e73fba69ab06172ae9d784b9e0e4fffeb8388 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 8 Oct 2014 23:54:08 -0400 Subject: relicense as LGPL --- test/cuchaz/enigma/TestSourceIndex.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'test/cuchaz/enigma/TestSourceIndex.java') diff --git a/test/cuchaz/enigma/TestSourceIndex.java b/test/cuchaz/enigma/TestSourceIndex.java index dc6ca7e..408dcde 100644 --- a/test/cuchaz/enigma/TestSourceIndex.java +++ b/test/cuchaz/enigma/TestSourceIndex.java @@ -1,10 +1,9 @@ /******************************************************************************* * Copyright (c) 2014 Jeff Martin. - * * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Public License v3.0 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/gpl.html + * are made available under the terms of the GNU Lesser General Public + * License v3.0 which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl.html * * Contributors: * Jeff Martin - initial API and implementation -- cgit v1.2.3 From 812e2a4630ef01463ff153ba5ffae675e8ac24ac Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 9 Oct 2014 19:37:19 -0400 Subject: reverting to GPL license --- test/cuchaz/enigma/TestSourceIndex.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'test/cuchaz/enigma/TestSourceIndex.java') diff --git a/test/cuchaz/enigma/TestSourceIndex.java b/test/cuchaz/enigma/TestSourceIndex.java index 408dcde..dc6ca7e 100644 --- a/test/cuchaz/enigma/TestSourceIndex.java +++ b/test/cuchaz/enigma/TestSourceIndex.java @@ -1,9 +1,10 @@ /******************************************************************************* * Copyright (c) 2014 Jeff Martin. + * * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser General Public - * License v3.0 which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl.html + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html * * Contributors: * Jeff Martin - initial API and implementation -- cgit v1.2.3 From 959cb5fd4f9586ec3bd265b452fe25fe1db82e3f Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 13 Jan 2015 23:25:04 -0500 Subject: source format change don't hate me too much if you were planning a big merge. =P --- test/cuchaz/enigma/TestSourceIndex.java | 36 +++++++++++++-------------------- 1 file changed, 14 insertions(+), 22 deletions(-) (limited to 'test/cuchaz/enigma/TestSourceIndex.java') diff --git a/test/cuchaz/enigma/TestSourceIndex.java b/test/cuchaz/enigma/TestSourceIndex.java index dc6ca7e..fb385e0 100644 --- a/test/cuchaz/enigma/TestSourceIndex.java +++ b/test/cuchaz/enigma/TestSourceIndex.java @@ -21,35 +21,27 @@ import com.strobel.decompiler.languages.java.ast.CompilationUnit; import cuchaz.enigma.mapping.ClassEntry; -public class TestSourceIndex -{ +public class TestSourceIndex { + @Test - public void indexEverything( ) - throws Exception - { - Deobfuscator deobfuscator = new Deobfuscator( new File( "input/1.8.jar" ) ); + public void indexEverything() throws Exception { + Deobfuscator deobfuscator = new Deobfuscator(new File("input/1.8.jar")); // get all classes that aren't inner classes Set classEntries = Sets.newHashSet(); - for( ClassEntry obfClassEntry : deobfuscator.getJarIndex().getObfClassEntries() ) - { - if( !obfClassEntry.isInnerClass() ) - { - classEntries.add( obfClassEntry ); + for (ClassEntry obfClassEntry : deobfuscator.getJarIndex().getObfClassEntries()) { + if (!obfClassEntry.isInnerClass()) { + classEntries.add(obfClassEntry); } } - for( ClassEntry obfClassEntry : classEntries ) - { - try - { - CompilationUnit tree = deobfuscator.getSourceTree( obfClassEntry.getName() ); - String source = deobfuscator.getSource( tree ); - deobfuscator.getSourceIndex( tree, source ); - } - catch( Throwable t ) - { - throw new Error( "Unable to index " + obfClassEntry, t ); + for (ClassEntry obfClassEntry : classEntries) { + try { + CompilationUnit tree = deobfuscator.getSourceTree(obfClassEntry.getName()); + String source = deobfuscator.getSource(tree); + deobfuscator.getSourceIndex(tree, source); + } catch (Throwable t) { + throw new Error("Unable to index " + obfClassEntry, t); } } } -- cgit v1.2.3 From 2fbcf8e5c4eec0aa4a4fc59c7cc8abac33b1429c Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 19 Jan 2015 22:22:57 -0500 Subject: solved tricky issue with incorrect translation of fields/methods referenced by a subclass instead of the declaring class --- test/cuchaz/enigma/TestSourceIndex.java | 1 + 1 file changed, 1 insertion(+) (limited to 'test/cuchaz/enigma/TestSourceIndex.java') diff --git a/test/cuchaz/enigma/TestSourceIndex.java b/test/cuchaz/enigma/TestSourceIndex.java index fb385e0..ba7fc79 100644 --- a/test/cuchaz/enigma/TestSourceIndex.java +++ b/test/cuchaz/enigma/TestSourceIndex.java @@ -23,6 +23,7 @@ import cuchaz.enigma.mapping.ClassEntry; public class TestSourceIndex { + // TEMP @Test public void indexEverything() throws Exception { Deobfuscator deobfuscator = new Deobfuscator(new File("input/1.8.jar")); -- cgit v1.2.3 From 448685653e90415ebe10b08e8335462b81c30421 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 2 Feb 2015 21:26:10 -0500 Subject: fix issue with bridge methods --- test/cuchaz/enigma/TestSourceIndex.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/cuchaz/enigma/TestSourceIndex.java') diff --git a/test/cuchaz/enigma/TestSourceIndex.java b/test/cuchaz/enigma/TestSourceIndex.java index ba7fc79..70a5ee4 100644 --- a/test/cuchaz/enigma/TestSourceIndex.java +++ b/test/cuchaz/enigma/TestSourceIndex.java @@ -11,8 +11,8 @@ ******************************************************************************/ package cuchaz.enigma; -import java.io.File; import java.util.Set; +import java.util.jar.JarFile; import org.junit.Test; @@ -26,7 +26,7 @@ public class TestSourceIndex { // TEMP @Test public void indexEverything() throws Exception { - Deobfuscator deobfuscator = new Deobfuscator(new File("input/1.8.jar")); + Deobfuscator deobfuscator = new Deobfuscator(new JarFile("input/1.8.jar")); // get all classes that aren't inner classes Set classEntries = Sets.newHashSet(); -- cgit v1.2.3 From 818716acb3992e602e01725b6e151c1eb0f6c2e2 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 5 Feb 2015 23:52:55 -0500 Subject: fix test code formatting and disable the super duper slow test for now --- test/cuchaz/enigma/TestSourceIndex.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test/cuchaz/enigma/TestSourceIndex.java') diff --git a/test/cuchaz/enigma/TestSourceIndex.java b/test/cuchaz/enigma/TestSourceIndex.java index 70a5ee4..357acb6 100644 --- a/test/cuchaz/enigma/TestSourceIndex.java +++ b/test/cuchaz/enigma/TestSourceIndex.java @@ -24,8 +24,9 @@ import cuchaz.enigma.mapping.ClassEntry; public class TestSourceIndex { // TEMP - @Test - public void indexEverything() throws Exception { + //@Test + public void indexEverything() + throws Exception { Deobfuscator deobfuscator = new Deobfuscator(new JarFile("input/1.8.jar")); // get all classes that aren't inner classes -- cgit v1.2.3