Showing the changes to java (2 of 2 files). Show all
Unified · Split
| @@ -29,6 +29,25 @@ GetVersion() : int · 28 unmodified lines | |||
| 29 | return( JNI_VER ); | 29 | return( JNI_VER ); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | InternalFindClass( name : string ) : ClassData | ||
| 33 | { | ||
| 34 | # return class data adt used by the Java Loader | ||
| 35 | # which stores all the class information. | ||
| 36 | # WARNING: does not loads the class. Only use | ||
| 37 | # when you know what you are doing | ||
| 38 | # WARNING: arrays are not supported. | ||
| 39 | |||
| 40 | # replace all ocurrences of "." with "/" in name | ||
| 41 | newname : string; | ||
| 42 | for(x:=0;x<len name; x++) | ||
| 43 | { | ||
| 44 | if (name[x]=='.') | ||
| 45 | newname[x] = '/'; | ||
| 46 | else | ||
| 47 | newname[x] = name[x]; | ||
| 48 | } | ||
| 49 | return jldr->getclass(newname); | ||
| 50 | } | ||
| 32 | 51 | ||
| 33 | FindClass( name : string ) : ClassData | 52 | FindClass( name : string ) : ClassData |
| 34 | { | 53 | { |
| @@ -712,7 +731,10 @@ NewClassObject( targ_class : ClassData ) : JClass · 677 unmodified lines | |||
| 712 | { | 731 | { |
| 713 | # create an instance of java.lang.Class | 732 | # create an instance of java.lang.Class |
| 714 | cl_data := classclass(); | 733 | cl_data := classclass(); |
| 715 | return( JClass(classclass().moddata, targ_class, nil) ); | 734 | object := cast->ToJClass(NewObject(cl_data)); |
| 735 | object.class = targ_class; | ||
| 736 | |||
| 737 | return( object ); | ||
| 716 | } | 738 | } |
| 717 | 739 | ||
| 718 | 740 | ||
| @@ -944,6 +966,7 @@ MainThreadGroup() : JObject · 225 unmodified lines | |||
| 944 | 966 | ||
| 945 | FatalError( msg : string ) | 967 | FatalError( msg : string ) |
| 946 | { | 968 | { |
| 969 | sys->print("Fatal error: %s\n", msg); | ||
| 947 | ThrowException( "java/lang/InternalError", msg ); | 970 | ThrowException( "java/lang/InternalError", msg ); |
| 948 | } | 971 | } |
| 949 | 972 | ||
| @@ -345,6 +345,12 @@ JNI : module · 344 unmodified lines | |||
| 345 | # | 345 | # |
| 346 | FindClass : fn( name : string ) : ClassData; | 346 | FindClass : fn( name : string ) : ClassData; |
| 347 | 347 | ||
| 348 | # | ||
| 349 | # Find the class data for a given class name. | ||
| 350 | # Will NOT load the class if necessary. | ||
| 351 | # | ||
| 352 | InternalFindClass : fn( name : string ) : ClassData; | ||
| 353 | |||
| 348 | # | 354 | # |
| 349 | # Return the class's superclass data. | 355 | # Return the class's superclass data. |
| 350 | # | 356 | # |