< prev index next >

src/java.base/share/classes/jdk/internal/classfile/impl/AbstractAttributeMapper.java

Print this page

289         private LineNumberTableMapper() {
290             super(NAME_LINE_NUMBER_TABLE, AttributeStability.LABELS, true);
291         }
292 
293         @Override
294         public LineNumberTableAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
295             return new BoundAttribute.BoundLineNumberTableAttribute(cf, this, p);
296         }
297 
298         @Override
299         protected void writeBody(BufWriter buf, LineNumberTableAttribute attr) {
300             List<LineNumberInfo> lines = attr.lineNumbers();
301             buf.writeU2(lines.size());
302             for (LineNumberInfo line : lines) {
303                 buf.writeU2(line.startPc());
304                 buf.writeU2(line.lineNumber());
305             }
306         }
307     }
308 


















309     public static final class LocalVariableTableMapper extends AbstractAttributeMapper<LocalVariableTableAttribute> {
310         public static final LocalVariableTableMapper INSTANCE = new LocalVariableTableMapper();
311 
312         private LocalVariableTableMapper() {
313             super(NAME_LOCAL_VARIABLE_TABLE, AttributeStability.LABELS, true);
314         }
315 
316         @Override
317         public LocalVariableTableAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
318             return new BoundAttribute.BoundLocalVariableTableAttribute(e, cf, this, p);
319         }
320 
321         @Override
322         protected void writeBody(BufWriter buf, LocalVariableTableAttribute attr) {
323             List<LocalVariableInfo> infos = attr.localVariables();
324             buf.writeU2(infos.size());
325             for (LocalVariableInfo info : infos) {
326                 buf.writeU2(info.startPc());
327                 buf.writeU2(info.length());
328                 buf.writeIndex(info.name());

289         private LineNumberTableMapper() {
290             super(NAME_LINE_NUMBER_TABLE, AttributeStability.LABELS, true);
291         }
292 
293         @Override
294         public LineNumberTableAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
295             return new BoundAttribute.BoundLineNumberTableAttribute(cf, this, p);
296         }
297 
298         @Override
299         protected void writeBody(BufWriter buf, LineNumberTableAttribute attr) {
300             List<LineNumberInfo> lines = attr.lineNumbers();
301             buf.writeU2(lines.size());
302             for (LineNumberInfo line : lines) {
303                 buf.writeU2(line.startPc());
304                 buf.writeU2(line.lineNumber());
305             }
306         }
307     }
308 
309     public static final class LoadableDescriptorsMapper extends AbstractAttributeMapper<LoadableDescriptorsAttribute> {
310         public static final LoadableDescriptorsMapper INSTANCE = new LoadableDescriptorsMapper();
311 
312         private LoadableDescriptorsMapper() {
313             super(NAME_LOADABLE_DESCRIPTORS, AttributeStability.CP_REFS);
314         }
315 
316         @Override
317         public LoadableDescriptorsAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
318             return new BoundAttribute.BoundLoadableDescriptorsAttribute(cf, this, p);
319         }
320 
321         @Override
322         protected void writeBody(BufWriter buf, LoadableDescriptorsAttribute attr) {
323             buf.writeListIndices(attr.loadableDescriptors());
324         }
325     }
326 
327     public static final class LocalVariableTableMapper extends AbstractAttributeMapper<LocalVariableTableAttribute> {
328         public static final LocalVariableTableMapper INSTANCE = new LocalVariableTableMapper();
329 
330         private LocalVariableTableMapper() {
331             super(NAME_LOCAL_VARIABLE_TABLE, AttributeStability.LABELS, true);
332         }
333 
334         @Override
335         public LocalVariableTableAttribute readAttribute(AttributedElement e, ClassReader cf, int p) {
336             return new BoundAttribute.BoundLocalVariableTableAttribute(e, cf, this, p);
337         }
338 
339         @Override
340         protected void writeBody(BufWriter buf, LocalVariableTableAttribute attr) {
341             List<LocalVariableInfo> infos = attr.localVariables();
342             buf.writeU2(infos.size());
343             for (LocalVariableInfo info : infos) {
344                 buf.writeU2(info.startPc());
345                 buf.writeU2(info.length());
346                 buf.writeIndex(info.name());
< prev index next >