java-decompiler: post-import cleanup (typos)

This commit is contained in:
Roman Shevchenko 2014-09-01 16:08:53 +04:00
parent 3104531729
commit 984af2e7d0
39 changed files with 115 additions and 131 deletions

View File

@ -191,7 +191,7 @@ public class AssertProcessor {
AssertExprent asexpr = new AssertExprent(lstParams);
Statement newstat = new BasicBlockStatement(new BasicBlock(
DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
newstat.setExprents(Arrays.asList(new Exprent[]{asexpr}));
Statement first = stat.getFirst();

View File

@ -263,7 +263,7 @@ public class ClassReference14Processor {
((ConstExprent)headexpr.getLstOperands().get(1)).getConsttype().equals(VarType.VARTYPE_NULL)) {
FieldExprent field = (FieldExprent)headexpr.getLstOperands().get(0);
ClassNode fieldnode = DecompilerContext.getClassprocessor().getMapRootClasses().get(field.getClassname());
ClassNode fieldnode = DecompilerContext.getClassProcessor().getMapRootClasses().get(field.getClassname());
if (fieldnode != null && fieldnode.classStruct.qualifiedName.equals(wrapper.getClassStruct().qualifiedName)) { // source class
StructField fd =

View File

@ -122,8 +122,8 @@ public class ClassWriter {
boolean lambda_to_anonymous = DecompilerContext.getOption(IFernflowerPreferences.LAMBDA_TO_ANONYMOUS_CLASS);
ClassNode nodeold = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASSNODE);
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASSNODE, node);
ClassNode nodeold = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE);
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASS_NODE, node);
ClassWrapper wrapper = node_content.wrapper;
StructClass cl = wrapper.getClassStruct();
@ -206,7 +206,7 @@ public class ClassWriter {
writer.flush();
}
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASSNODE, nodeold);
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASS_NODE, nodeold);
DecompilerContext.getLogger().endWriteClass();
}
@ -216,8 +216,8 @@ public class ClassWriter {
ClassWrapper wrapper = node.wrapper;
StructClass cl = wrapper.getClassStruct();
ClassNode nodeold = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASSNODE);
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASSNODE, node);
ClassNode nodeold = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE);
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASS_NODE, node);
// last minute processing
invokeProcessors(node);
@ -329,7 +329,7 @@ public class ClassWriter {
}
writer.flush();
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASSNODE, nodeold);
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASS_NODE, nodeold);
DecompilerContext.getLogger().endWriteClass();
}

View File

@ -243,15 +243,15 @@ public class ClassesProcessor {
}
try {
DecompilerContext.setImpcollector(new ImportCollector(root));
DecompilerContext.setCountercontainer(new CounterContainer());
DecompilerContext.setImportCollector(new ImportCollector(root));
DecompilerContext.setCounterContainer(new CounterContainer());
// lambda processing
LambdaProcessor lambda_proc = new LambdaProcessor();
lambda_proc.processClass(root);
// add simple class names to implicit import
addClassnameToImport(root, DecompilerContext.getImpcollector());
addClassnameToImport(root, DecompilerContext.getImportCollector());
// build wrappers for all nested classes
// that's where the actual processing takes place
initWrappers(root);
@ -277,9 +277,9 @@ public class ClassesProcessor {
outwriter.write(DecompilerContext.getNewLineSeparator());
}
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASSNODE, root);
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASS_NODE, root);
DecompilerContext.getImpcollector().writeImports(outwriter);
DecompilerContext.getImportCollector().writeImports(outwriter);
outwriter.write(DecompilerContext.getNewLineSeparator());
outwriter.write(strwriter.toString());

View File

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

View File

