summaryrefslogtreecommitdiffstats
path: root/src/org
diff options
context:
space:
mode:
authorEgor.Ushakov <egor.ushakov@jetbrains.com>2014-10-08 12:34:51 +0400
committerEgor.Ushakov <egor.ushakov@jetbrains.com>2014-10-08 12:35:14 +0400
commit37422ead1c72d95010a8bc1ecc4feb5fe73f2a5a (patch)
tree0fc5fae156f7ae95a8bd09612785283945a2e50c /src/org
parent1e3d5276a84d33a495b14da1977b7a47acbe2116 (diff)
downloadfernflower-37422ead1c72d95010a8bc1ecc4feb5fe73f2a5a.tar
fernflower-37422ead1c72d95010a8bc1ecc4feb5fe73f2a5a.tar.gz
fernflower-37422ead1c72d95010a8bc1ecc4feb5fe73f2a5a.tar.lz
fernflower-37422ead1c72d95010a8bc1ecc4feb5fe73f2a5a.tar.xz
fernflower-37422ead1c72d95010a8bc1ecc4feb5fe73f2a5a.zip
cleanup after review - use option for decompiler banner text
Diffstat (limited to 'src/org')
-rw-r--r--src/org/jetbrains/java/decompiler/main/Fernflower.java5
-rw-r--r--src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java5
-rw-r--r--src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java4
-rw-r--r--src/org/jetbrains/java/decompiler/main/extern/IResultSaver.java4
-rw-r--r--src/org/jetbrains/java/decompiler/struct/ContextUnit.java7
-rw-r--r--src/org/jetbrains/java/decompiler/struct/IDecompiledData.java4
6 files changed, 14 insertions, 15 deletions
diff --git a/src/org/jetbrains/java/decompiler/main/Fernflower.java b/src/org/jetbrains/java/decompiler/main/Fernflower.java
index 4988bc0..15baac5 100644
--- a/src/org/jetbrains/java/decompiler/main/Fernflower.java
+++ b/src/org/jetbrains/java/decompiler/main/Fernflower.java
@@ -80,11 +80,12 @@ public class Fernflower implements IDecompiledData {
}
@Override
- public TextBuffer getClassContent(StructClass cl) {
+ public String getClassContent(StructClass cl) {
try {
TextBuffer buffer = new TextBuffer(ClassesProcessor.AVERAGE_CLASS_SIZE);
+ buffer.append(DecompilerContext.getProperty(IFernflowerPreferences.BANNER).toString());
classesProcessor.writeClass(cl, buffer);
- return buffer;
+ return buffer.toString();
}
catch (Throwable ex) {
DecompilerContext.getLogger().writeMessage("Class " + cl.qualifiedName + " couldn't be fully decompiled.", ex);
diff --git a/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java b/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java
index 43cfafb..a486d9f 100644
--- a/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java
+++ b/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java
@@ -17,7 +17,6 @@ package org.jetbrains.java.decompiler.main.decompiler;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.main.Fernflower;
-import org.jetbrains.java.decompiler.main.TextBuffer;
import org.jetbrains.java.decompiler.main.extern.IBytecodeProvider;
import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger;
import org.jetbrains.java.decompiler.main.extern.IResultSaver;
@@ -182,12 +181,12 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver {
}
@Override
- public void saveClassFile(String path, String qualifiedName, String entryName, TextBuffer content) {
+ public void saveClassFile(String path, String qualifiedName, String entryName, String content) {
File file = new File(getAbsolutePath(path), entryName);
try {
Writer out = new OutputStreamWriter(new FileOutputStream(file), "UTF8");
try {
- out.write(content.toString());
+ out.write(content);
}
finally {
out.close();
diff --git a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java
index b5f6ac0..677d05d 100644
--- a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java
+++ b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java
@@ -54,6 +54,8 @@ public interface IFernflowerPreferences {
String NEW_LINE_SEPARATOR = "nls";
String INDENT_STRING = "ind";
+ String BANNER = "ban";
+
String LINE_SEPARATOR_WIN = "\r\n";
String LINE_SEPARATOR_LIN = "\n";
@@ -83,6 +85,8 @@ public interface IFernflowerPreferences {
put(BYTECODE_SOURCE_MAPPING, "0");
put(USE_DEBUG_LINE_NUMBERS, "0");
+ put(BANNER, "");
+
put(LOG_LEVEL, IFernflowerLogger.Severity.INFO.name());
put(MAX_PROCESSING_METHOD, "0");
put(RENAME_ENTITIES, "0");
diff --git a/src/org/jetbrains/java/decompiler/main/extern/IResultSaver.java b/src/org/jetbrains/java/decompiler/main/extern/IResultSaver.java
index 5b4b7e0..1e6a7d4 100644
--- a/src/org/jetbrains/java/decompiler/main/extern/IResultSaver.java
+++ b/src/org/jetbrains/java/decompiler/main/extern/IResultSaver.java
@@ -15,8 +15,6 @@
*/
package org.jetbrains.java.decompiler.main.extern;
-import org.jetbrains.java.decompiler.main.TextBuffer;
-
import java.util.jar.Manifest;
public interface IResultSaver {
@@ -24,7 +22,7 @@ public interface IResultSaver {
void copyFile(String source, String path, String entryName);
- void saveClassFile(String path, String qualifiedName, String entryName, TextBuffer content);
+ void saveClassFile(String path, String qualifiedName, String entryName, String content);
void createArchive(String path, String archiveName, Manifest manifest);
diff --git a/src/org/jetbrains/java/decompiler/struct/ContextUnit.java b/src/org/jetbrains/java/decompiler/struct/ContextUnit.java
index dd68544..819ae64 100644
--- a/src/org/jetbrains/java/decompiler/struct/ContextUnit.java
+++ b/src/org/jetbrains/java/decompiler/struct/ContextUnit.java
@@ -15,7 +15,6 @@
*/
package org.jetbrains.java.decompiler.struct;
-import org.jetbrains.java.decompiler.main.TextBuffer;
import org.jetbrains.java.decompiler.main.extern.IResultSaver;
import org.jetbrains.java.decompiler.struct.lazy.LazyLoader;
import org.jetbrains.java.decompiler.struct.lazy.LazyLoader.Link;
@@ -111,7 +110,7 @@ public class ContextUnit {
StructClass cl = classes.get(i);
String entryName = decompiledData.getClassEntryName(cl, classEntries.get(i));
if (entryName != null) {
- TextBuffer content = decompiledData.getClassContent(cl);
+ String content = decompiledData.getClassContent(cl);
if (content != null) {
resultSaver.saveClassFile(filename, cl.qualifiedName, entryName, content);
}
@@ -143,8 +142,8 @@ public class ContextUnit {
StructClass cl = classes.get(i);
String entryName = decompiledData.getClassEntryName(cl, classEntries.get(i));
if (entryName != null) {
- TextBuffer content = decompiledData.getClassContent(cl);
- resultSaver.saveClassEntry(archivePath, filename, cl.qualifiedName, entryName, content.toString());
+ String content = decompiledData.getClassContent(cl);
+ resultSaver.saveClassEntry(archivePath, filename, cl.qualifiedName, entryName, content);
}
}
diff --git a/src/org/jetbrains/java/decompiler/struct/IDecompiledData.java b/src/org/jetbrains/java/decompiler/struct/IDecompiledData.java
index 25f1f88..f309b0e 100644
--- a/src/org/jetbrains/java/decompiler/struct/IDecompiledData.java
+++ b/src/org/jetbrains/java/decompiler/struct/IDecompiledData.java
@@ -15,11 +15,9 @@
*/
package org.jetbrains.java.decompiler.struct;
-import org.jetbrains.java.decompiler.main.TextBuffer;
-
public interface IDecompiledData {
String getClassEntryName(StructClass cl, String entryname);
- TextBuffer getClassContent(StructClass cl);
+ String getClassContent(StructClass cl);
}