/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* The main javap class to write the contents of a class file as text.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*/
return instance;
}
super(context);
}
this.digestName = name;
}
}
}
this.lastModified = lastModified;
}
return classFile;
}
}
return method;
}
method = m;
}
else
}
indent(+1);
if (lastModified != -1) {
if (size > 0) {
} else {
}
} else if (size > 0) {
}
for (byte b: digest)
}
}
if (sfa instanceof SourceFile_attribute) {
}
indent(-1);
}
print("class ");
else if (classFile.isInterface())
print("interface ");
// use info from class file header
print(" extends ");
}
}
}
} else {
try {
// The signature parser cannot disambiguate between a
// FieldType and a ClassSignatureType that only contains a superclass type.
if (t instanceof Type.ClassSigType) {
print(" extends ");
}
} catch (ConstantPoolException e) {
}
}
println();
indent(+1);
indent(-1);
} else {
print(" ");
}
println("{");
indent(+1);
writeFields();
writeMethods();
indent(-1);
println("}");
}
// where
boolean isInterface;
this.isInterface = isInterface;
}
}
return sb;
}
return sb;
}
return sb;
}
if (isInterface) {
} else {
}
}
return sb;
}
}
return sb;
}
sep = " & ";
}
sep = " & ";
}
}
return sb;
}
case UNBOUNDED:
break;
case EXTENDS:
break;
case SUPER:
break;
default:
throw new AssertionError();
}
return sb;
}
}
sep = ", ";
}
}
private void appendIfNotEmpty(StringBuilder sb, String prefix, List<? extends Type> list, String suffix) {
}
}
}
protected void writeFields() {
writeField(f);
}
}
return;
else {
try {
} catch (ConstantPoolException e) {
// report error?
// fall back on non-generic descriptor
}
}
print(" ");
print(getFieldName(f));
if (a instanceof ConstantValue_attribute) {
print(" = ");
}
}
print(";");
println();
indent(+1);
if (options.showAllAttrs) {
println();
}
indent(-1);
println();
}
protected void writeMethods() {
writeMethod(m);
setPendingNewline(false);
}
return;
method = m;
Descriptor d;
d = m.descriptor;
methodType = null;
} else {
d = methodSig;
try {
} catch (ConstantPoolException e) {
// report error?
// fall back on standard descriptor
methodType = null;
}
}
if (methodType != null) {
}
print("{}");
} else {
print(getJavaReturnType(d));
print(" ");
}
if (e_attr instanceof Exceptions_attribute) {
print(" throws ");
} else {
if (i > 0)
print(", ");
}
}
} else {
report("Unexpected or invalid value for Exceptions attribute");
}
}
println(";");
indent(+1);
if (options.showInternalSignatures) {
}
}
if (c_attr instanceof Code_attribute)
else
report("Unexpected or invalid value for Code attribute");
}
println("Code:");
}
}
}
}
if (options.showAllAttrs) {
}
indent(-1);
// set pendingNewline to write a newline before the next method (if any)
// if a separator is desired
}
print(" ");
}
}
sep = ", ";
}
}
}
return null;
}
if (i > 0)
}
return params;
}
try {
} catch (ConstantPoolException e) {
return report(e);
}
}
try {
} catch (ConstantPoolException e) {
return report(e);
}
}
try {
} catch (ConstantPoolException e) {
return report(e);
}
}
try {
} catch (ConstantPoolException e) {
return report(e);
} catch (DescriptorException e) {
return report(e);
}
}
try {
} catch (ConstantPoolException e) {
return report(e);
} catch (DescriptorException e) {
return report(e);
}
}
try {
} catch (ConstantPoolException e) {
return report(e);
} catch (DescriptorException e) {
return report(e);
}
}
try {
} catch (ConstantPoolException e) {
return report(e);
}
}
try {
return d.getValue(constant_pool);
} catch (ConstantPoolException e) {
return report(e);
}
}
try {
return f.getName(constant_pool);
} catch (ConstantPoolException e) {
return report(e);
}
}
try {
return m.getName(constant_pool);
} catch (ConstantPoolException e) {
return report(e);
}
}
}
try {
} catch (ConstantPoolException e) {
return report(e);
}
}
/**
* Get the value of an entry in the constant pool as a Java constant.
* Characters and booleans are represented by CONSTANT_Intgere entries.
* Character and string values are processed to escape characters outside
* the basic printable ASCII set.
* @param d the descriptor, giving the expected type of the constant
* @param index the index of the value in the constant pool
* @return a printable string containing the value of the constant.
*/
try {
case ConstantPool.CONSTANT_Integer: {
} else { // other: assume integer
}
}
case ConstantPool.CONSTANT_String: {
}
default:
}
} catch (ConstantPoolException e) {
return "#" + index;
}
}
}
for (int i = 0; i < s.length(); i++) {
}
}
else switch (c) {
case '\b': return "\\b";
case '\n': return "\\n";
case '\t': return "\\t";
case '\f': return "\\f";
case '\r': return "\\r";
case '\\': return "\\\\";
case '\'': return "\\'";
case '\"': return "\\\"";
}
}
private long lastModified;
private byte[] digest;
private int size;
}