use of com.sun.tools.classfile.LineNumberTable_attribute in project jdk8u_jdk by JetBrains.
the class AnnotationsElementVisitor method visitLineNumberTable.
@Override
public Element visitLineNumberTable(LineNumberTable_attribute lnt, Element p) {
String name = x.getCpString(lnt.attribute_name_index);
for (LineNumberTable_attribute.Entry e : lnt.line_number_table) {
Element l = new Element(name);
l.setAttr("bci", "" + e.start_pc);
l.setAttr("line", "" + e.line_number);
l.trimToSize();
p.add(l);
}
// already added to parent
return null;
}
use of com.sun.tools.classfile.LineNumberTable_attribute in project ceylon-compiler by ceylon.
the class SourceWriter method setLineMap.
private void setLineMap(Code_attribute attr) {
SortedMap<Integer, SortedSet<Integer>> map = new TreeMap<Integer, SortedSet<Integer>>();
SortedSet<Integer> allLines = new TreeSet<Integer>();
for (Attribute a : attr.attributes) {
if (a instanceof LineNumberTable_attribute) {
LineNumberTable_attribute t = (LineNumberTable_attribute) a;
for (LineNumberTable_attribute.Entry e : t.line_number_table) {
int start_pc = e.start_pc;
int line = e.line_number;
SortedSet<Integer> pcLines = map.get(start_pc);
if (pcLines == null) {
pcLines = new TreeSet<Integer>();
map.put(start_pc, pcLines);
}
pcLines.add(line);
allLines.add(line);
}
}
}
lineMap = map;
lineList = new ArrayList<Integer>(allLines);
}