Skip to content

Commit

Permalink
Revert "remove java.lang.String hacks"
Browse files Browse the repository at this point in the history
This reverts commit 109a116.
  • Loading branch information
Simn committed Nov 21, 2024
1 parent 38b35f7 commit e0f0fd2
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 27 deletions.
24 changes: 14 additions & 10 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 (["std"], "String") [] p
| TObject ( (["java";"lang"], "String"), [] ) -> mk_type_path ([], "String") [] p
| TObject ( (["java";"lang"], "Enum"), [_] ) -> mk_type_path ([], "EnumValue") [] p
| TObject ( path, [] ) ->
mk_type_path path [] p
Expand Down Expand Up @@ -1076,16 +1076,20 @@ class java_library_modern com name file_path = object(self)

method build path (p : pos) : Ast.package option =
let build path =
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 ->
if path = (["java";"lang"],"String") then
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 -> actx.classes <- path :: actx.classes) lib#list_modules
List.iter (fun path -> if path <> (["java";"lang"],"String") then 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: 0 additions & 2 deletions std/java/lang/Boolean.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

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: 0 additions & 2 deletions std/java/lang/Byte.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

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: 0 additions & 2 deletions std/java/lang/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

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: 0 additions & 2 deletions std/java/lang/Double.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

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: 0 additions & 2 deletions std/java/lang/Float.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

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: 0 additions & 2 deletions std/java/lang/Integer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

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: 0 additions & 2 deletions std/java/lang/Long.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

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: 0 additions & 2 deletions std/java/lang/Short.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

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 e0f0fd2

Please sign in to comment.