|
|
@ -1,6 +1,7 @@ |
|
|
|
package org.jetbrains.java.decompiler.struct.attr; |
|
|
|
package org.jetbrains.java.decompiler.struct.attr; |
|
|
|
|
|
|
|
|
|
|
|
import org.jetbrains.java.decompiler.struct.consts.ConstantPool; |
|
|
|
import org.jetbrains.java.decompiler.struct.consts.ConstantPool; |
|
|
|
|
|
|
|
import org.jetbrains.java.decompiler.struct.consts.PrimitiveConstant; |
|
|
|
import org.jetbrains.java.decompiler.util.DataInputFullStream; |
|
|
|
import org.jetbrains.java.decompiler.util.DataInputFullStream; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
@ -9,16 +10,31 @@ import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
public final class StructOriginalPcTableAttribute extends StructGeneralAttribute { |
|
|
|
public final class StructOriginalPcTableAttribute extends StructGeneralAttribute { |
|
|
|
private final Map<Integer, Integer> pcs = new HashMap<>(); |
|
|
|
private final Map<Integer, Integer> pcs = new HashMap<>(); |
|
|
|
|
|
|
|
private final Map<Integer, String> names = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { |
|
|
|
public void initContent(DataInputFullStream data, ConstantPool pool) throws IOException { |
|
|
|
int len = data.readUnsignedShort(); |
|
|
|
int pcsLen = data.readUnsignedShort(); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < len; i++) { |
|
|
|
for (int i = 0; i < pcsLen; i++) { |
|
|
|
int pc = data.readUnsignedShort(); |
|
|
|
int pc = data.readUnsignedShort(); |
|
|
|
int originalPc = data.readUnsignedShort(); |
|
|
|
int originalPc = data.readUnsignedShort(); |
|
|
|
pcs.put(pc, originalPc); |
|
|
|
pcs.put(pc, originalPc); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int namesLen = data.readUnsignedShort(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < namesLen; i++) { |
|
|
|
|
|
|
|
int originalPc = data.readUnsignedShort(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PrimitiveConstant constant = pool.getPrimitiveConstant(data.readUnsignedShort()); |
|
|
|
|
|
|
|
if (constant.type != PrimitiveConstant.CONSTANT_Utf8) { |
|
|
|
|
|
|
|
throw new IllegalArgumentException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String name = (String) constant.value; |
|
|
|
|
|
|
|
names.put(originalPc, name); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean hasOriginalPc(int pc) { |
|
|
|
public boolean hasOriginalPc(int pc) { |
|
|
@ -28,4 +44,12 @@ public final class StructOriginalPcTableAttribute extends StructGeneralAttribute |
|
|
|
public int getOriginalPc(int pc) { |
|
|
|
public int getOriginalPc(int pc) { |
|
|
|
return pcs.get(pc); |
|
|
|
return pcs.get(pc); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean hasName(int originalPc) { |
|
|
|
|
|
|
|
return names.containsKey(originalPc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getName(int originalPc) { |
|
|
|
|
|
|
|
return names.get(originalPc); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|