Go to the source code of this file.
§ checkClassIndexAndAccessFlags()
char checkClassIndexAndAccessFlags |
( |
JavaClass * |
jc | ) |
|
Verifies the class indexes and access flags.
Checks whether the accessFlags from the class file is a valid combination of class flags. This function also checks if "thisClass" and "superClass" points to valid class indexes.
- Parameters
-
JavaClass* | jc - pointer to the class to be checked |
- Returns
- In case of issues, jc->status is changed, and the function returns 0. Otherwise, nothing is changed with jc, and the return value is 1. This function also
§ checkClassNameFileNameMatch()
char checkClassNameFileNameMatch |
( |
JavaClass * |
jc, |
|
|
const char * |
classFilePath |
|
) |
| |
Checks whether the name of the class pointed by "thisClass" is the same name as the class file.
This function also checks if the folder location match with the class package.
- Parameters
-
JavaClass* | jc - pointer to the class holding the constant pool |
- Returns
- If there is a mismatch, the function returns 0. Otherwise, the return value is 1.
§ checkConstantPoolValidity()
char checkConstantPoolValidity |
( |
JavaClass * |
jc | ) |
|
Iterates over the constant pool looking for inconsistencies in it.
- Parameters
-
JavaClass* | jc - pointer to the javaClass holding the constant pool to be checked. |
- Returns
- If no error is encountered, the function returns 1. In case of failures, the function will set jc->status accordingly and will return 0.
§ checkFieldAccessFlags()
char checkFieldAccessFlags |
( |
JavaClass * |
jc, |
|
|
uint16_t |
accessFlags |
|
) |
| |
Checks whether the "accessFlags" parameter has a valid combination of field flags.
The following status can be set by calling this function:
- USE_OF_RESERVED_FIELD_ACCESS_FLAGS
- INVALID_ACCESS_FLAGS
- Parameters
-
JavaClass* | jc - pointer to the class containing the field |
uint16_t | accessFlags - field flags to be checked |
- Returns
- In case of issues, jc->status is changed, and the function returns 0. Otherwise, nothing is changed with jc, and the return value is 1.
§ checkMethodAccessFlags()
char checkMethodAccessFlags |
( |
JavaClass * |
jc, |
|
|
uint16_t |
accessFlags |
|
) |
| |
Checks whether the "accessFlags" parameter has a valid combination of method flags.
The following status can be set by calling this function:
- USE_OF_RESERVED_METHOD_ACCESS_FLAGS
- INVALID_ACCESS_FLAGS
- Parameters
-
JavaClass* | jc - pointer to the class containing the method |
uint16_t | accessFlags - method flags to be checked |
- Returns
- In case of issues, jc->status is changed, and the function returns 0. Otherwise, nothing is changed with jc, and the return value is 1.
§ isValidJavaIdentifier()
char isValidJavaIdentifier |
( |
uint8_t * |
utf8_bytes, |
|
|
int32_t |
utf8_len, |
|
|
uint8_t |
isClassIdentifier |
|
) |
| |
Checks whether the UTF-8 stream is a valid Java Identifier.
A java identifer (class name, variable name, etc) must start with underscore, dollar sign or letter, and could finish with numbers, letters, dollar sign or underscore.
- Parameters
-
uint8_t* | utf8_bytes - pointer to the sequence of bytes that identify the class name |
int32_t | utf8_len - legth of class name |
uint8_t | isClassIdentifier - if set to anything but zero, then this function will accept slashes (/) as valid characters for identifiers. Classes have their full path separated by slashes, so this must be set to any value other than zero to check classes. |
- Returns
- The function returns 1 if it the string is indeed a valid Java Identifier, otherwise zero.
§ isValidMethodNameIndex()
char isValidMethodNameIndex |
( |
JavaClass * |
jc, |
|
|
uint16_t |
name_index |
|
) |
| |
checks if the name index points to a valid UTF-8 and is a valid java identifier.
The difference between this function and isValidNameIndex() is that this function accepts "<init>" and "<clinit>" as valid names for methods, whereas isValidNameIndex() (when consenquently calling isValidJavaIdentifier()) wouldn't accept those names as valid.
- Parameters
-
JavaClass* | jc - pointer to the class holding the constant pool |
uint16_t | name_index - name_index to be check |
- Returns
- Returns 1 if "name_index" points to a valid UTF-8 and is a valid java identifier. Returns 0 otherwise.
§ isValidNameIndex()
char isValidNameIndex |
( |
JavaClass * |
jc, |
|
|
uint16_t |
name_index, |
|
|
uint8_t |
isClassIdentifier |
|
) |
| |
Identifies if a name index in JavaClass is valid.
- Parameters
-
JavaClass* | jc - pointer to the class holding the constant pool |
uint8_t | isClassIdentifier - if set to zero, will not accept slashes (/) as valid identifier characters. If "isClassIdentifier" is different than zero, then classes with slashes in its name like "java/io/Stream" will be accepted as valid names. |
uint16_t | name_index - name_index to be checked. |
- Returns
- Returns 1 if "name_index" points to a valid UTF-8 and is a valid java identifier. Returns 0 otherwise.