APIdia Launch Partner
Top Inners Fields Constructors Methods
com.sun.tools.javap

public Class ClassWriter

extends BasicWriter
Class Inheritance
Imports
java.lang.classfile.AccessFlags, .Attributes, .ClassFile, .ClassHierarchyResolver, .ClassModel, .ClassSignature, .FieldModel, .MethodModel, .MethodSignature, .Signature, java.lang.classfile.attribute.CodeAttribute, .SignatureAttribute, java.lang.classfile.constantpool.ClassEntry, .ConstantValueEntry, .PoolEntry, java.lang.constant.ClassDesc, java.lang.reflect.AccessFlag, .ClassFileFormatVersion, .Modifier, java.net.URI, java.text.DateFormat, java.util.ArrayList, .Collection, .Date, .EnumSet, .LinkedHashSet, .List, .Locale, .Set

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static record

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
private final AttributeWriter
private ClassModel
private final CodeWriter
private final ConstantWriter
private static final int
private static final int
private byte[]
private String
private long
private MethodModel
private final Options
pack-priv final ClassWriter.SignaturePrinter
private int
private URI
private static final ClassFile
Inherited from com.sun.tools.javap.BasicWriter:
errorReportedmessages

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
pack-priv String
adjustVarargs(int flags, String params)

protected ClassFileFormatVersion
cffv()

private String
esc(char c, char quote)

private Set<String>
protected ClassModel
private Set<String>
private String
private String
pack-priv String

Returns:

a printable string containing the value of the constant.
getConstantValue
(ClassDesc
the descriptor, giving the expected type of the constant
d
,
ConstantValueEntry
the index of the value in the constant pool
cpInfo
)

Get the value of an entry in the constant pool as a Java constant.

private static Set<String>
getFlags(int mask, Set<AccessFlag> flags)

pack-priv static String
pack-priv String
protected MethodModel
private static Set<String>
pack-priv static ClassWriter
instance(Context context)

protected void
pack-priv void
setDigest(String name, byte[] digest)

pack-priv void
setFile(URI uri)

pack-priv void
setFileSize(int size)

pack-priv void
setLastModified(long lastModified)

protected void
public boolean
pack-priv void
protected void
protected void
pack-priv void
writeList(String prefix, Collection<?> items, String suffix)

pack-priv void
writeListIfNotEmpty(String prefix, List<?> items, String suffix)

protected void
protected void
pack-priv void
Inherited from com.sun.tools.javap.BasicWriter:
flagsReportUnknownindentmaskToAccessFlagsReportUnknownprintprintprintprintlnprintlnprintlnprintlnreportreportsetPendingNewlinespacetab

Field Detail

ACC_STATIC_PHASEback to summary
public static final int ACC_STATIC_PHASE
ACC_TRANSITIVEback to summary
public static final int ACC_TRANSITIVE
attrWriterback to summary
private final AttributeWriter attrWriter
classModelback to summary
private ClassModel classModel
codeWriterback to summary
private final CodeWriter codeWriter
constantWriterback to summary
private final ConstantWriter constantWriter
DEFAULT_ALLOWED_MAJOR_VERSIONback to summary
private static final int DEFAULT_ALLOWED_MAJOR_VERSION
DEFAULT_ALLOWED_MINOR_VERSIONback to summary
private static final int DEFAULT_ALLOWED_MINOR_VERSION
digestback to summary
private byte[] digest
digestNameback to summary
private String digestName
lastModifiedback to summary
private long lastModified
methodback to summary
private MethodModel method
optionsback to summary
private final Options options
sigPrinterback to summary
pack-priv final ClassWriter.SignaturePrinter sigPrinter
sizeback to summary
private int size
uriback to summary
private URI uri
VERIFIERback to summary
private static final ClassFile VERIFIER

Constructor Detail

ClassWriterback to summary
protected ClassWriter(Context context)

Method Detail

