|
|
@ -27,33 +27,23 @@ import java.util.HashMap; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class DecompilerContext { |
|
|
|
public class DecompilerContext { |
|
|
|
|
|
|
|
|
|
|
|
public static final String CURRENT_CLASS = "CURRENT_CLASS"; |
|
|
|
public static final String CURRENT_CLASS = "CURRENT_CLASS"; |
|
|
|
|
|
|
|
public static final String CURRENT_CLASS_NODE = "CURRENT_CLASS_NODE"; |
|
|
|
public static final String CURRENT_METHOD = "CURRENT_METHOD"; |
|
|
|
public static final String CURRENT_METHOD = "CURRENT_METHOD"; |
|
|
|
public static final String CURRENT_METHOD_DESCRIPTOR = "CURRENT_METHOD_DESCRIPTOR"; |
|
|
|
public static final String CURRENT_METHOD_DESCRIPTOR = "CURRENT_METHOD_DESCRIPTOR"; |
|
|
|
public static final String CURRENT_VAR_PROCESSOR = "CURRENT_VAR_PROCESSOR"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final String CURRENT_CLASSNODE = "CURRENT_CLASSNODE"; |
|
|
|
|
|
|
|
public static final String CURRENT_METHOD_WRAPPER = "CURRENT_METHOD_WRAPPER"; |
|
|
|
public static final String CURRENT_METHOD_WRAPPER = "CURRENT_METHOD_WRAPPER"; |
|
|
|
|
|
|
|
public static final String CURRENT_VAR_PROCESSOR = "CURRENT_VAR_PROCESSOR"; |
|
|
|
|
|
|
|
|
|
|
|
private static ThreadLocal<DecompilerContext> currentContext = new ThreadLocal<DecompilerContext>(); |
|
|
|
private static ThreadLocal<DecompilerContext> currentContext = new ThreadLocal<DecompilerContext>(); |
|
|
|
|
|
|
|
|
|
|
|
private final Map<String, Object> properties; |
|
|
|
private final Map<String, Object> properties; |
|
|
|
|
|
|
|
private StructContext structContext; |
|
|
|
private StructContext structcontext; |
|
|
|
private ImportCollector importCollector; |
|
|
|
|
|
|
|
private VarNamesCollector varNamescollector; |
|
|
|
private ImportCollector impcollector; |
|
|
|
private CounterContainer counterContainer; |
|
|
|
|
|
|
|
private ClassesProcessor classProcessor; |
|
|
|
private VarNamesCollector varncollector; |
|
|
|
private PoolInterceptor poolInterceptor; |
|
|
|
|
|
|
|
|
|
|
|
private CounterContainer countercontainer; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ClassesProcessor classprocessor; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private PoolInterceptor poolinterceptor; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private IFernflowerLogger logger; |
|
|
|
private IFernflowerLogger logger; |
|
|
|
|
|
|
|
|
|
|
|
private DecompilerContext(Map<String, Object> properties) { |
|
|
|
private DecompilerContext(Map<String, Object> properties) { |
|
|
@ -88,52 +78,52 @@ public class DecompilerContext { |
|
|
|
return "1".equals(getCurrentContext().properties.get(key)); |
|
|
|
return "1".equals(getCurrentContext().properties.get(key)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static ImportCollector getImpcollector() { |
|
|
|
public static ImportCollector getImportCollector() { |
|
|
|
return getCurrentContext().impcollector; |
|
|
|
return getCurrentContext().importCollector; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void setImpcollector(ImportCollector impcollector) { |
|
|
|
public static void setImportCollector(ImportCollector importCollector) { |
|
|
|
getCurrentContext().impcollector = impcollector; |
|
|
|
getCurrentContext().importCollector = importCollector; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static VarNamesCollector getVarncollector() { |
|
|
|
public static VarNamesCollector getVarNamesCollector() { |
|
|
|
return getCurrentContext().varncollector; |
|
|
|
return getCurrentContext().varNamescollector; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void setVarncollector(VarNamesCollector varncollector) { |
|
|
|
public static void setVarNamesCollector(VarNamesCollector varNamesCollector) { |
|
|
|
getCurrentContext().varncollector = varncollector; |
|
|
|
getCurrentContext().varNamescollector = varNamesCollector; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static StructContext getStructcontext() { |
|
|
|
public static StructContext getStructContext() { |
|
|
|
return getCurrentContext().structcontext; |
|
|
|
return getCurrentContext().structContext; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void setStructcontext(StructContext structcontext) { |
|
|
|
public static void setStructContext(StructContext structContext) { |
|
|
|
getCurrentContext().structcontext = structcontext; |
|
|
|
getCurrentContext().structContext = structContext; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static CounterContainer getCountercontainer() { |
|
|
|
public static CounterContainer getCounterContainer() { |
|
|
|
return getCurrentContext().countercontainer; |
|
|
|
return getCurrentContext().counterContainer; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void setCountercontainer(CounterContainer countercontainer) { |
|
|
|
public static void setCounterContainer(CounterContainer counterContainer) { |
|
|
|
getCurrentContext().countercontainer = countercontainer; |
|
|
|
getCurrentContext().counterContainer = counterContainer; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static ClassesProcessor getClassprocessor() { |
|
|
|
public static ClassesProcessor getClassProcessor() { |
|
|
|
return getCurrentContext().classprocessor; |
|
|
|
return getCurrentContext().classProcessor; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void setClassprocessor(ClassesProcessor classprocessor) { |
|
|
|
public static void setClassProcessor(ClassesProcessor classProcessor) { |
|
|
|
getCurrentContext().classprocessor = classprocessor; |
|
|
|
getCurrentContext().classProcessor = classProcessor; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static PoolInterceptor getPoolInterceptor() { |
|
|
|
public static PoolInterceptor getPoolInterceptor() { |
|
|
|
return getCurrentContext().poolinterceptor; |
|
|
|
return getCurrentContext().poolInterceptor; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void setPoolInterceptor(PoolInterceptor poolinterceptor) { |
|
|
|
public static void setPoolInterceptor(PoolInterceptor poolinterceptor) { |
|
|
|
getCurrentContext().poolinterceptor = poolinterceptor; |
|
|
|
getCurrentContext().poolInterceptor = poolinterceptor; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static IFernflowerLogger getLogger() { |
|
|
|
public static IFernflowerLogger getLogger() { |
|
|
@ -141,13 +131,6 @@ public class DecompilerContext { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void setLogger(IFernflowerLogger logger) { |
|
|
|
public static void setLogger(IFernflowerLogger logger) { |
|
|
|
getCurrentContext().logger = logger; |
|
|
|
|
|
|
|
setLogSeverity(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void setLogSeverity() { |
|
|
|
|
|
|
|
IFernflowerLogger logger = getCurrentContext().logger; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (logger != null) { |
|
|
|
if (logger != null) { |
|
|
|
String severity = (String)getProperty(IFernflowerPreferences.LOG_LEVEL); |
|
|
|
String severity = (String)getProperty(IFernflowerPreferences.LOG_LEVEL); |
|
|
|
if (severity != null) { |
|
|
|
if (severity != null) { |
|
|
@ -157,6 +140,7 @@ public class DecompilerContext { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
getCurrentContext().logger = logger; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static String getNewLineSeparator() { |
|
|
|
public static String getNewLineSeparator() { |
|
|
|