From 5e45e5ac4071d5b63f591992138d0d309dba66b2 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Thu, 12 Jan 2017 15:03:43 +0300 Subject: [PATCH] IDEA-130708 Incorrect locals names --- .../decompiler/main/rels/ClassWrapper.java | 5 +- .../modules/decompiler/ExprProcessor.java | 25 ++++- .../modules/decompiler/exps/FieldExprent.java | 4 +- .../modules/decompiler/exps/VarExprent.java | 94 ++++++++++++++---- .../modules/decompiler/vars/VarProcessor.java | 3 +- .../decompiler/vars/VarVersionsProcessor.java | 24 +++-- .../java/decompiler/struct/StructMember.java | 2 +- .../StructLocalVariableTableAttribute.java | 65 +++++++++--- ...StructLocalVariableTypeTableAttribute.java | 28 ++---- .../java/decompiler/SingleClassesTest.java | 1 + testData/bulk/pkg/res/Loader.java | 6 +- testData/classes/pkg/TestLocalsNames.class | Bin 0 -> 1707 bytes .../TestAmbiguousCallWithDebugInfo.dec | 2 +- testData/results/TestLocalsNames.dec | 77 ++++++++++++++ testData/src/pkg/TestLocalsNames.java | 35 +++++++ 15 files changed, 296 insertions(+), 75 deletions(-) create mode 100644 testData/classes/pkg/TestLocalsNames.class create mode 100644 testData/results/TestLocalsNames.dec create mode 100644 testData/src/pkg/TestLocalsNames.java diff --git a/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java b/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java index 39adbc9..f5cd82c 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java +++ b/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -163,7 +163,8 @@ public class ClassWrapper { if (DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_VAR_NAMES)) { StructLocalVariableTableAttribute attr = mt.getLocalVariableAttr(); if (attr != null) { - varProc.setDebugVarNames(attr.getMapVarNames()); + // only param names here + varProc.setDebugVarNames(attr.getMapParamNames()); } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java index 5931826..cffc5ac 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -341,7 +341,7 @@ public class ExprProcessor implements CodeConstants { case opc_fload: case opc_dload: case opc_aload: - pushEx(stack, exprlist, new VarExprent(instr.getOperand(0), varTypes[instr.opcode - opc_iload], varProcessor)); + pushEx(stack, exprlist, new VarExprent(instr.getOperand(0), varTypes[instr.opcode - opc_iload], varProcessor, bytecode_offset)); break; case opc_iaload: case opc_laload: @@ -371,8 +371,8 @@ public class ExprProcessor implements CodeConstants { case opc_astore: Exprent top = stack.pop(); int varindex = instr.getOperand(0); - AssignmentExprent assign = - new AssignmentExprent(new VarExprent(varindex, varTypes[instr.opcode - opc_istore], varProcessor), top, bytecode_offsets); + AssignmentExprent assign = new AssignmentExprent( + new VarExprent(varindex, varTypes[instr.opcode - opc_istore], varProcessor, nextMeaningfulOffset(block, i)), top, bytecode_offsets); exprlist.add(assign); break; case opc_iastore: @@ -624,6 +624,23 @@ public class ExprProcessor implements CodeConstants { } } + private static int nextMeaningfulOffset(BasicBlock block, int index) { + InstructionSequence seq = block.getSeq(); + while (++index < seq.length()) { + switch (seq.getInstr(index).opcode) { + case opc_nop: + case opc_istore: + case opc_lstore: + case opc_fstore: + case opc_dstore: + case opc_astore: + continue; + } + return block.getOldOffset(index); + } + return -1; + } + private void pushEx(ExprentStack stack, List exprlist, Exprent exprent) { pushEx(stack, exprlist, exprent, null); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java index f1c65d1..472823f 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,7 +88,7 @@ public class FieldExprent extends Exprent { if (method != null) { StructLocalVariableTableAttribute attr = method.methodStruct.getLocalVariableAttr(); if (attr != null) { - return attr.getMapVarNames().containsValue(name); + return attr.containsName(name); } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java index a4e25c9..8fc43ff 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java @@ -28,6 +28,7 @@ import org.jetbrains.java.decompiler.modules.decompiler.vars.VarProcessor; import org.jetbrains.java.decompiler.modules.decompiler.vars.VarTypeProcessor; import org.jetbrains.java.decompiler.modules.decompiler.vars.VarVersionPair; import org.jetbrains.java.decompiler.struct.attr.StructGeneralAttribute; +import org.jetbrains.java.decompiler.struct.attr.StructLocalVariableTableAttribute; import org.jetbrains.java.decompiler.struct.attr.StructLocalVariableTypeTableAttribute; import org.jetbrains.java.decompiler.struct.gen.VarType; import org.jetbrains.java.decompiler.struct.gen.generics.GenericFieldDescriptor; @@ -36,6 +37,7 @@ import org.jetbrains.java.decompiler.struct.match.MatchEngine; import org.jetbrains.java.decompiler.struct.match.MatchNode; import org.jetbrains.java.decompiler.struct.match.MatchNode.RuleValue; import org.jetbrains.java.decompiler.util.InterpreterUtil; +import org.jetbrains.java.decompiler.util.TextUtil; import java.util.ArrayList; import java.util.List; @@ -49,15 +51,21 @@ public class VarExprent extends Exprent { private VarType varType; private boolean definition = false; private VarProcessor processor; + private final int visibleOffset; private int version = 0; private boolean classDef = false; private boolean stack = false; public VarExprent(int index, VarType varType, VarProcessor processor) { + this(index, varType, processor, -1); + } + + public VarExprent(int index, VarType varType, VarProcessor processor, int visibleOffset) { super(EXPRENT_VAR); this.index = index; this.varType = varType; this.processor = processor; + this.visibleOffset = visibleOffset; } @Override @@ -77,7 +85,7 @@ public class VarExprent extends Exprent { @Override public Exprent copy() { - VarExprent var = new VarExprent(index, getVarType(), processor); + VarExprent var = new VarExprent(index, getVarType(), processor, visibleOffset); var.setDefinition(definition); var.setVersion(version); var.setClassDef(classDef); @@ -97,43 +105,85 @@ public class VarExprent extends Exprent { tracer.incrementCurrentSourceLine(buffer.countLines()); } else { - String name = null; - if (processor != null) { - name = processor.getVarName(new VarVersionPair(index, version)); - } + VarVersionPair varVersion = new VarVersionPair(index, version); + String name = getName(varVersion); if (definition) { - if (processor != null && processor.getVarFinal(new VarVersionPair(index, version)) == VarTypeProcessor.VAR_EXPLICIT_FINAL) { + if (processor != null && processor.getVarFinal(varVersion) == VarTypeProcessor.VAR_EXPLICIT_FINAL) { buffer.append("final "); } - boolean generic = false; - if (DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES)) { - MethodWrapper method = (MethodWrapper)DecompilerContext.getProperty(DecompilerContext.CURRENT_METHOD_WRAPPER); - StructLocalVariableTypeTableAttribute attr = (StructLocalVariableTypeTableAttribute)method.methodStruct.getAttributes() - .getWithKey(StructGeneralAttribute.ATTRIBUTE_LOCAL_VARIABLE_TYPE_TABLE); - if (attr != null && processor != null) { - Integer index = processor.getVarOriginalIndex(new VarVersionPair(this.index, version)); - if (index != null) { - String signature = attr.getMapVarSignatures().get(index); + appendDefinitionType(buffer, varVersion); + buffer.append(" "); + } + + buffer.append(name == null ? ("var" + index + (this.version == 0 ? "" : "_" + this.version)) : name); + } + + return buffer; + } + + private String getName(VarVersionPair varVersion) { + String name = null; + if (DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_VAR_NAMES)) { + MethodWrapper method = (MethodWrapper)DecompilerContext.getProperty(DecompilerContext.CURRENT_METHOD_WRAPPER); + if (method != null) { + StructLocalVariableTableAttribute attr = method.methodStruct.getLocalVariableAttr(); + if (attr != null && processor != null) { + Integer index = processor.getVarOriginalIndex(varVersion); + if (index != null) { + name = attr.getName(index, visibleOffset); + if (name != null && TextUtil.isValidIdentifier(name, method.methodStruct.getClassStruct().getBytecodeVersion())) { + return name; + } + } + } + } + } + if (processor != null) { + name = processor.getVarName(varVersion); + } + return name; + } + + private void appendDefinitionType(TextBuffer buffer, VarVersionPair varVersion) { + if (DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_VAR_NAMES)) { + MethodWrapper method = (MethodWrapper)DecompilerContext.getProperty(DecompilerContext.CURRENT_METHOD_WRAPPER); + if (method != null) { + Integer originalIndex = null; + if (processor != null) { + originalIndex = processor.getVarOriginalIndex(varVersion); + } + if (originalIndex != null) { + // first try from signature + if (DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES)) { + StructLocalVariableTypeTableAttribute attr = (StructLocalVariableTypeTableAttribute)method.methodStruct.getAttributes() + .getWithKey(StructGeneralAttribute.ATTRIBUTE_LOCAL_VARIABLE_TYPE_TABLE); + if (attr != null) { + String signature = attr.getSignature(originalIndex, visibleOffset); if (signature != null) { GenericFieldDescriptor descriptor = GenericMain.parseFieldSignature(signature); if (descriptor != null) { buffer.append(GenericMain.getGenericCastTypeName(descriptor.type)); - generic = true; + return; } } } } + + // then try from descriptor + StructLocalVariableTableAttribute attr = method.methodStruct.getLocalVariableAttr(); + if (attr != null) { + String descriptor = attr.getDescriptor(originalIndex, visibleOffset); + if (descriptor != null) { + buffer.append(ExprProcessor.getCastTypeName(new VarType(descriptor))); + return; + } + } } - if (!generic) { - buffer.append(ExprProcessor.getCastTypeName(getVarType())); - } - buffer.append(" "); } - buffer.append(name == null ? ("var" + index + (version == 0 ? "" : "_" + version)) : name); } - return buffer; + buffer.append(ExprProcessor.getCastTypeName(getVarType())); } @Override diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java index fa79849..7e3da59 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java @@ -40,8 +40,9 @@ public class VarProcessor { } public void setVarVersions(RootStatement root) { + VarVersionsProcessor oldProcessor = varVersions; varVersions = new VarVersionsProcessor(method, methodDescriptor); - varVersions.setVarVersions(root); + varVersions.setVarVersions(root, oldProcessor); } public void setVarDefinitions(Statement root) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsProcessor.java index e68282e..4544004 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ import java.util.Map.Entry; public class VarVersionsProcessor { private final StructMethod method; - private Map mapOriginalVarIndices = new HashMap<>(); + private Map mapOriginalVarIndices = Collections.emptyMap(); private VarTypeProcessor typeProcessor; public VarVersionsProcessor(StructMethod mt, MethodDescriptor md) { @@ -43,7 +43,7 @@ public class VarVersionsProcessor { typeProcessor = new VarTypeProcessor(mt, md); } - public void setVarVersions(RootStatement root) { + public void setVarVersions(RootStatement root, VarVersionsProcessor previousVersionsProcessor) { SSAConstructorSparseEx ssa = new SSAConstructorSparseEx(); ssa.splitVariables(root, method); @@ -60,7 +60,7 @@ public class VarVersionsProcessor { eliminateNonJavaTypes(typeProcessor); - setNewVarIndices(typeProcessor, graph); + setNewVarIndices(typeProcessor, graph, previousVersionsProcessor); } private static void mergePhiVersions(SSAConstructorSparseEx ssa, DirectGraph graph) { @@ -227,7 +227,7 @@ public class VarVersionsProcessor { } } - private void setNewVarIndices(VarTypeProcessor typeProcessor, DirectGraph graph) { + private void setNewVarIndices(VarTypeProcessor typeProcessor, DirectGraph graph, VarVersionsProcessor previousVersionsProcessor) { final Map mapExprentMaxTypes = typeProcessor.getMapExprentMaxTypes(); Map mapExprentMinTypes = typeProcessor.getMapExprentMinTypes(); Map mapFinalVars = typeProcessor.getMapFinalVars(); @@ -286,7 +286,19 @@ public class VarVersionsProcessor { } }); - this.mapOriginalVarIndices = mapOriginalVarIndices; + if (previousVersionsProcessor != null) { + Map oldIndices = previousVersionsProcessor.getMapOriginalVarIndices(); + this.mapOriginalVarIndices = new HashMap<>(mapOriginalVarIndices.size()); + for (Entry entry : mapOriginalVarIndices.entrySet()) { + Integer value = entry.getValue(); + Integer oldValue = oldIndices.get(value); + value = oldValue != null ? oldValue : value; + this.mapOriginalVarIndices.put(entry.getKey(), value); + } + } + else { + this.mapOriginalVarIndices = mapOriginalVarIndices; + } } public VarType getVarType(VarVersionPair pair) { diff --git a/src/org/jetbrains/java/decompiler/struct/StructMember.java b/src/org/jetbrains/java/decompiler/struct/StructMember.java index 1b6866e..86f79b4 100644 --- a/src/org/jetbrains/java/decompiler/struct/StructMember.java +++ b/src/org/jetbrains/java/decompiler/struct/StructMember.java @@ -61,7 +61,7 @@ public class StructMember { if (StructGeneralAttribute.ATTRIBUTE_LOCAL_VARIABLE_TABLE.equals(name) && attributes.containsKey(name)) { // merge all variable tables StructLocalVariableTableAttribute table = (StructLocalVariableTableAttribute)attributes.getWithKey(name); - table.addLocalVariableTable((StructLocalVariableTableAttribute)attribute); + table.add((StructLocalVariableTableAttribute)attribute); } else if (StructGeneralAttribute.ATTRIBUTE_LOCAL_VARIABLE_TYPE_TABLE.equals(name) && attributes.containsKey(name)) { // merge all variable tables diff --git a/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java b/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java index 9564814..0a06ea0 100644 --- a/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java +++ b/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java @@ -19,9 +19,12 @@ import org.jetbrains.java.decompiler.struct.consts.ConstantPool; import org.jetbrains.java.decompiler.util.DataInputFullStream; import java.io.IOException; +import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; /* u2 local_variable_table_length; @@ -34,32 +37,70 @@ import java.util.Map; } */ public class StructLocalVariableTableAttribute extends StructGeneralAttribute { - - private Map mapVarNames = Collections.emptyMap(); + private List localVariables = Collections.emptyList(); @Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { int len = data.readUnsignedShort(); if (len > 0) { - mapVarNames = new HashMap<>(len); + localVariables = new ArrayList<>(len); + for (int i = 0; i < len; i++) { - data.discard(4); + int start_pc = data.readUnsignedShort(); + int length = data.readUnsignedShort(); int nameIndex = data.readUnsignedShort(); - data.discard(2); + int descriptorIndex = data.readUnsignedShort(); int varIndex = data.readUnsignedShort(); - mapVarNames.put(varIndex, pool.getPrimitiveConstant(nameIndex).getString()); + localVariables.add(new LocalVariable(start_pc, + length, + pool.getPrimitiveConstant(nameIndex).getString(), + pool.getPrimitiveConstant(descriptorIndex).getString(), + varIndex)); } } else { - mapVarNames = Collections.emptyMap(); + localVariables = Collections.emptyList(); } } - public void addLocalVariableTable(StructLocalVariableTableAttribute attr) { - mapVarNames.putAll(attr.getMapVarNames()); + public void add(StructLocalVariableTableAttribute attr) { + localVariables.addAll(attr.localVariables); + } + + public String getName(int index, int visibleOffset) { + return matchingVars(index, visibleOffset).map(v -> v.name).findFirst().orElse(null); + } + + public String getDescriptor(int index, int visibleOffset) { + return matchingVars(index, visibleOffset).map(v -> v.descriptor).findFirst().orElse(null); + } + + private Stream matchingVars(int index, int visibleOffset) { + return localVariables.stream() + .filter(v -> v.index == index && (visibleOffset >= v.start_pc && visibleOffset < v.start_pc + v.length)); + } + + public boolean containsName(String name) { + return localVariables.stream().anyMatch(v -> v.name == name); } - public Map getMapVarNames() { - return mapVarNames; + public Map getMapParamNames() { + return localVariables.stream().filter(v -> v.start_pc == 0).collect(Collectors.toMap(v -> v.index, v -> v.name, (n1, n2) -> n2)); + } + + private static class LocalVariable { + final int start_pc; + final int length; + final String name; + final String descriptor; + final int index; + + private LocalVariable(int start_pc, int length, String name, String descriptor, int index) { + this.start_pc = start_pc; + this.length = length; + this.name = name; + this.descriptor = descriptor; + this.index = index; + } } } diff --git a/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTypeTableAttribute.java b/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTypeTableAttribute.java index 96bf630..719b333 100644 --- a/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTypeTableAttribute.java +++ b/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTypeTableAttribute.java @@ -19,9 +19,7 @@ import org.jetbrains.java.decompiler.struct.consts.ConstantPool; import org.jetbrains.java.decompiler.util.DataInputFullStream; import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; +import java.util.Set; /* u2 local_variable_type_table_length; @@ -33,31 +31,19 @@ import java.util.Map; } local_variable_type_table[local_variable_type_table_length]; */ public class StructLocalVariableTypeTableAttribute extends StructGeneralAttribute { - - private Map mapVarSignatures = Collections.emptyMap(); + // store signature instead of descriptor + private final StructLocalVariableTableAttribute backingAttribute = new StructLocalVariableTableAttribute(); @Override public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { - int len = data.readUnsignedShort(); - if (len > 0) { - mapVarSignatures = new HashMap<>(len); - for (int i = 0; i < len; i++) { - data.discard(6); - int signatureIndex = data.readUnsignedShort(); - int varIndex = data.readUnsignedShort(); - mapVarSignatures.put(varIndex, pool.getPrimitiveConstant(signatureIndex).getString()); - } - } - else { - mapVarSignatures = Collections.emptyMap(); - } + backingAttribute.initContent(data, pool); } public void add(StructLocalVariableTypeTableAttribute attr) { - mapVarSignatures.putAll(attr.getMapVarSignatures()); + backingAttribute.add(attr.backingAttribute); } - public Map getMapVarSignatures() { - return mapVarSignatures; + public String getSignature(int index, int visibleOffset) { + return backingAttribute.getDescriptor(index, visibleOffset); } } diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index 993b9c4..6bcf941 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -93,6 +93,7 @@ public class SingleClassesTest { @Test public void testIllegalVarName() { doTest("pkg/TestIllegalVarName"); } @Test public void testKotlinConstructor() { doTest("pkg/TestKotlinConstructorKt"); } @Test public void testAsserts() { doTest("pkg/TestAsserts"); } + @Test public void testLocalsNames() { doTest("pkg/TestLocalsNames"); } private void doTest(String testFile, String... companionFiles) { ConsoleDecompiler decompiler = fixture.getDecompiler(); diff --git a/testData/bulk/pkg/res/Loader.java b/testData/bulk/pkg/res/Loader.java index b0326dd..22a31bb 100644 --- a/testData/bulk/pkg/res/Loader.java +++ b/testData/bulk/pkg/res/Loader.java @@ -11,9 +11,9 @@ public class Loader { throw new RuntimeException("Resource missing"); } else { try { - File e = new File(resource.toURI()); - byte[] bytes = new byte[(int)e.length()]; - FileInputStream stream = new FileInputStream(e); + File file = new File(resource.toURI()); + byte[] bytes = new byte[(int)file.length()]; + FileInputStream stream = new FileInputStream(file); stream.read(bytes); stream.close(); return new String(bytes, "UTF-8"); diff --git a/testData/classes/pkg/TestLocalsNames.class b/testData/classes/pkg/TestLocalsNames.class new file mode 100644 index 0000000000000000000000000000000000000000..f24049e31bf69e1c88eb16c71e76a89c67bcc8f3 GIT binary patch literal 1707 zcmaJ?-%}e^6#g#RWH-xFNFYF3lvJxG*n+l56|k1l*2=G&_Nn`~xx)0sXx zqvMvuO$Lg_TKv-jL{zjM#I-*@ijum67E12BrJi2;0Q zB94ztjAKGslR7@uamhrYx$=p!E*qFq;}wONPU0l4D(jk#>jpkmD>n>$W}*`_Np3W2 zU`{#b4J;VAX<`wd>-fUN5|(v*DbRh!4g%?ij#mw?I)PnuWm!P12_z<+suNxkh~*0_ z0@}1!mI9q~PE{_{D@ExqE3iO%&MVpOitRgUzVFn+yG|gGnX7GWj4aC_j6lJHU6H{A z_x5F#CWG^HoAy0>#PLS1JFc8qi&B*tAaLU76072l@gTH)E{Yl2>kOf<^Y)8KUAlHH zP$$t8Mxfo7rMe$D_oRDYpkpbtOI!1HEvh!6d04=hEV=tfHkZ7*Uy`aMfu0xYA66Ax z7(~v(3U2B6%EBtvEZoM|0#@sJ1p1<>Ygac$mO|gDZd|E5Zdv*kzQMN^?%+GtI2=}L z7Hs7hMA5=)c-=w?EWiISeCj}_YrgOK0;zgc5uOXZT$4?fa|f(fQ!cgBx`hqgB~PK} zZAGgNS1Um-PeM44KI;PhijpNTLN8&#oR1z$`WO0ci1)LHuQY* z%1&Y9w7{0`2cfL6R+7&m!)2!;=N;Eoy+JTFOwtY&&-A47g=0!~Zpd(|7+NgkDn_w(HA6+51M5;AKzMc(m8lfsbTt zGBfe2j7QQO;F%`o)k$gQd4fguOUT-!U16OA`I%R3+I`S>El~n`P3_@Uc}Wh%n|68U z1$ueSs9pJaWARpm^#G^&Q5oP@Np$tAPNWrsQ0>n5Y0gGC3Xbui9f(IX+VBS7iOAW5 zH)&f<0M6ho&P=?Gcj#fTaEUYNdpguW+XFm#g4h&IZCuN03t1ye&xvgmcF}o&Pj?Zgf>PC`-5mj%nc%EF@`(}ND{e%AzB7wA8~e;RHpDN z&S4lD^F2Amr(5;N1Jt72|dP18!rA2sicK1 literal 0 HcmV?d00001 diff --git a/testData/results/TestAmbiguousCallWithDebugInfo.dec b/testData/results/TestAmbiguousCallWithDebugInfo.dec index 40f1eaf..b697e79 100644 --- a/testData/results/TestAmbiguousCallWithDebugInfo.dec +++ b/testData/results/TestAmbiguousCallWithDebugInfo.dec @@ -11,7 +11,7 @@ class TestAmbiguousCall { IllegalArgumentException iae = new IllegalArgumentException();// 8 this.m1((RuntimeException)iae, "RE");// 9 this.m1(iae, "IAE");// 10 - IllegalArgumentException re = new IllegalArgumentException();// 12 + RuntimeException re = new IllegalArgumentException();// 12 this.m1((RuntimeException)re, "RE");// 13 this.m1((IllegalArgumentException)re, "IAE");// 14 }// 15 diff --git a/testData/results/TestLocalsNames.dec b/testData/results/TestLocalsNames.dec new file mode 100644 index 0000000..a5dc96f --- /dev/null +++ b/testData/results/TestLocalsNames.dec @@ -0,0 +1,77 @@ +package pkg; + +import java.io.File; + +public class TestLocalsNames { + private static void rename(File file, boolean recursively) { + if(file.isDirectory()) {// 22 + long start = System.currentTimeMillis();// 23 + File[] files = file.listFiles();// 25 + File[] var5 = files; + int var6 = files.length; + + for(int var7 = 0; var7 < var6; ++var7) {// 26 + File s = var5[var7]; + File dest = new File(s.getAbsolutePath() + ".tmp");// 27 + + assert s.renameTo(dest) : "unable to rename " + s + " to " + dest;// 28 + } + + long elapsed = System.currentTimeMillis() - start;// 31 + System.out.println("took " + elapsed + "ms (" + elapsed / (long)files.length + "ms per dir)");// 32 + } + + }// 34 +} + +class 'pkg/TestLocalsNames' { + method 'rename (Ljava/io/File;Z)V' { + 1 6 + 4 6 + 7 7 + a 7 + c 8 + f 8 + 13 9 + 17 10 + 18 10 + 1a 12 + 1b 12 + 21 12 + 28 13 + 29 13 + 38 14 + 3e 14 + 43 14 + 49 14 + 55 16 + 66 16 + 70 16 + 7a 16 + 81 12 + 87 19 + 8b 19 + 8c 19 + 8e 20 + 98 20 + a2 20 + ab 20 + ac 20 + ad 20 + b1 20 + b6 20 + b9 20 + bc 23 + } +} + +Lines mapping: +22 <-> 7 +23 <-> 8 +25 <-> 9 +26 <-> 13 +27 <-> 15 +28 <-> 17 +31 <-> 20 +32 <-> 21 +34 <-> 24 diff --git a/testData/src/pkg/TestLocalsNames.java b/testData/src/pkg/TestLocalsNames.java new file mode 100644 index 0000000..0049554 --- /dev/null +++ b/testData/src/pkg/TestLocalsNames.java @@ -0,0 +1,35 @@ +/* + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +import java.io.File; + +public class TestLocalsNames { + private static void rename(File file, boolean recursively) { + if (file.isDirectory()) { + long start = System.currentTimeMillis(); + + File[] files = file.listFiles(); + for (File s : files) { + File dest = new File(s.getAbsolutePath() + ".tmp"); + assert s.renameTo(dest) : "unable to rename " + s + " to " + dest; + } + + long elapsed = System.currentTimeMillis() - start; + System.out.println("took " + elapsed + "ms (" + elapsed / files.length + "ms per dir)"); + } + } +}