From 96ff7f787edd44b64dcf6f5cfd58440f7041d48c Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Mon, 21 Mar 2016 12:26:50 +0100 Subject: [PATCH] Cleanup (formatting; typos) --- .../decompiler/exps/InvocationExprent.java | 68 ++++++++----------- .../java/decompiler/SingleClassesTest.java | 2 +- 2 files changed, 31 insertions(+), 39 deletions(-) diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java index 758b93f..1b8188a 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java @@ -224,20 +224,20 @@ public class InvocationExprent extends Exprent { else { if (instance != null && instance.type == Exprent.EXPRENT_VAR) { - VarExprent instvar = (VarExprent)instance; - VarVersionPair varpaar = new VarVersionPair(instvar); - - VarProcessor vproc = instvar.getProcessor(); - if (vproc == null) { - MethodWrapper current_meth = (MethodWrapper)DecompilerContext.getProperty(DecompilerContext.CURRENT_METHOD_WRAPPER); - if (current_meth != null) { - vproc = current_meth.varproc; + VarExprent instVar = (VarExprent)instance; + VarVersionPair varPair = new VarVersionPair(instVar); + + VarProcessor varProc = instVar.getProcessor(); + if (varProc == null) { + MethodWrapper currentMethod = (MethodWrapper)DecompilerContext.getProperty(DecompilerContext.CURRENT_METHOD_WRAPPER); + if (currentMethod != null) { + varProc = currentMethod.varproc; } } String this_classname = null; - if (vproc != null) { - this_classname = vproc.getThisVars().get(varpaar); + if (varProc != null) { + this_classname = varProc.getThisVars().get(varPair); } if (this_classname != null) { @@ -334,7 +334,7 @@ public class InvocationExprent extends Exprent { boolean firstParameter = true; int start = isEnum ? 2 : 0; for (int i = start; i < lstParameters.size(); i++) { - if (sigFields == null || null == sigFields.get(i)) { + if (sigFields == null || sigFields.get(i) == null) { if (!firstParameter) { buf.append(", "); } @@ -512,43 +512,35 @@ public class InvocationExprent extends Exprent { // ***************************************************************************** // IMatchable implementation // ***************************************************************************** - - public boolean match(MatchNode matchNode, MatchEngine engine) { - if(!super.match(matchNode, engine)) { + @Override + public boolean match(MatchNode matchNode, MatchEngine engine) { + if (!super.match(matchNode, engine)) { return false; } - - for(Entry rule : matchNode.getRules().entrySet()) { + + for (Entry rule : matchNode.getRules().entrySet()) { RuleValue value = rule.getValue(); - - switch(rule.getKey()) { - case EXPRENT_INVOCATION_PARAMETER: - if(value.isVariable()) { - if(value.parameter < lstParameters.size()) { - if(!engine.checkAndSetVariableValue(value.value.toString(), lstParameters.get(value.parameter))) { - return false; - } - } else { - return false; - } + + MatchProperties key = rule.getKey(); + if (key == MatchProperties.EXPRENT_INVOCATION_PARAMETER) { + if (value.isVariable() && (value.parameter >= lstParameters.size() || + !engine.checkAndSetVariableValue(value.value.toString(), lstParameters.get(value.parameter)))) { + return false; } - break; - case EXPRENT_INVOCATION_CLASS: - if(!value.value.equals(this.classname)) { + } + else if (key == MatchProperties.EXPRENT_INVOCATION_CLASS) { + if (!value.value.equals(this.classname)) { return false; } - break; - case EXPRENT_INVOCATION_SIGNATURE: - if(!value.value.equals(this.name + this.stringDescriptor)) { + } + else if (key == MatchProperties.EXPRENT_INVOCATION_SIGNATURE) { + if (!value.value.equals(this.name + this.stringDescriptor)) { return false; } - break; } - } - + return true; } - -} +} \ No newline at end of file diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index 260445d..100deeb 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -131,4 +131,4 @@ public class SingleClassesTest { return files; } -} +} \ No newline at end of file