jvm/src/native_methods.rs

2116 lines
108 KiB
Rust
Raw Normal View History

use crate::classfile::{ AbstractTypeDescription, AbstractTypeKind, MethodDescriptor };
use crate::native_registry::NativeMethodCallable;
use crate::jvm::JVM;
use crate::jvm::Error;
use crate::jvm::JVMCallbackOperation;
pub fn ignore_call(_: &mut JVM) -> Result<JVMCallbackOperation, Error> {
Ok(JVMCallbackOperation::PopFrame())
}
pub fn todo_call(_: &mut JVM) -> Result<JVMCallbackOperation, Error> {
todo!()
}
pub fn java_lang_object_get_class(jvm: &mut JVM) -> Result<JVMCallbackOperation, Error> {
todo!()
}
pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Result<NativeMethodCallable, Error> {
let method_name: &str = &m.name;
match (class_name, method_name) {
("java/lang/Class", "forName0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/ClassLoader".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Class"))},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "desiredAssertionStatus0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getClassAccessFlagsRaw0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getClassFileVersion0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getConstantPool") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("jdk/internal/reflect/ConstantPool".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getDeclaredClasses0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getDeclaredConstructors0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
]),
return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/reflect/Constructor".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getDeclaredFields0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
]),
return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/reflect/Field".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getDeclaredMethods0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
]),
return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/reflect/Method".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getDeclaringClass0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getEnclosingMethod0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getGenericSignature0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getInterfaces0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getNestMembers0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getModifiers") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getNestHost0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getPermittedSubclasses0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getPrimitiveClass") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getProtectionDomain0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/security/ProtectionDomain".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getRawAnnotations") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Byte() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getRawTypeAnnotations") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Byte() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getRecordComponents0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/reflect/RecordComponent".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getSimpleBinaryName0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getSigners") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "getSuperclass") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "isAssignableFrom") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "initClassName") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "isArray") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "isHidden") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "isInstance") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "isInterface") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "isPrimitive") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "isRecord0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "registerNatives") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Class", "setSigners") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/String", "intern") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/String"))},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Object", "clone") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Object"))},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Object", "getClass") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Class"))},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(java_lang_object_get_class)
}
("java/lang/Object", "hashCode") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Object", "notifyAll") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/Object", "notify") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
2024-09-09 17:01:08 +02:00
("java/lang/Object", "wait0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
2024-09-09 17:01:08 +02:00
("java/lang/System", "arraycopy") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/System", "currentTimeMillis") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/System", "identityHashCode") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/System", "mapLibraryName") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/System", "nanoTime") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/System", "registerNatives") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(ignore_call)
}
("java/lang/System", "setIn0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/io/InputStream".to_string()) }
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/System", "setOut0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/io/PrintStream".to_string()) }
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("java/lang/System", "setErr0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/io/PrintStream".to_string()) }
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "arrayBaseOffset0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "arrayIndexScale0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "allocateInstance") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Object"))},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "allocateMemory0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "copyMemory0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "copySwapMemory0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "freeMemory0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "reallocateMemory0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "setMemory0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndSetBoolean") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndSetByte") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndSetChar") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndSetDouble") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndSetFloat") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndSetInt") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndSetLong") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndSetReference") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndSetShort") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndExchangeBoolean") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndExchangeByte") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndExchangeChar") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndExchangeDouble") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndExchangeFloat") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndExchangeInt") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndExchangeLong") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndExchangeShort") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "compareAndExchangeReference") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Object"))},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "defineClass0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) },
AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Byte() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/ClassLoader".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/security/ProtectionDomain".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Class"))},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "ensureClassInitialized0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "fullFence") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getBooleanVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getByteVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getCharVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getFloatVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getDoubleVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getIntVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getLongVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getShortVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getReferenceVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Object"))},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getBoolean") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getByte") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getChar") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getDouble") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getFloat") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getInt") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getLoadAverage0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Double() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getLong") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getReference") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Object"))},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getShort") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "getUncompressedObject") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Object"))},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "objectFieldOffset0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/reflect/Field".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "objectFieldOffset1") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "registerNatives") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(ignore_call)
}
("jdk/internal/misc/Unsafe", "park") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putBoolean") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putByte") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putChar") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putDouble") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putFloat") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putInt") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putLong") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putReference") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putShort") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putBooleanVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putByteVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putCharVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putFloatVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putDoubleVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putIntVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putLongVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putShortVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "putReferenceVolatile") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "shouldBeInitialized0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "staticFieldOffset0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/reflect/Field".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "staticFieldOffset1") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) },
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "staticFieldBase0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/reflect/Field".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
// This will require some changes in the future
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "unpark") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "throwException") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Throwable".to_string()) },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "writeback0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "writebackPostSync0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
("jdk/internal/misc/Unsafe", "writebackPreSync0") => {
let expected_descriptor = MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()},
};
if m.descriptor != expected_descriptor {
return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string())));
}
Ok(todo_call)
}
_ => Err(Error::RunTimeError(format!("Failed to find native implementation for method '{class_name}.{method_name}'"))),
}
}