@ -88,7 +88,7 @@ public class EnumProcessor {
if (initializer != null && initializer.type == Exprent.EXPRENT_NEW) {
NewExprent nexpr = (NewExprent)initializer;
if (nexpr.isAnonymous()) {
ClassNode child = DecompilerContext.getClassprocessor().getMapRootClasses().get(nexpr.getNewtype().value);
ClassNode child = DecompilerContext.getClassProcessor().getMapRootClasses().get(nexpr.getNewtype().value);
hideDummyFieldInConstant(child.wrapper);
}
}

View File

@ -44,7 +44,7 @@ public class Fernflower implements IDecompiledData {
structcontext = new StructContext(saver, this, new LazyLoader(provider));
DecompilerContext.initContext(propertiesCustom);
DecompilerContext.setCountercontainer(new CounterContainer());
DecompilerContext.setCounterContainer(new CounterContainer());
}
public void decompileContext() {
@ -55,8 +55,8 @@ public class Fernflower implements IDecompiledData {
clprocessor = new ClassesProcessor(structcontext);
DecompilerContext.setClassprocessor(clprocessor);
DecompilerContext.setStructcontext(structcontext);
DecompilerContext.setClassProcessor(clprocessor);
DecompilerContext.setStructContext(structcontext);
structcontext.saveContext();
}

View File

@ -163,7 +163,7 @@ public class InitializerProcessor {
StructClass cl = wrapper.getClassStruct();
boolean isAnonymous = DecompilerContext.getClassprocessor().getMapRootClasses().get(cl.qualifiedName).type == ClassNode.CLASS_ANONYMOUS;
boolean isAnonymous = DecompilerContext.getClassProcessor().getMapRootClasses().get(cl.qualifiedName).type == ClassNode.CLASS_ANONYMOUS;
List<List<Exprent>> lstFirst = new ArrayList<List<Exprent>>();
List<MethodWrapper> lstMethWrappers = new ArrayList<MethodWrapper>();

View File

@ -55,7 +55,7 @@ public class ImportCollector {
public String getShortName(String fullname, boolean imported) {
ClassesProcessor clproc = DecompilerContext.getClassprocessor();
ClassesProcessor clproc = DecompilerContext.getClassProcessor();
ClassNode node = clproc.getMapRootClasses().get(fullname.replace('.', '/'));
String retname = null;
@ -91,7 +91,7 @@ public class ImportCollector {
npackage = fullname.substring(0, lastpoint);
}
StructContext context = DecompilerContext.getStructcontext();
StructContext context = DecompilerContext.getStructContext();
boolean existsDefaultClass = (context.getClass(currentPackageSlash + nshort) != null
&& !npackage.equals(currentPackagePoint)) // current package

View File

@ -30,13 +30,13 @@ public interface IFernflowerPreferences {
String DECOMPILE_GENERIC_SIGNATURES = "dgs";
String NO_EXCEPTIONS_RETURN = "ner";
String DECOMPILE_ENUM = "den";
String REMOVE_GETCLASS_NEW = "rgn";
String REMOVE_GET_CLASS_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 USE_DEBUG_VAR_NAMES = "udv";
String REMOVE_EMPTY_RANGES = "rer";
String FINALLY_DEINLINE = "fdi";
String IDEA_NOT_NULL_ANNOTATION = "inn";
@ -63,13 +63,13 @@ public interface IFernflowerPreferences {
put(DECOMPILE_GENERIC_SIGNATURES, "0");
put(NO_EXCEPTIONS_RETURN, "1");
put(DECOMPILE_ENUM, "1");
put(REMOVE_GETCLASS_NEW, "1");
put(REMOVE_GET_CLASS_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(USE_DEBUG_VAR_NAMES, "1");
put(REMOVE_EMPTY_RANGES, "1");
put(FINALLY_DEINLINE, "1");
put(IDEA_NOT_NULL_ANNOTATION, "1");

View File

@ -74,10 +74,10 @@ public class ClassWrapper {
DecompilerContext.getLogger().startMethod(mt.getName() + " " + mt.getDescriptor());
VarNamesCollector vc = new VarNamesCollector();
DecompilerContext.setVarncollector(vc);
DecompilerContext.setVarNamesCollector(vc);
CounterContainer counter = new CounterContainer();
DecompilerContext.setCountercontainer(counter);
DecompilerContext.setCounterContainer(counter);
DecompilerContext.setProperty(DecompilerContext.CURRENT_METHOD, mt);
DecompilerContext.setProperty(DecompilerContext.CURRENT_METHOD_DESCRIPTOR, MethodDescriptor.parseDescriptor(mt.getDescriptor()));
@ -165,7 +165,7 @@ public class ClassWrapper {
varproc.refreshVarNames(new VarNamesCollector(setFieldNames));
// if debug information present and should be used
if (DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_VARNAMES)) {
if (DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_VAR_NAMES)) {
StructLocalVariableTableAttribute attr = (StructLocalVariableTableAttribute)mt.getAttributes().getWithKey(
StructGeneralAttribute.ATTRIBUTE_LOCAL_VARIABLE_TABLE);

View File

@ -54,7 +54,7 @@ public class LambdaProcessor {
public boolean hasLambda(ClassNode node) throws IOException {
ClassesProcessor clprocessor = DecompilerContext.getClassprocessor();
ClassesProcessor clprocessor = DecompilerContext.getClassProcessor();
StructClass cl = node.classStruct;
if (cl.getBytecodeVersion() < CodeConstants.BYTECODE_JAVA_8) { // lamda beginning with Java 8

View File

@ -124,7 +124,7 @@ public class MethodProcessorThread implements Runnable {
DeadCodeHelper.mergeBasicBlocks(graph);
DecompilerContext.getCountercontainer().setCounter(CounterContainer.VAR_COUNTER, mt.getLocalVariables());
DecompilerContext.getCounterContainer().setCounter(CounterContainer.VAR_COUNTER, mt.getLocalVariables());
//DotExporter.toDotFile(graph, new File("c:\\Temp\\fern3.dot"), true);
//System.out.println(graph.toString());

View File

@ -48,7 +48,7 @@ public class NestedClassProcessor {
// hide synthetic lambda content methods
if (node.type == ClassNode.CLASS_LAMBDA && !node.lambda_information.is_method_reference) {
ClassNode node_content = DecompilerContext.getClassprocessor().getMapRootClasses().get(node.classStruct.qualifiedName);
ClassNode node_content = DecompilerContext.getClassProcessor().getMapRootClasses().get(node.classStruct.qualifiedName);
if (node_content != null && node_content.wrapper != null) {
node_content.wrapper.getHideMembers().add(node.lambda_information.content_method_key);
}

View File

@ -329,7 +329,7 @@ public class NestedMemberAccess {
private Exprent replaceAccessExprent(ClassNode caller, MethodWrapper methdest, InvocationExprent invexpr) {
ClassNode node = DecompilerContext.getClassprocessor().getMapRootClasses().get(invexpr.getClassname());
ClassNode node = DecompilerContext.getClassProcessor().getMapRootClasses().get(invexpr.getClassname());
MethodWrapper methsource = null;
if (node != null && node.wrapper != null) {

View File

@ -117,7 +117,7 @@ public class ExitHelper {
dest = isExitEdge(ifedge);
if (dest != null) {
BasicBlockStatement bstat = new BasicBlockStatement(new BasicBlock(
DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
bstat.setExprents(DecHelper.copyExprentList(dest.getExprents()));
ifst.getFirst().removeSuccessor(ifedge);
@ -152,7 +152,7 @@ public class ExitHelper {
stat.removeSuccessor(destedge);
BasicBlockStatement bstat = new BasicBlockStatement(new BasicBlock(
DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
bstat.setExprents(DecHelper.copyExprentList(dest.getExprents()));
StatEdge oldexitedge = dest.getAllSuccessorEdges().get(0);
@ -315,7 +315,7 @@ public class ExitHelper {
// build a new statement with the single instruction 'return'
BasicBlockStatement bstat = new BasicBlockStatement(new BasicBlock(
DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
ExitExprent retexpr = new ExitExprent(ExitExprent.EXIT_RETURN, null,
((MethodDescriptor)DecompilerContext

View File

@ -708,7 +708,7 @@ public class ExprProcessor implements CodeConstants {
else if (tp == CodeConstants.TYPE_OBJECT) {
String ret = buildJavaClassName(type.value);
if (getShort) {
ret = DecompilerContext.getImpcollector().getShortName(ret);
ret = DecompilerContext.getImportCollector().getShortName(ret);
}
if (ret == null) {
@ -791,7 +791,7 @@ public class ExprProcessor implements CodeConstants {
if (res.contains("$")) { // attempt to invoke foreign member
// classes correctly
StructClass cl = DecompilerContext.getStructcontext().getClass(name);
StructClass cl = DecompilerContext.getStructContext().getClass(name);
if (cl == null || !cl.isOwn()) {
res = res.replace('$', '.');
}

View File

@ -103,7 +103,7 @@ public class FinallyProcessor {
}
else {
int varindex = DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER);
int varindex = DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER);
insertSemaphore(graph, getAllBasicBlocks(fin.getFirst()), head, handler, varindex, inf, bytecode_version);
finallyBlockIDs.put(handler.id, varindex);

View File

@ -184,7 +184,7 @@ public class MergeHelper {
// remove empty if statement as it is now part of the loop
if (firstif == stat.getFirst()) {
BasicBlockStatement bstat = new BasicBlockStatement(new BasicBlock(
DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
bstat.setExprents(new ArrayList<Exprent>());
stat.replaceStatement(firstif, bstat);
}
@ -223,7 +223,7 @@ public class MergeHelper {
if (firstif.getIfstat() == null) {
BasicBlockStatement bstat = new BasicBlockStatement(new BasicBlock(
DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
bstat.setExprents(new ArrayList<Exprent>());
ifedge.setSource(bstat);
@ -381,7 +381,7 @@ public class MergeHelper {
if (stat == dostat.getFirst()) {
BasicBlockStatement bstat = new BasicBlockStatement(new BasicBlock(
DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
bstat.setExprents(new ArrayList<Exprent>());
dostat.replaceStatement(stat, bstat);
}

View File

@ -299,7 +299,7 @@ public class SecondaryFunctionsHelper {
case FunctionExprent.FUNCTION_FCMPG:
case FunctionExprent.FUNCTION_DCMPL:
case FunctionExprent.FUNCTION_DCMPG:
int var = DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER);
int var = DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER);
VarType type = lstOperands.get(0).getExprType();
VarProcessor processor = (VarProcessor)DecompilerContext.getProperty(DecompilerContext.CURRENT_VAR_PROCESSOR);

View File

@ -300,7 +300,7 @@ public class SequenceHelper {
destroyStatementContent(stat, false);
BasicBlockStatement bstat = new BasicBlockStatement(new BasicBlock(
DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
if (stat.getExprents() == null) {
bstat.setExprents(new ArrayList<Exprent>());
}

View File

@ -137,7 +137,7 @@ public class SimplifyExprentsHelper {
}
// remove getClass() invocation, which is part of a qualified new
if (DecompilerContext.getOption(IFernflowerPreferences.REMOVE_GETCLASS_NEW)) {
if (DecompilerContext.getOption(IFernflowerPreferences.REMOVE_GET_CLASS_NEW)) {
if (isQualifiedNewGetClass(current, next)) {
list.remove(index);
res = true;
@ -516,7 +516,7 @@ public class SimplifyExprentsHelper {
nexpr.getConstructor().getLstParameters().get(0).equals(invexpr.getInstance())) {
String classname = nexpr.getNewtype().value;
ClassNode node = DecompilerContext.getClassprocessor().getMapRootClasses().get(classname);
ClassNode node = DecompilerContext.getClassProcessor().getMapRootClasses().get(classname);
if (node != null && node.type != ClassNode.CLASS_ROOT) {
return true;
}
@ -703,7 +703,7 @@ public class SimplifyExprentsHelper {
if (in.getInvocationTyp() == InvocationExprent.INVOKE_DYNAMIC) {
String lambda_class_name = cl.qualifiedName + in.getInvokeDynamicClassSuffix();
ClassNode lambda_class = DecompilerContext.getClassprocessor().getMapRootClasses().get(lambda_class_name);
ClassNode lambda_class = DecompilerContext.getClassProcessor().getMapRootClasses().get(lambda_class_name);
if (lambda_class != null) { // real lambda class found, replace invocation with an anonymous class

View File

@ -54,7 +54,7 @@ public class AnnotationExprent extends Exprent {
buffer.append(indstr);
buffer.append("@");
buffer.append(DecompilerContext.getImpcollector().getShortName(ExprProcessor.buildJavaClassName(classname)));
buffer.append(DecompilerContext.getImportCollector().getShortName(ExprProcessor.buildJavaClassName(classname)));
if (!parnames.isEmpty()) {
buffer.append("(");

View File

@ -127,7 +127,7 @@ public class AssignmentExprent extends Exprent {
if (left.type == Exprent.EXPRENT_FIELD) { // first assignment to a final field. Field name without "this" in front of it
FieldExprent field = (FieldExprent)left;
if (field.isStatic()) {
ClassNode node = ((ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASSNODE));
ClassNode node = ((ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE));
if (node != null) {
StructClass cl = node.classStruct;
StructField fd = cl.getField(field.getName(), field.getDescriptor().descriptorString);

View File

@ -88,7 +88,7 @@ public class ExitExprent extends Exprent {
else {
MethodWrapper meth = (MethodWrapper)DecompilerContext.getProperty(DecompilerContext.CURRENT_METHOD_WRAPPER);
ClassNode node = ((ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASSNODE));
ClassNode node = ((ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE));
if (meth != null && node != null) {
StructExceptionsAttribute attr = (StructExceptionsAttribute)meth.methodStruct.getAttributes().getWithKey("Exceptions");

View File

@ -55,7 +55,7 @@ public class Exprent {
{
// set exprent id
id = DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.EXPRENT_COUNTER);
id = DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.EXPRENT_COUNTER);
}
public int getPrecedence() {

View File

@ -98,9 +98,9 @@ public class FieldExprent extends Exprent {
if (isStatic) {
ClassNode node = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASSNODE);
ClassNode node = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE);
if (node == null || !classname.equals(node.classStruct.qualifiedName)) {
buf.append(DecompilerContext.getImpcollector().getShortName(ExprProcessor.buildJavaClassName(classname)));
buf.append(DecompilerContext.getImportCollector().getShortName(ExprProcessor.buildJavaClassName(classname)));
buf.append(".");
}
}
@ -126,10 +126,10 @@ public class FieldExprent extends Exprent {
}
if (super_qualifier != null) {
StructClass current_class = ((ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASSNODE)).classStruct;
StructClass current_class = ((ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE)).classStruct;
if (!super_qualifier.equals(current_class.qualifiedName)) {
buf.append(DecompilerContext.getImpcollector().getShortName(ExprProcessor.buildJavaClassName(super_qualifier)));
buf.append(DecompilerContext.getImportCollector().getShortName(ExprProcessor.buildJavaClassName(super_qualifier)));
buf.append(".");
}
buf.append("super");

View File

@ -225,9 +225,9 @@ public class InvocationExprent extends Exprent {
}
else if (isStatic) {
ClassNode node = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASSNODE);
ClassNode node = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE);
if (node == null || !classname.equals(node.classStruct.qualifiedName)) {
buf.append(DecompilerContext.getImpcollector().getShortName(ExprProcessor.buildJavaClassName(classname)));
buf.append(DecompilerContext.getImportCollector().getShortName(ExprProcessor.buildJavaClassName(classname)));
}
}
else {
@ -262,10 +262,10 @@ public class InvocationExprent extends Exprent {
if (functype == TYP_GENERAL) {
if (super_qualifier != null) {
StructClass current_class = ((ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASSNODE)).classStruct;
StructClass current_class = ((ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE)).classStruct;
if (!super_qualifier.equals(current_class.qualifiedName)) {
buf.append(DecompilerContext.getImpcollector().getShortName(ExprProcessor.buildJavaClassName(super_qualifier)));
buf.append(DecompilerContext.getImportCollector().getShortName(ExprProcessor.buildJavaClassName(super_qualifier)));
buf.append(".");
}
buf.append("super");
@ -330,7 +330,7 @@ public class InvocationExprent extends Exprent {
List<VarVersionPaar> sigFields = null;
boolean isEnum = false;
if (functype == TYP_INIT) {
ClassNode newnode = DecompilerContext.getClassprocessor().getMapRootClasses().get(classname);
ClassNode newnode = DecompilerContext.getClassProcessor().getMapRootClasses().get(classname);
if (newnode != null) { // own class
if (newnode.wrapper != null) {
@ -373,7 +373,7 @@ public class InvocationExprent extends Exprent {
Set<Integer> ret = new HashSet<Integer>();
StructClass cstr = DecompilerContext.getStructcontext().getClass(classname);
StructClass cstr = DecompilerContext.getStructContext().getClass(classname);
if (cstr != null) {
List<MethodDescriptor> lstMethods = new ArrayList<MethodDescriptor>();
for (StructMethod meth : cstr.getMethods()) {

View File

@ -79,7 +79,7 @@ public class NewExprent extends Exprent {
lambda = false;
if (newtype.type == CodeConstants.TYPE_OBJECT && newtype.arraydim == 0) {
ClassNode node = DecompilerContext.getClassprocessor().getMapRootClasses().get(newtype.value);
ClassNode node = DecompilerContext.getClassProcessor().getMapRootClasses().get(newtype.value);
if (node != null && (node.type == ClassNode.CLASS_ANONYMOUS || node.type == ClassNode.CLASS_LAMBDA)) {
anonymous = true;
@ -94,7 +94,7 @@ public class NewExprent extends Exprent {
public VarType getExprType() {
if (anonymous) {
ClassNode node = DecompilerContext.getClassprocessor().getMapRootClasses().get(newtype.value);
ClassNode node = DecompilerContext.getClassProcessor().getMapRootClasses().get(newtype.value);
return node.anonimousClassType;
}
@ -177,7 +177,7 @@ public class NewExprent extends Exprent {
if (anonymous) {
ClassNode child = DecompilerContext.getClassprocessor().getMapRootClasses().get(newtype.value);
ClassNode child = DecompilerContext.getClassProcessor().getMapRootClasses().get(newtype.value);
buf.append("(");
@ -185,7 +185,7 @@ public class NewExprent extends Exprent {
InvocationExprent invsuper = child.superInvocation;
ClassNode newnode = DecompilerContext.getClassprocessor().getMapRootClasses().get(invsuper.getClassname());
ClassNode newnode = DecompilerContext.getClassProcessor().getMapRootClasses().get(invsuper.getClassname());
List<VarVersionPaar> sigFields = null;
if (newnode != null) { // own class
@ -239,7 +239,7 @@ public class NewExprent extends Exprent {
String typename = ExprProcessor.getCastTypeName(child.anonimousClassType);
if (enclosing != null) {
ClassNode anonimousNode = DecompilerContext.getClassprocessor().getMapRootClasses().get(child.anonimousClassType.value);
ClassNode anonimousNode = DecompilerContext.getClassProcessor().getMapRootClasses().get(child.anonimousClassType.value);
if (anonimousNode != null) {
typename = anonimousNode.simpleName;
}
@ -307,7 +307,7 @@ public class NewExprent extends Exprent {
List<Exprent> lstParameters = constructor.getLstParameters();
ClassNode newnode = DecompilerContext.getClassprocessor().getMapRootClasses().get(constructor.getClassname());
ClassNode newnode = DecompilerContext.getClassProcessor().getMapRootClasses().get(constructor.getClassname());
List<VarVersionPaar> sigFields = null;
if (newnode != null) { // own class
@ -354,7 +354,7 @@ public class NewExprent extends Exprent {
String typename = ExprProcessor.getTypeName(newtype);
if (enclosing != null) {
ClassNode newNode = DecompilerContext.getClassprocessor().getMapRootClasses().get(newtype.value);
ClassNode newNode = DecompilerContext.getClassProcessor().getMapRootClasses().get(newtype.value);
if (newNode != null) {
typename = newNode.simpleName;
}
@ -404,7 +404,7 @@ public class NewExprent extends Exprent {
private static String getQualifiedNewInstance(String classname, List<Exprent> lstParams, int indent) {
ClassNode node = DecompilerContext.getClassprocessor().getMapRootClasses().get(classname);
ClassNode node = DecompilerContext.getClassProcessor().getMapRootClasses().get(classname);
if (node != null && node.type != ClassNode.CLASS_ROOT && (node.access & CodeConstants.ACC_STATIC) == 0) {
if (!lstParams.isEmpty()) {
@ -415,7 +415,7 @@ public class NewExprent extends Exprent {
if (enclosing.type == Exprent.EXPRENT_VAR) {
VarExprent varEnclosing = (VarExprent)enclosing;
StructClass current_class = ((ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASSNODE)).classStruct;
StructClass current_class = ((ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE)).classStruct;
String this_classname = varEnclosing.getProcessor().getThisvars().get(new VarVersionPaar(varEnclosing));
if (!current_class.qualifiedName.equals(this_classname)) {

View File

@ -87,7 +87,7 @@ public class VarExprent extends Exprent {
if (classdef) {
ClassNode child = DecompilerContext.getClassprocessor().getMapRootClasses().get(vartype.value);
ClassNode child = DecompilerContext.getClassProcessor().getMapRootClasses().get(vartype.value);
StringWriter strwriter = new StringWriter();
BufferedWriter bufstrwriter = new BufferedWriter(strwriter);

View File

@ -42,7 +42,7 @@ public class BasicBlockStatement extends Statement {
this.block = block;
id = block.id;
CounterContainer coun = DecompilerContext.getCountercontainer();
CounterContainer coun = DecompilerContext.getCounterContainer();
if (id >= coun.getCounter(CounterContainer.STATEMENT_COUNTER)) {
coun.setCounter(CounterContainer.STATEMENT_COUNTER, id + 1);
}
@ -73,7 +73,7 @@ public class BasicBlockStatement extends Statement {
public Statement getSimpleCopy() {
BasicBlock newblock = new BasicBlock(
DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER));
DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER));
SimpleInstructionSequence seq = new SimpleInstructionSequence();
for (int i = 0; i < block.getSeq().length(); i++) {

View File

@ -67,7 +67,7 @@ public class CatchAllStatement extends Statement {
}
}
vars.add(new VarExprent(DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER),
vars.add(new VarExprent(DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER),
new VarType(CodeConstants.TYPE_OBJECT, 0, "java/lang/Throwable"),
(VarProcessor)DecompilerContext.getProperty(DecompilerContext.CURRENT_VAR_PROCESSOR)));
}
@ -174,14 +174,14 @@ public class CatchAllStatement extends Statement {
cas.isFinally = this.isFinally;
if (this.monitor != null) {
cas.monitor = new VarExprent(DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER),
cas.monitor = new VarExprent(DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER),
VarType.VARTYPE_INT,
(VarProcessor)DecompilerContext.getProperty(DecompilerContext.CURRENT_VAR_PROCESSOR));
}
if (!this.vars.isEmpty()) {
// FIXME: WTF??? vars?!
vars.add(new VarExprent(DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER),
vars.add(new VarExprent(DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER),
new VarType(CodeConstants.TYPE_OBJECT, 0, "java/lang/Throwable"),
(VarProcessor)DecompilerContext.getProperty(DecompilerContext.CURRENT_VAR_PROCESSOR)));
}

View File

@ -58,7 +58,7 @@ public class CatchStatement extends Statement {
stats.addWithKey(stat, stat.id);
exctstrings.add(new ArrayList<String>(edge.getExceptions()));
vars.add(new VarExprent(DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER),
vars.add(new VarExprent(DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER),
new VarType(CodeConstants.TYPE_OBJECT, 0, edge.getExceptions().get(0)),
// FIXME: for now simply the first type. Should get the first common superclass when possible.
(VarProcessor)DecompilerContext.getProperty(DecompilerContext.CURRENT_VAR_PROCESSOR)));
@ -192,7 +192,7 @@ public class CatchStatement extends Statement {
for (List<String> exc : this.exctstrings) {
cs.exctstrings.add(new ArrayList<String>(exc));
cs.vars.add(new VarExprent(DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER),
cs.vars.add(new VarExprent(DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER),
new VarType(CodeConstants.TYPE_OBJECT, 0, exc.get(0)),
(VarProcessor)DecompilerContext.getProperty(DecompilerContext.CURRENT_VAR_PROCESSOR)));
}

View File

@ -108,7 +108,7 @@ public class Statement {
{
// set statement id
id = DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER);
id = DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER);
}
// *****************************************************************************

View File

@ -314,7 +314,7 @@ public class SwitchStatement extends Statement {
for (int i = 0; i < nodes.size(); i++) {
if (nodes.get(i) == null) {
BasicBlockStatement bstat = new BasicBlockStatement(new BasicBlock(
DecompilerContext.getCountercontainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER)));
StatEdge sample_edge = lstEdges.get(i).get(0);

View File

@ -51,7 +51,7 @@ public class VarDefinitionHelper {
this.varproc = varproc;
VarNamesCollector vc = DecompilerContext.getVarncollector();
VarNamesCollector vc = DecompilerContext.getVarNamesCollector();
boolean thisvar = (mt.getAccessFlags() & CodeConstants.ACC_STATIC) == 0;
@ -123,7 +123,7 @@ public class VarDefinitionHelper {
public void setVarDefinitions() {
VarNamesCollector vc = DecompilerContext.getVarncollector();
VarNamesCollector vc = DecompilerContext.getVarNamesCollector();
for (Entry<Integer, Statement> en : mapVarDefStatements.entrySet()) {
Statement stat = en.getValue();

View File

@ -248,7 +248,7 @@ public class VarVersionsProcessor {
HashMap<VarVersionPaar, VarType> mapExprentMinTypes = typeproc.getMapExprentMinTypes();
HashMap<VarVersionPaar, Integer> mapFinalVars = typeproc.getMapFinalVars();
CounterContainer ccon = DecompilerContext.getCountercontainer();
CounterContainer ccon = DecompilerContext.getCounterContainer();
final HashMap<VarVersionPaar, Integer> mapVarPaar = new HashMap<VarVersionPaar, Integer>();
HashMap<Integer, Integer> mapOriginalVarIndices = new HashMap<Integer, Integer>();

View File

@ -176,7 +176,7 @@ public class GenericMain {
}
else if (tp == CodeConstants.TYPE_OBJECT) {
StringBuilder buffer = new StringBuilder();
buffer.append(DecompilerContext.getImpcollector().getShortName(buildJavaClassName(type)));
buffer.append(DecompilerContext.getImportCollector().getShortName(buildJavaClassName(type)));
if (!type.getArguments().isEmpty()) {
buffer.append("<");
@ -222,7 +222,7 @@ public class GenericMain {
String res = name.replace('/', '.');
if (res.contains("$")) {
StructClass cl = DecompilerContext.getStructcontext().getClass(name);
StructClass cl = DecompilerContext.getStructContext().getClass(name);
if (cl == null || !cl.isOwn()) {
res = res.replace('$', '.');
}

View File

@ -44,7 +44,7 @@ public class SingleClassesTest {
put(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES, "0");
put(IFernflowerPreferences.IDEA_NOT_NULL_ANNOTATION, "1");
put(IFernflowerPreferences.LAMBDA_TO_ANONYMOUS_CLASS, "0");
put(IFernflowerPreferences.USE_DEBUG_VARNAMES, "0");
put(IFernflowerPreferences.USE_DEBUG_VAR_NAMES, "0");
put(IFernflowerPreferences.NEW_LINE_SEPARATOR, (win ? "0" : "1"));
}});
}