Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected AbstractResultSaver(DecompilationResult result) {
protected AbstractResultSaver() {
this(new DecompilationResult());
}

public Map<String, String> getResults() {
return this.results;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ public static Map<String, String> defaults() {
public static Map<String, String> lineNumbers() {
return Map.of(WRITE_LINE_NUMBERS, TRUE, WRITE_METADATA, FALSE);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,102 +37,102 @@ public class StandardTransformersTest {
public void testDecompileCFR() throws Exception {
testDecompile("/TestCompactCFR.txt", ENGINE_CFR, CFRSettings.defaults());
}

@Test
public void testDecompileCFRFromClassPath() throws Exception {
testDecompileFromClassPath("/TestThrowableCFR.txt", ENGINE_CFR, CFRSettings.defaults());
}

@Test
public void testDecompileProcyonFromClassPath() throws Exception {
testDecompileFromClassPath("/TestThrowableProcyon.txt", ENGINE_PROCYON, MapDecompilerSettings.defaults());
}

@Test
public void testDecompileProcyon() throws Exception {
testDecompile("/TestCompactProcyon.txt", ENGINE_PROCYON, MapDecompilerSettings.defaults());
}

@Test
public void testDecompileProcyonByteCode() throws Exception {
testDecompile("/TestCompactProcyonByteCode.txt", ENGINE_PROCYON, MapDecompilerSettings.byteCodeSettings());
}

@Test
public void testDecompileJADXFromClassPath() throws Exception {
testDecompileFromClassPath("/TestThrowableJADX.txt", ENGINE_JADX, Collections.emptyMap());
}

@Test
public void testDecompileJADX() throws Exception {
testDecompile("/TestCompactJADX.txt", ENGINE_JADX, Collections.emptyMap());
}

@Test
public void testDecompileJADXWithLineNumbers() throws Exception {
testDecompile("/TestCompactJADXWithLineNumbers.txt", ENGINE_JADX, MapJadxArgs.lineNumbers());
}

@Test
public void testDecompileFernflower() throws Exception {
testDecompile("/TestCompactFernflower.txt", ENGINE_FERNFLOWER, Collections.emptyMap());
}

@Test
public void testDecompileFernflowerFromClassPath() throws Exception {
testDecompileFromClassPath("/TestThrowableFernflower.txt", ENGINE_FERNFLOWER, Collections.emptyMap());
}

@Test
public void testDecompileFernflowerWithLineNumbers() throws Exception {
testDecompile("/TestCompactFernflowerWithLineNumbers.txt", ENGINE_FERNFLOWER, FernflowerSettings.lineNumbers());
}

@Test
public void testDecompileVineflower() throws Exception {
testDecompile("/TestCompactVineflower.txt", ENGINE_VINEFLOWER, Collections.emptyMap());
}

@Test
public void testDecompileVineflowerFromClassPath() throws Exception {
testDecompileFromClassPath("/TestThrowableVineflower.txt", ENGINE_VINEFLOWER, Collections.emptyMap());
}

@Test
public void testDecompileVineflowerWithLineNumbers() throws Exception {
testDecompile("/TestCompactVineflowerWithLineNumbers.txt", ENGINE_VINEFLOWER, VineflowerSettings.lineNumbers());
}

@Test
public void testDecompileJDCoreV0() throws Exception {
testDecompile("/TestCompactJDCoreV0.txt", ENGINE_JD_CORE_V0, JDSettings.defaults());
}

@Test
public void testDecompileJDCoreV0FromClassPath() throws Exception {
testDecompileFromClassPath("/TestThrowableJDCoreV0.txt", ENGINE_JD_CORE_V0, JDSettings.defaults());
}

@Test
public void testDecompileJDCoreV0WithLineNumbers() throws Exception {
testDecompile("/TestCompactJDCoreV0WithLineNumbers.txt", ENGINE_JD_CORE_V0, JDSettings.lineNumbers());
}

@Test
public void testDecompileJDCoreV1() throws Exception {
testDecompile("/TestCompactJDCoreV1.txt", ENGINE_JD_CORE_V1, JDSettings.defaults());
}

@Test
public void testDecompileJDCoreV1FromClassPath() throws Exception {
testDecompileFromClassPath("/TestThrowableJDCoreV1.txt", ENGINE_JD_CORE_V1, JDSettings.defaults());
}

@Test
public void testDecompileJDCoreV1WithLineNumbers() throws Exception {
testDecompile("/TestCompactJDCoreV1WithLineNumbers.txt", ENGINE_JD_CORE_V1, JDSettings.lineNumbers());
}

private void testDecompile(String path, String engineName, Map<String, String> preferences)
throws IOException, IllegalAccessException, InvocationTargetException, URISyntaxException {
URI resource = getClass().getResource("/test-compact-expand-inline.jar").toURI();
Expand All @@ -151,7 +151,7 @@ private void testDecompileFromClassPath(String path, String engineName, Map<Stri
DecompilationResult result = StandardTransformers.decompile(loader, internalName, preferences, engineName);
assertEqualsIgnoreEOL(getResourceAsString(path), result.getDecompiledOutput());
}

private void assertEqualsIgnoreEOL(String expected, String actual) {
assertEquals(expected.replaceAll("\s*\r?\n", "\n"), actual.replaceAll("\s*\r?\n", "\n"));
}
Expand Down