From 309aca1d29b42f74179a17e9563c015656aa45a7 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Fri, 17 Oct 2014 17:02:13 +0400 Subject: [PATCH] decompiler: fixed bytecode test --- .../main/collectors/BytecodeSourceMapper.java | 9 +++------ .../TestClassSimpleBytecodeMapping.dec | 20 +++++++++---------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/org/jetbrains/java/decompiler/main/collectors/BytecodeSourceMapper.java b/src/org/jetbrains/java/decompiler/main/collectors/BytecodeSourceMapper.java index 6cbaa83..0f1bb4d 100644 --- a/src/org/jetbrains/java/decompiler/main/collectors/BytecodeSourceMapper.java +++ b/src/org/jetbrains/java/decompiler/main/collectors/BytecodeSourceMapper.java @@ -1,9 +1,6 @@ package org.jetbrains.java.decompiler.main.collectors; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; +import java.util.*; import java.util.Map.Entry; import org.jetbrains.java.decompiler.main.DecompilerContext; @@ -14,13 +11,13 @@ public class BytecodeSourceMapper { private int offset_total; // class, method, bytecode offset, source line - private HashMap>> mapping = new HashMap>>(); + private final HashMap>> mapping = new LinkedHashMap>>(); // need to preserve order public void addMapping(String classname, String methodname, int bytecode_offset, int source_line) { HashMap> class_mapping = mapping.get(classname); if(class_mapping == null) { - mapping.put(classname, class_mapping = new HashMap>()); + mapping.put(classname, class_mapping = new LinkedHashMap>()); // need to preserve order } HashMap method_mapping = class_mapping.get(methodname); diff --git a/testData/results/TestClassSimpleBytecodeMapping.dec b/testData/results/TestClassSimpleBytecodeMapping.dec index 8b3c3df..3742f96 100644 --- a/testData/results/TestClassSimpleBytecodeMapping.dec +++ b/testData/results/TestClassSimpleBytecodeMapping.dec @@ -22,11 +22,14 @@ public class TestClassSimpleBytecodeMapping { } } -class pkg/TestClassSimpleBytecodeMapping{ - method run (Ljava/lang/Runnable;)V{ - 1 20 +class pkg/TestClassSimpleBytecodeMapping$1{ + method run ()V{ + 0 7 + 3 7 + 5 7 } - +} +class pkg/TestClassSimpleBytecodeMapping{ method test ()I{ 0 4 3 4 @@ -47,11 +50,8 @@ class pkg/TestClassSimpleBytecodeMapping{ 2e 15 2f 15 } -} -class pkg/TestClassSimpleBytecodeMapping$1{ - method run ()V{ - 0 7 - 3 7 - 5 7 + + method run (Ljava/lang/Runnable;)V{ + 1 20 } }