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

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