Skip to content

Commit e57bded

Browse files
committed
Style
1 parent 1217adf commit e57bded

7 files changed

Lines changed: 32 additions & 13 deletions

File tree

java_runtime/src/classes/java/lang.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ mod linkage_error;
1919
mod math;
2020
mod negative_array_size_exception;
2121
mod no_class_def_found_error;
22-
mod number_format_exception;
2322
mod no_such_field_error;
2423
mod no_such_method_error;
2524
mod null_pointer_exception;
25+
mod number_format_exception;
2626
mod object;
2727
mod runnable;
2828
mod runtime;
@@ -43,9 +43,9 @@ pub use self::{
4343
exception::Exception, illegal_argument_exception::IllegalArgumentException, incompatible_class_change_error::IncompatibleClassChangeError,
4444
index_out_of_bounds_exception::IndexOutOfBoundsException, instantiation_error::InstantiationError, integer::Integer,
4545
interrupted_exception::InterruptedException, linkage_error::LinkageError, math::Math, negative_array_size_exception::NegativeArraySizeException,
46-
no_class_def_found_error::NoClassDefFoundError, number_format_exception::NumberFormatException, no_such_field_error::NoSuchFieldError, no_such_method_error::NoSuchMethodError,
47-
null_pointer_exception::NullPointerException, object::Object, runnable::Runnable, runtime::Runtime, runtime_exception::RuntimeException,
48-
security_exception::SecurityException, string::String, string_buffer::StringBuffer,
46+
no_class_def_found_error::NoClassDefFoundError, no_such_field_error::NoSuchFieldError, no_such_method_error::NoSuchMethodError,
47+
null_pointer_exception::NullPointerException, number_format_exception::NumberFormatException, object::Object, runnable::Runnable,
48+
runtime::Runtime, runtime_exception::RuntimeException, security_exception::SecurityException, string::String, string_buffer::StringBuffer,
4949
string_index_out_of_bounds_exception::StringIndexOutOfBoundsException, system::System, thread::Thread, throwable::Throwable,
5050
unsupported_operation_exception::UnsupportedOperationException,
5151
};

java_runtime/src/classes/java/lang/integer.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ impl Integer {
7878

7979
match s.parse() {
8080
Ok(x) => Ok(x),
81-
Err(_) => Err(jvm.exception("java/lang/NumberFormatException", &format!("For input string: \"{s}\"")).await),
81+
Err(_) => Err(jvm
82+
.exception("java/lang/NumberFormatException", &format!("For input string: \"{s}\""))
83+
.await),
8284
}
8385
}
8486

java_runtime/src/classes/java/lang/number_format_exception.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ impl NumberFormatException {
2626
async fn init(jvm: &Jvm, _: &mut RuntimeContext, this: ClassInstanceRef<Self>) -> Result<()> {
2727
tracing::debug!("java.lang.NumberFormatException::<init>({:?})", &this);
2828

29-
let _: () = jvm.invoke_special(&this, "java/lang/IllegalArgumentException", "<init>", "()V", ()).await?;
29+
let _: () = jvm
30+
.invoke_special(&this, "java/lang/IllegalArgumentException", "<init>", "()V", ())
31+
.await?;
3032

3133
Ok(())
3234
}

java_runtime/src/classes/java/lang/string_index_out_of_bounds_exception.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ impl StringIndexOutOfBoundsException {
2626
async fn init(jvm: &Jvm, _: &mut RuntimeContext, this: ClassInstanceRef<Self>) -> Result<()> {
2727
tracing::debug!("java.lang.StringIndexOutOfBoundsException::<init>({:?})", &this);
2828

29-
let _: () = jvm.invoke_special(&this, "java/lang/IndexOutOfBoundsException", "<init>", "()V", ()).await?;
29+
let _: () = jvm
30+
.invoke_special(&this, "java/lang/IndexOutOfBoundsException", "<init>", "()V", ())
31+
.await?;
3032

3133
Ok(())
3234
}
@@ -35,7 +37,13 @@ impl StringIndexOutOfBoundsException {
3537
tracing::debug!("java.lang.StringIndexOutOfBoundsException::<init>({:?}, {:?})", &this, &message);
3638

3739
let _: () = jvm
38-
.invoke_special(&this, "java/lang/IndexOutOfBoundsException", "<init>", "(Ljava/lang/String;)V", (message,))
40+
.invoke_special(
41+
&this,
42+
"java/lang/IndexOutOfBoundsException",
43+
"<init>",
44+
"(Ljava/lang/String;)V",
45+
(message,),
46+
)
3947
.await?;
4048

4149
Ok(())

java_runtime/src/classes/java/util.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ mod vector;
2525
pub use self::{
2626
abstract_collection::AbstractCollection, abstract_list::AbstractList, calendar::Calendar, date::Date, dictionary::Dictionary,
2727
empty_stack_exception::EmptyStackException, enumeration::Enumeration, gregorian_calendar::GregorianCalendar, hashtable::Hashtable,
28-
hashtable_entry::HashtableEntry, no_such_element_exception::NoSuchElementException, properties::Properties, random::Random, simple_time_zone::SimpleTimeZone, stack::Stack, time_zone::TimeZone,
29-
timer::Timer, timer_task::TimerTask, timer_thread::TimerThread, vector::Vector,
28+
hashtable_entry::HashtableEntry, no_such_element_exception::NoSuchElementException, properties::Properties, random::Random,
29+
simple_time_zone::SimpleTimeZone, stack::Stack, time_zone::TimeZone, timer::Timer, timer_task::TimerTask, timer_thread::TimerThread,
30+
vector::Vector,
3031
};

java_runtime/tests/classes/java/lang/test_integer.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ async fn test_parse_int_invalid() -> Result<()> {
2121
let jvm = test_jvm().await?;
2222

2323
let string = JavaLangString::from_rust_string(&jvm, "abc").await?;
24-
let result: Result<i32> = jvm.invoke_static("java/lang/Integer", "parseInt", "(Ljava/lang/String;)I", (string,)).await;
24+
let result: Result<i32> = jvm
25+
.invoke_static("java/lang/Integer", "parseInt", "(Ljava/lang/String;)I", (string,))
26+
.await;
2527

2628
let Err(JavaError::JavaException(exception)) = result else {
2729
panic!("Expected JavaException, got {:?}", result);

java_runtime/tests/classes/java/util/test_vector.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,13 @@ async fn test_index_of_null() -> Result<()> {
207207

208208
let element = JavaLangString::from_rust_string(&jvm, "testValue").await?;
209209
let _: bool = jvm.invoke_virtual(&vector, "add", "(Ljava/lang/Object;)Z", (element,)).await?;
210-
let _: bool = jvm.invoke_virtual(&vector, "add", "(Ljava/lang/Object;)Z", (JavaValue::Object(None),)).await?;
210+
let _: bool = jvm
211+
.invoke_virtual(&vector, "add", "(Ljava/lang/Object;)Z", (JavaValue::Object(None),))
212+
.await?;
211213

212-
let index: i32 = jvm.invoke_virtual(&vector, "indexOf", "(Ljava/lang/Object;)I", (JavaValue::Object(None),)).await?;
214+
let index: i32 = jvm
215+
.invoke_virtual(&vector, "indexOf", "(Ljava/lang/Object;)I", (JavaValue::Object(None),))
216+
.await?;
213217
assert_eq!(index, 1);
214218

215219
Ok(())

0 commit comments

Comments
 (0)