11use alloc:: { vec, vec:: Vec } ;
22
3- use chrono:: { DateTime , Datelike , FixedOffset , TimeZone , Timelike } ;
3+ use chrono:: { DateTime , Datelike , FixedOffset , TimeZone as ChronoTimeZone , Timelike } ;
44
55use java_class_proto:: JavaMethodProto ;
66use jvm:: { ClassInstanceRef , Jvm , Result } ;
77
8- use crate :: { RuntimeClassProto , RuntimeContext } ;
8+ use crate :: { RuntimeClassProto , RuntimeContext , classes :: java :: util :: TimeZone } ;
99
1010// class java.util.GregorianCalendar
1111pub struct GregorianCalendar ;
@@ -18,6 +18,7 @@ impl GregorianCalendar {
1818 interfaces : vec ! [ ] ,
1919 methods : vec ! [
2020 JavaMethodProto :: new( "<init>" , "()V" , Self :: init, Default :: default ( ) ) ,
21+ JavaMethodProto :: new( "<init>" , "(Ljava/util/TimeZone;)V" , Self :: init_with_time_zone, Default :: default ( ) ) ,
2122 JavaMethodProto :: new( "computeTime" , "()V" , Self :: compute_time, Default :: default ( ) ) ,
2223 JavaMethodProto :: new( "computeFields" , "()V" , Self :: compute_fields, Default :: default ( ) ) ,
2324 ] ,
@@ -26,7 +27,20 @@ impl GregorianCalendar {
2627 }
2728
2829 async fn init ( jvm : & Jvm , _: & mut RuntimeContext , this : ClassInstanceRef < Self > ) -> Result < ( ) > {
29- tracing:: debug!( "java.util.GregorianCalendar::<init>({:?})" , & this) ;
30+ tracing:: debug!( "java.util.GregorianCalendar::<init>({this:?})" ) ;
31+
32+ let _: ( ) = jvm. invoke_special ( & this, "java/util/Calendar" , "<init>" , "()V" , ( ) ) . await ?;
33+
34+ Ok ( ( ) )
35+ }
36+
37+ async fn init_with_time_zone (
38+ jvm : & Jvm ,
39+ _: & mut RuntimeContext ,
40+ this : ClassInstanceRef < Self > ,
41+ time_zone : ClassInstanceRef < TimeZone > ,
42+ ) -> Result < ( ) > {
43+ tracing:: debug!( "java.util.GregorianCalendar::<init>({this:?}, {time_zone:?})" ) ;
3044
3145 let _: ( ) = jvm. invoke_special ( & this, "java/util/Calendar" , "<init>" , "()V" , ( ) ) . await ?;
3246
0 commit comments