summaryrefslogtreecommitdiffstats
path: root/src/org/jetbrains
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/jetbrains')
-rw-r--r--src/org/jetbrains/java/decompiler/main/DecompilerContext.java51
-rw-r--r--src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java2
-rw-r--r--src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java50
-rw-r--r--src/org/jetbrains/java/decompiler/main/rels/MethodProcessorThread.java15
4 files changed, 55 insertions, 63 deletions
diff --git a/src/org/jetbrains/java/decompiler/main/DecompilerContext.java b/src/org/jetbrains/java/decompiler/main/DecompilerContext.java
index f9eb27f..b95d2d0 100644
--- a/src/org/jetbrains/java/decompiler/main/DecompilerContext.java
+++ b/src/org/jetbrains/java/decompiler/main/DecompilerContext.java
@@ -24,6 +24,8 @@ import org.jetbrains.java.decompiler.modules.renamer.PoolInterceptor;
import org.jetbrains.java.decompiler.struct.StructContext;
import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
public class DecompilerContext {
@@ -38,7 +40,7 @@ public class DecompilerContext {
private static ThreadLocal<DecompilerContext> currentContext = new ThreadLocal<DecompilerContext>();
- private HashMap<String, Object> properties = new HashMap<String, Object>();
+ private final Map<String, Object> properties;
private StructContext structcontext;
@@ -54,49 +56,16 @@ public class DecompilerContext {
private IFernflowerLogger logger;
-
- private DecompilerContext(HashMap<String, Object> properties) {
- this.properties.putAll(properties);
+ private DecompilerContext(Map<String, Object> properties) {
+ this.properties = properties;
}
- public static void initContext(HashMap<String, Object> propertiesCustom) {
-
- HashMap<String, Object> mapDefault = new HashMap<String, Object>();
-
- // default settings
- mapDefault.put(IFernflowerPreferences.DECOMPILE_INNER, "1");
- mapDefault.put(IFernflowerPreferences.DECOMPILE_CLASS_1_4, "1");
- mapDefault.put(IFernflowerPreferences.DECOMPILE_ASSERTIONS, "1");
- mapDefault.put(IFernflowerPreferences.REMOVE_BRIDGE, "1");
- mapDefault.put(IFernflowerPreferences.REMOVE_SYNTHETIC, "0");
- mapDefault.put(IFernflowerPreferences.HIDE_EMPTY_SUPER, "1");
- mapDefault.put(IFernflowerPreferences.HIDE_DEFAULT_CONSTRUCTOR, "1");
- mapDefault.put(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES, "0");
- mapDefault.put(IFernflowerPreferences.NO_EXCEPTIONS_RETURN, "1");
- mapDefault.put(IFernflowerPreferences.DECOMPILE_ENUM, "1");
- mapDefault.put(IFernflowerPreferences.FINALLY_DEINLINE, "1");
- mapDefault.put(IFernflowerPreferences.REMOVE_GETCLASS_NEW, "1");
- mapDefault.put(IFernflowerPreferences.LITERALS_AS_IS, "0");
- mapDefault.put(IFernflowerPreferences.ASCII_STRING_CHARACTERS, "0");
- mapDefault.put(IFernflowerPreferences.BOOLEAN_TRUE_ONE, "1");
- mapDefault.put(IFernflowerPreferences.SYNTHETIC_NOT_SET, "1");
- mapDefault.put(IFernflowerPreferences.UNDEFINED_PARAM_TYPE_OBJECT, "1");
-
- mapDefault.put(IFernflowerPreferences.USE_DEBUG_VARNAMES, "1");
- mapDefault.put(IFernflowerPreferences.MAX_PROCESSING_METHOD, "0");
-
- mapDefault.put(IFernflowerPreferences.REMOVE_EMPTY_RANGES, "1");
-
- mapDefault.put(IFernflowerPreferences.NEW_LINE_SEPARATOR, "0");
- mapDefault.put(IFernflowerPreferences.INDENT_STRING, " ");
-
- mapDefault.put(IFernflowerPreferences.IDEA_NOT_NULL_ANNOTATION, "1");
-
+ public static void initContext(Map<String, Object> propertiesCustom) {
+ Map<String, Object> properties = new HashMap<String, Object>(IFernflowerPreferences.DEFAULTS);
if (propertiesCustom != null) {
- mapDefault.putAll(propertiesCustom);
+ properties.putAll(propertiesCustom);
}
-
- currentContext.set(new DecompilerContext(mapDefault));
+ currentContext.set(new DecompilerContext(properties));
}
public static DecompilerContext getCurrentContext() {
@@ -182,7 +151,7 @@ public class DecompilerContext {
if (logger != null) {
String severity = (String)getProperty(IFernflowerPreferences.LOG_LEVEL);
if (severity != null) {
- Integer iSeverity = IFernflowerLogger.mapLogLevel.get(severity.toUpperCase());
+ Integer iSeverity = IFernflowerLogger.mapLogLevel.get(severity.toUpperCase(Locale.US));
if (iSeverity != null) {
logger.setSeverity(iSeverity);
}
diff --git a/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java b/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java
index 28bb4ee..bfb4e70 100644
--- a/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java
+++ b/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java
@@ -72,7 +72,7 @@ public class ConsoleDecompiler implements IBytecodeProvider, IDecompilatSaver {
if (isOption && arg.startsWith("-") &&
arg.length() > 5 && arg.charAt(4) == '=') {
- String value = arg.substring(5).toUpperCase();
+ String value = arg.substring(5).toUpperCase(Locale.US);
if ("TRUE".equals(value)) {
value = "1";
}
diff --git a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java
index 72283f7..2b55d24 100644
--- a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java
+++ b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java
@@ -15,8 +15,11 @@
*/
package org.jetbrains.java.decompiler.main.extern;
-public interface IFernflowerPreferences {
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+public interface IFernflowerPreferences {
String REMOVE_BRIDGE = "rbr";
String REMOVE_SYNTHETIC = "rsy";
String DECOMPILE_INNER = "din";
@@ -30,28 +33,51 @@ public interface IFernflowerPreferences {
String REMOVE_GETCLASS_NEW = "rgn";
String LITERALS_AS_IS = "lit";
String BOOLEAN_TRUE_ONE = "bto";
+ String ASCII_STRING_CHARACTERS = "asc";
String SYNTHETIC_NOT_SET = "nns";
String UNDEFINED_PARAM_TYPE_OBJECT = "uto";
String USE_DEBUG_VARNAMES = "udv";
- String MAX_PROCESSING_METHOD = "mpm";
String REMOVE_EMPTY_RANGES = "rer";
- String ASCII_STRING_CHARACTERS = "asc";
-
String FINALLY_DEINLINE = "fdi";
+ String IDEA_NOT_NULL_ANNOTATION = "inn";
+ String LAMBDA_TO_ANONYMOUS_CLASS = "lac";
- String FINALLY_CATCHALL = "FINALLY_CATCHALL";
- String FINALLY_SEMAPHOR = "FINALLY_SEMAPHOR";
-
+ String LOG_LEVEL = "log";
+ String MAX_PROCESSING_METHOD = "mpm";
String RENAME_ENTITIES = "ren";
String USER_RENAMER_CLASS = "urc";
-
- String LOG_LEVEL = "log";
-
String NEW_LINE_SEPARATOR = "nls";
- String IDEA_NOT_NULL_ANNOTATION = "inn";
- String LAMBDA_TO_ANONYMOUS_CLASS = "lac";
String INDENT_STRING = "ind";
String LINE_SEPARATOR_WIN = "\r\n";
String LINE_SEPARATOR_LIN = "\n";
+
+ Map<String, Object> DEFAULTS = Collections.unmodifiableMap(new HashMap<String, Object>() {{
+ put(REMOVE_BRIDGE, "1");
+ put(REMOVE_SYNTHETIC, "0");
+ put(DECOMPILE_INNER, "1");
+ put(DECOMPILE_CLASS_1_4, "1");
+ put(DECOMPILE_ASSERTIONS, "1");
+ put(HIDE_EMPTY_SUPER, "1");
+ put(HIDE_DEFAULT_CONSTRUCTOR, "1");
+ put(DECOMPILE_GENERIC_SIGNATURES, "0");
+ put(NO_EXCEPTIONS_RETURN, "1");
+ put(DECOMPILE_ENUM, "1");
+ put(REMOVE_GETCLASS_NEW, "1");
+ put(LITERALS_AS_IS, "0");
+ put(BOOLEAN_TRUE_ONE, "1");
+ put(ASCII_STRING_CHARACTERS, "0");
+ put(SYNTHETIC_NOT_SET, "1");
+ put(UNDEFINED_PARAM_TYPE_OBJECT, "1");
+ put(USE_DEBUG_VARNAMES, "1");
+ put(REMOVE_EMPTY_RANGES, "1");
+ put(FINALLY_DEINLINE, "1");
+ put(IDEA_NOT_NULL_ANNOTATION, "1");
+ put(LAMBDA_TO_ANONYMOUS_CLASS, "0");
+
+ put(MAX_PROCESSING_METHOD, "0");
+ put(RENAME_ENTITIES, "0");
+ put(NEW_LINE_SEPARATOR, "0");
+ put(INDENT_STRING, " ");
+ }});
}
diff --git a/src/org/jetbrains/java/decompiler/main/rels/MethodProcessorThread.java b/src/org/jetbrains/java/decompiler/main/rels/MethodProcessorThread.java
index da05640..0ac7c3f 100644
--- a/src/org/jetbrains/java/decompiler/main/rels/MethodProcessorThread.java
+++ b/src/org/jetbrains/java/decompiler/main/rels/MethodProcessorThread.java
@@ -135,17 +135,14 @@ public class MethodProcessorThread implements Runnable {
RootStatement root = DomHelper.parseGraph(graph);
- if (!DecompilerContext.getOption(IFernflowerPreferences.FINALLY_CATCHALL)) {
- FinallyProcessor fproc = new FinallyProcessor(varproc);
- while (fproc.iterateGraph(mt, root, graph)) {
+ FinallyProcessor fproc = new FinallyProcessor(varproc);
+ while (fproc.iterateGraph(mt, root, graph)) {
- //DotExporter.toDotFile(graph, new File("c:\\Temp\\fern2.dot"), true);
- //System.out.println(graph.toString());
-
- //System.out.println("~~~~~~~~~~~~~~~~~~~~~~ \r\n"+root.toJava());
+ //DotExporter.toDotFile(graph, new File("c:\\Temp\\fern2.dot"), true);
+ //System.out.println(graph.toString());
+ //System.out.println("~~~~~~~~~~~~~~~~~~~~~~ \r\n"+root.toJava());
- root = DomHelper.parseGraph(graph);
- }
+ root = DomHelper.parseGraph(graph);
}
// remove synchronized exception handler