Implemented a lot of opcodes and some native methods
This commit is contained in:
parent
4c43e9290f
commit
272a34b7cd
5 changed files with 394 additions and 101 deletions
|
@ -6,6 +6,7 @@ use core::str::Utf8Error;
|
|||
use crate::accessmasks::*;
|
||||
use crate::bytecode::Bytecode;
|
||||
use crate::constantpool::{ ConstantFieldRefInfo, ConstantPoolInfo, ConstantUtf8Info, ConstantInterfaceMethodRefInfo, ConstantStringInfo, ConstantMethodRefInfo, ConstantFloatInfo, ConstantClassInfo, ConstantNameAndTypeInfo, ConstantIntegerInfo, ConstantLongInfo };
|
||||
use crate::constantpool::ConstantDoubleInfo;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
|
@ -266,6 +267,15 @@ impl JavaClassFile {
|
|||
};
|
||||
}
|
||||
|
||||
pub fn pool_double_entry(&self, index: u16) -> Result<&ConstantDoubleInfo, Error> {
|
||||
let pool_entry = self.pool_entry(index)?;
|
||||
|
||||
return match pool_entry {
|
||||
ConstantPoolInfo::Double(data) => Ok(data),
|
||||
_ => Err(Error::BadFileError(format!("Expected constant pool entry {} in class {} to be of type Double but found {:?}", index, self.get_classname()?, pool_entry)))
|
||||
};
|
||||
}
|
||||
|
||||
pub fn pool_long_entry(&self, index: u16) -> Result<&ConstantLongInfo, Error> {
|
||||
let pool_entry = self.pool_entry(index)?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue