src/share/classes/com/sun/tools/javap/ClassWriter.java

changeset 2267
3b9176029091
parent 2089
bb87db832b31
child 2277
77942ba5797f
equal deleted inserted replaced
2266:08daa4a9ce0f 2267:3b9176029091
1 /* 1 /*
2 * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
496 code = (Code_attribute) c_attr; 496 code = (Code_attribute) c_attr;
497 else 497 else
498 report("Unexpected or invalid value for Code attribute"); 498 report("Unexpected or invalid value for Code attribute");
499 } 499 }
500 500
501 if (options.showDisassembled && !options.showAllAttrs) {
502 if (code != null) {
503 println("Code:");
504 codeWriter.writeInstrs(code);
505 codeWriter.writeExceptionTable(code);
506 }
507 }
508
509 if (options.showLineAndLocalVariableTables) {
510 if (code != null) {
511 attrWriter.write(code, code.attributes.get(Attribute.LineNumberTable), constant_pool);
512 attrWriter.write(code, code.attributes.get(Attribute.LocalVariableTable), constant_pool);
513 }
514 }
515
516 if (options.showAllAttrs) { 501 if (options.showAllAttrs) {
517 Attribute[] attrs = m.attributes.attrs; 502 Attribute[] attrs = m.attributes.attrs;
518 for (Attribute attr: attrs) 503 for (Attribute attr: attrs)
519 attrWriter.write(m, attr, constant_pool); 504 attrWriter.write(m, attr, constant_pool);
505 } else if (code != null) {
506 if (options.showDisassembled) {
507 println("Code:");
508 codeWriter.writeInstrs(code);
509 codeWriter.writeExceptionTable(code);
510 }
511
512 if (options.showLineAndLocalVariableTables) {
513 attrWriter.write(code, code.attributes.get(Attribute.LineNumberTable), constant_pool);
514 attrWriter.write(code, code.attributes.get(Attribute.LocalVariableTable), constant_pool);
515 }
520 } 516 }
521 517
522 indent(-1); 518 indent(-1);
523 519
524 // set pendingNewline to write a newline before the next method (if any) 520 // set pendingNewline to write a newline before the next method (if any)

mercurial