adjustVarargsback to summary
pack-priv String adjustVarargs(int flags, String params)
cffvback to summary
protected ClassFileFormatVersion cffv()
escback to summary
private String esc(char c, char quote)
getClassFlagsback to summary
private Set<String> getClassFlags(AccessFlags flags)
getClassModelback to summary
protected ClassModel getClassModel()
getClassModifiersback to summary
private Set<String> getClassModifiers(AccessFlags flags)
getConstantCharValueback to summary
private String getConstantCharValue(char c)
getConstantStringValueback to summary
private String getConstantStringValue(String s)
getConstantValueback to summary
pack-priv String getConstantValue(ClassDesc d, ConstantValueEntry cpInfo)

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.

Parameters
d:ClassDesc

the descriptor, giving the expected type of the constant

cpInfo:ConstantValueEntry

the index of the value in the constant pool

Returns:String

a printable string containing the value of the constant.

getFlagsback to summary
private static Set<String> getFlags(int mask, Set<AccessFlag> flags)
getJavaNameback to summary
pack-priv static String getJavaName(String name)
getJavaParameterTypesback to summary
pack-priv String getJavaParameterTypes(MethodSignature d, int flags)
getMethodback to summary
protected MethodModel getMethod()
getModifiersback to summary
private static Set<String> getModifiers(Set<AccessFlag> flags)
instanceback to summary
pack-priv static ClassWriter instance(Context context)
setClassFileback to summary
protected void setClassFile(ClassModel cm)
setDigestback to summary
pack-priv void setDigest(String name, byte[] digest)
setFileback to summary
pack-priv void setFile(URI uri)
setFileSizeback to summary
pack-priv void setFileSize(int size)
setLastModifiedback to summary
pack-priv void setLastModified(long lastModified)
setMethodback to summary
protected void setMethod(MethodModel m)
writeback to summary
public boolean write(ClassModel cm)
writeDirectivesback to summary
pack-priv void writeDirectives()
writeFieldback to summary
protected void writeField(FieldModel f)
writeFieldsback to summary
protected void writeFields()
writeListback to summary
pack-priv void writeList(String prefix, Collection<?> items, String suffix)
writeListIfNotEmptyback to summary
pack-priv void writeListIfNotEmpty(String prefix, List<?> items, String suffix)
writeMethodback to summary
protected void writeMethod(MethodModel m)
writeMethodsback to summary
protected void writeMethods()
writeModifiersback to summary
pack-priv void writeModifiers(Collection<String> items)
com.sun.tools.javap back to summary

public final Record ClassWriter.SignaturePrinter

extends Record
Class Inheritance
Record Components
verbose:boolean 

Field Summary

Modifier and TypeField and Description
private final boolean
verbose

Record Component accessed by verbose().

Constructor Summary

AccessConstructor and Description
public
SignaturePrinter(boolean verbose)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

private boolean
public String
print(ClassSignature cs, boolean isInterface)

public String
private void
private void
private void
public String
printList(String prefix, List<? extends Signature> args, String postfix)

public String
public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public boolean
verbose()

Record Component getter of verbose.

Field Detail

verboseback to summary
private final boolean verbose

Record Component accessed by verbose().

Constructor Detail

SignaturePrinterback to summary
public SignaturePrinter(boolean verbose)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

isObjectback to summary
private boolean isObject(Signature sig)
printback to summary
public String print(ClassSignature cs, boolean isInterface)
printback to summary
public String print(Signature sig)
printback to summary
private void print(StringBuilder sb, List<Signature.TypeParam> tps)
printback to summary
private void print(StringBuilder sb, Signature sig)
printback to summary
private void print(StringBuilder sb, Signature.TypeArg ta)
printListback to summary
public String printList(String prefix, List<? extends Signature> args, String postfix)
printTypeParamsback to summary
public String printTypeParams(List<Signature.TypeParam> tps)
toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

verboseback to summary
public boolean verbose()

Record Component getter of verbose.