cleanup after review - use option for decompiler banner text

master
Egor.Ushakov 10 years ago
parent 1e3d5276a8
commit 37422ead1c
  1. 5
      src/org/jetbrains/java/decompiler/main/Fernflower.java
  2. 5
      src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java
  3. 4
      src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java
  4. 4
      src/org/jetbrains/java/decompiler/main/extern/IResultSaver.java
  5. 7
      src/org/jetbrains/java/decompiler/struct/ContextUnit.java
  6. 4
      src/org/jetbrains/java/decompiler/struct/IDecompiledData.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);

@ -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();

@ -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");

@ -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);

@ -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);
}
}

@ -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);
}

Loading…
Cancel
Save