From 0b442fc64b6624a744e8cde2e4899bfd3049a0cc Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Fri, 21 Apr 2017 19:16:45 +0300 Subject: [PATCH] do not process vars if there were errors in the method --- .../decompiler/main/rels/ClassWrapper.java | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java b/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java index d0efaae..5ae532a 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java +++ b/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java @@ -158,31 +158,33 @@ public class ClassWrapper { methods.addWithKey(methodWrapper, InterpreterUtil.makeUniqueKey(mt.getName(), mt.getDescriptor())); - // rename vars so that no one has the same name as a field - varProc.refreshVarNames(new VarNamesCollector(setFieldNames)); - - // if debug information present and should be used - if (DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_VAR_NAMES)) { - StructLocalVariableTableAttribute attr = mt.getLocalVariableAttr(); - if (attr != null) { - // only param names here - varProc.setDebugVarNames(attr.getMapParamNames()); - - // the rest is here - methodWrapper.getOrBuildGraph().iterateExprents(exprent -> { - List lst = exprent.getAllExprents(true); - lst.add(exprent); - lst.stream() - .filter(e -> e.type == Exprent.EXPRENT_VAR) - .forEach(e -> { - VarExprent varExprent = (VarExprent)e; - String name = varExprent.getDebugName(mt); - if (name != null) { - varProc.setVarName(varExprent.getVarVersionPair(), name); - } - }); - return 0; - }); + if (!isError) { + // rename vars so that no one has the same name as a field + varProc.refreshVarNames(new VarNamesCollector(setFieldNames)); + + // if debug information present and should be used + if (DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_VAR_NAMES)) { + StructLocalVariableTableAttribute attr = mt.getLocalVariableAttr(); + if (attr != null) { + // only param names here + varProc.setDebugVarNames(attr.getMapParamNames()); + + // the rest is here + methodWrapper.getOrBuildGraph().iterateExprents(exprent -> { + List lst = exprent.getAllExprents(true); + lst.add(exprent); + lst.stream() + .filter(e -> e.type == Exprent.EXPRENT_VAR) + .forEach(e -> { + VarExprent varExprent = (VarExprent)e; + String name = varExprent.getDebugName(mt); + if (name != null) { + varProc.setVarName(varExprent.getVarVersionPair(), name); + } + }); + return 0; + }); + } } }