|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--util.dataRead | +--classfile.methodInfo
The fields of the methodInfo structure are the same as those of the fieldInfo structure. However, the semantics of the two structures differ enough that they are implemented by two different objects. For example, in the case of the fieldInfo structure only the constValueAttr is allowed. The attributes that are allowed for a methodInfo attribute are:
Allowed access modifiers for a method are:
Other modifiers are
method_info { u2 access_flags; u2 name_index; (Utf8 in the constant pool) u2 descriptor_index; (Utf8 in the constant pool) u2 attributes_cnt; attribute_info attributes[ attributes_cnt ]; }
There should not be more than one code attribute for a method. Code attributes are special in that they provide extra information about the method in the code attribute attribute table. For example, the code attribute contains information about the local variables in the method.
Inner Class Summary | |
(package private) class |
methodInfo.methodTypes
The methodTypes class is used by the methodTypes method to return the argument list string and the return type that are built from the method descriptor. |
Field Summary | |
(package private) int |
access_flags
|
(package private) attrInfo[] |
attributes
|
(package private) codeAttr |
codeAttribute
|
(package private) java.lang.String |
constructorName
|
(package private) constUtf8 |
descriptor
|
(package private) constUtf8 |
name
|
Fields inherited from class util.dataRead |
bytesRead |
Fields inherited from interface util.access_and_modifier_flags |
ACC_ABSTRACT,
ACC_FINAL,
ACC_INTERFACE,
ACC_NATIVE,
ACC_PRIVATE,
ACC_PROTECTED,
ACC_PUBLIC,
ACC_STATIC,
ACC_STRICT,
ACC_SYNC,
ACC_TRANSIENT,
ACC_VOLATILE |
Constructor Summary | |
(package private) |
methodInfo(java.io.DataInputStream dStream,
constPool constPoolSec)
|
Method Summary | |
private java.lang.String |
commentString()
If there are synthetic or deprecated attributes in the method attribute table, return a comment string showing the appropriate attribute. |
private methodInfo.methodTypes |
decodeMethodDesc(java.lang.String methodDesc)
Decode the method descriptor and return the argument list and return type. |
private java.lang.String |
exceptionString()
Return a string containing "\n throws |
java.lang.String |
getConstructorName()
|
boolean |
isConstructor()
Class constructors have the internal name " |
(package private) java.lang.String |
methodString(java.lang.String terminalStr)
This method is passed the string that should be used to terminate the method declaration. |
(package private) void |
pr()
Print method declaration (e.g., private int foobar( int x ) and any local variables. |
void |
setConstructorName(java.lang.String newName)
Set the name of the constructor name |
Methods inherited from class util.dataRead |
getBytesRead,
readU1,
readU2,
readU4 |
Methods inherited from class java.lang.Object |
|
Field Detail |
int access_flags
constUtf8 name
java.lang.String constructorName
constUtf8 descriptor
attrInfo[] attributes
codeAttr codeAttribute
Constructor Detail |
methodInfo(java.io.DataInputStream dStream, constPool constPoolSec)
Method Detail |
public boolean isConstructor()
public void setConstructorName(java.lang.String newName)
public java.lang.String getConstructorName()
private java.lang.String commentString()
private java.lang.String exceptionString()
The exception attribute has a table of exceptions that are associated with the class method. So there should only be one exceptions attribute associated with a given method.
private methodInfo.methodTypes decodeMethodDesc(java.lang.String methodDesc)
The method descriptor describes the arguments to the method. The format for the method descriptor is: '(' (type-descriptor)* ')' return-type The method argument descriptor starts with '(' and consists of zero or more type descriptions. Types are described by either a single letter (see util.typeDesc class) or an object path terminated by a semicolon. In the same way, the return type will either be an object path, an atomic type or "void", which is indicated by the letter 'V'. See section 4.3.3 of the JVM Spec. Note that the character that denotes an object path start is "L". So lets say we have the following method declaration: myObj foo(int i, double d, long l, barObj b, char c) {...} This method would have the method descriptor (IDJLmypkg/barObj;C)Lmypkg/myObj; The descriptor arguments are enclosed by parenthesis. The IDJ represents the int, double and long arguments. The barObj argument is represented by the "Lmypkg/barObj;", where 'L' denotes the start of the object path and ';' terminates the path.
java.lang.String methodString(java.lang.String terminalStr)
void pr()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |