Class loading, object creation
This commit is contained in:
parent
25d3509ccf
commit
4dabd6c3a8
5 changed files with 235 additions and 39 deletions
|
@ -162,7 +162,18 @@ impl JavaClassFile {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn get_classname(&self) -> Result<String, Error> {
|
||||
pub fn has_super_class(&self) -> bool {
|
||||
return self.super_class != 0;
|
||||
}
|
||||
|
||||
pub fn get_super_class_name(&self) -> Result<&String, Error> {
|
||||
let super_class_entry = self.pool_class_entry(self.super_class)?;
|
||||
let super_name_entry = self.pool_utf8_entry(super_class_entry.name_index)?;
|
||||
|
||||
return Ok(&super_name_entry.utf8);
|
||||
}
|
||||
|
||||
pub fn get_classname(&self) -> Result<&String, Error> {
|
||||
let class_info_entry = self.pool_entry(self.this_class)?;
|
||||
|
||||
let class_info_entry = match class_info_entry {
|
||||
|
@ -176,7 +187,7 @@ impl JavaClassFile {
|
|||
_ => return Err(Error::BadFileError(format!("Invalid class_info.name_index from this_class, expected index to Utf8 but found {:?}", name_entry)))
|
||||
};
|
||||
|
||||
return Ok(name_entry.utf8.clone());
|
||||
return Ok(&name_entry.utf8);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue