Skip to content

Commit

Permalink
remove java.lang.String hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Nov 20, 2024
1 parent f79e0d7 commit 109a116
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 15 deletions.
24 changes: 10 additions & 14 deletions src/codegen/javaModern.ml
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ module SignatureConverter = struct
| TBool -> mk_type_path ([], "Bool") [] p
| TObject ( (["haxe";"root"], name), args ) -> mk_type_path ([], name) (List.map (convert_arg ctx p) args) p
| TObject ( (["java";"lang"], "Object"), [] ) -> mk_type_path ([], "Dynamic") [] p
| TObject ( (["java";"lang"], "String"), [] ) -> mk_type_path ([], "String") [] p
| TObject ( (["java";"lang"], "String"), [] ) -> mk_type_path (["std"], "String") [] p
| TObject ( (["java";"lang"], "Enum"), [_] ) -> mk_type_path ([], "EnumValue") [] p
| TObject ( path, [] ) ->
mk_type_path path [] p
Expand Down Expand Up @@ -1076,20 +1076,16 @@ class java_library_modern com name file_path = object(self)

method build path (p : pos) : Ast.package option =
let build path =
if path = (["java";"lang"],"String") then
try
let entries = Hashtbl.find_all modules path in
if entries = [] then raise Not_found;
let zip = Lazy.force zip in
let jcs = List.map (self#read zip) entries in
Std.finally (Timer.timer ["jar";"convert"]) (fun () ->
Some (Converter.convert_module (fst path) jcs)
) ();
with Not_found ->
None
else begin
try
let entries = Hashtbl.find_all modules path in
if entries = [] then raise Not_found;
let zip = Lazy.force zip in
let jcs = List.map (self#read zip) entries in
Std.finally (Timer.timer ["jar";"convert"]) (fun () ->
Some (Converter.convert_module (fst path) jcs)
) ();
with Not_found ->
None
end
in
build path

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/args.ml
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ let parse_args com =
actx.pre_compilation <- (fun() ->
let process_lib lib =
if not (lib#has_flag NativeLibraries.FlagIsStd) then
List.iter (fun path -> if path <> (["java";"lang"],"String") then actx.classes <- path :: actx.classes) lib#list_modules
List.iter (fun path -> actx.classes <- path :: actx.classes) lib#list_modules
in
List.iter process_lib com.native_libs.swf_libs;
List.iter process_lib com.native_libs.java_libs;
Expand Down
2 changes: 2 additions & 0 deletions std/java/lang/Boolean.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package java.lang;

private typedef String = std.String; // TODO: #11830

@:native("") // make sure the generator won't see this
@:transitive
@:forwardStatics
Expand Down
2 changes: 2 additions & 0 deletions std/java/lang/Byte.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package java.lang;

private typedef String = std.String; // TODO: #11830

@:native("") // make sure the generator won't see this
@:transitive
@:forwardStatics
Expand Down
2 changes: 2 additions & 0 deletions std/java/lang/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package java.lang;

private typedef String = std.String; // TODO: #11830

@:native("") // make sure the generator won't see this
@:transitive
@:forwardStatics
Expand Down
2 changes: 2 additions & 0 deletions std/java/lang/Double.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package java.lang;

private typedef String = std.String; // TODO: #11830

@:native("") // make sure the generator won't see this
@:transitive
@:forwardStatics
Expand Down
2 changes: 2 additions & 0 deletions std/java/lang/Float.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package java.lang;

private typedef String = std.String; // TODO: #11830

@:native("") // make sure the generator won't see this
@:transitive
@:forwardStatics
Expand Down
2 changes: 2 additions & 0 deletions std/java/lang/Integer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package java.lang;

private typedef String = std.String; // TODO: #11830

@:native("") // make sure the generator won't see this
@:transitive
@:forwardStatics
Expand Down
2 changes: 2 additions & 0 deletions std/java/lang/Long.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package java.lang;

private typedef String = std.String; // TODO: #11830

@:native("") // make sure the generator won't see this
@:transitive
@:forwardStatics
Expand Down
2 changes: 2 additions & 0 deletions std/java/lang/Short.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package java.lang;

private typedef String = std.String; // TODO: #11830

@:native("") // make sure the generator won't see this
@:transitive
@:forwardStatics
Expand Down

0 comments on commit 109a116

Please sign in to comment.