summaryrefslogtreecommitdiffstats
path: root/src/org
diff options
context:
space:
mode:
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-10-06 10:10:01 +0300
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-10-06 10:10:01 +0300
commit07ca9cf0624ededd39fe73c3c92d3e7647f02183 (patch)
tree6cb63dbccdafc22757cf547e464fae76d2548e52 /src/org
parent9723ab447587657d7c459567966df85c9e22204e (diff)
downloadfernflower-07ca9cf0624ededd39fe73c3c92d3e7647f02183.tar
fernflower-07ca9cf0624ededd39fe73c3c92d3e7647f02183.tar.gz
fernflower-07ca9cf0624ededd39fe73c3c92d3e7647f02183.tar.lz
fernflower-07ca9cf0624ededd39fe73c3c92d3e7647f02183.tar.xz
fernflower-07ca9cf0624ededd39fe73c3c92d3e7647f02183.zip
java-decompiler: unwanted dependency dropped
Diffstat (limited to 'src/org')
-rw-r--r--src/org/jetbrains/java/decompiler/struct/attr/StructLineNumberTableAttribute.java30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/org/jetbrains/java/decompiler/struct/attr/StructLineNumberTableAttribute.java b/src/org/jetbrains/java/decompiler/struct/attr/StructLineNumberTableAttribute.java
index b246a1e..695d659 100644
--- a/src/org/jetbrains/java/decompiler/struct/attr/StructLineNumberTableAttribute.java
+++ b/src/org/jetbrains/java/decompiler/struct/attr/StructLineNumberTableAttribute.java
@@ -15,12 +15,10 @@
*/
package org.jetbrains.java.decompiler.struct.attr;
-import com.intellij.openapi.util.Pair;
import org.jetbrains.java.decompiler.struct.consts.ConstantPool;
import org.jetbrains.java.decompiler.util.DataInputFullStream;
import java.io.IOException;
-import java.util.*;
/**
* u2 line_number_table_length;
@@ -31,37 +29,33 @@ import java.util.*;
* Created by Egor on 05.10.2014.
*/
public class StructLineNumberTableAttribute extends StructGeneralAttribute {
- private List<Pair<Integer, Integer>> myLineInfo = Collections.emptyList();
+ private int[] myLineInfo = new int[0];
@Override
public void initContent(ConstantPool pool) throws IOException {
DataInputFullStream data = stream();
- int len = data.readUnsignedShort();
+ int len = data.readUnsignedShort() * 2;
if (len > 0) {
- myLineInfo = new ArrayList<Pair<Integer, Integer>>(len);
- for (int i = 0; i < len; i++) {
- int startPC = data.readUnsignedShort();
- int lineNumber = data.readUnsignedShort();
- myLineInfo.add(Pair.create(startPC, lineNumber));
+ myLineInfo = new int[len];
+ for (int i = 0; i < len; i += 2) {
+ myLineInfo[i] = data.readUnsignedShort();
+ myLineInfo[i + 1] = data.readUnsignedShort();
}
}
- else {
- myLineInfo = Collections.emptyList();
+ else if (myLineInfo.length > 0) {
+ myLineInfo = new int[0];
}
}
public int getFirstLine() {
- if (!myLineInfo.isEmpty()) {
- return myLineInfo.get(0).getSecond();
- }
- return -1;
+ return myLineInfo.length > 0 ? myLineInfo[1] : -1;
}
public int findLineNumber(int pc) {
- for (Pair<Integer, Integer> pair : myLineInfo) {
- if (pc >= pair.getFirst()) {
- return pair.getSecond();
+ for (int i = 0; i < myLineInfo.length; i += 2) {
+ if (pc >= myLineInfo[i]) {
+ return myLineInfo[i + 1];
}
}
return -1;