From e0f0fd2c4d2a8a0df560ae4fd5501cb0180bce7a Mon Sep 17 00:00:00 2001 From: Simon Krajewski Date: Thu, 21 Nov 2024 07:26:51 +0100 Subject: [PATCH] Revert "remove java.lang.String hacks" This reverts commit 109a1167a69a528bf083266f5301e6fa620ff121. --- src/codegen/javaModern.ml | 24 ++++++++++++++---------- src/compiler/args.ml | 2 +- std/java/lang/Boolean.hx | 2 -- std/java/lang/Byte.hx | 2 -- std/java/lang/Character.hx | 2 -- std/java/lang/Double.hx | 2 -- std/java/lang/Float.hx | 2 -- std/java/lang/Integer.hx | 2 -- std/java/lang/Long.hx | 2 -- std/java/lang/Short.hx | 2 -- 10 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/codegen/javaModern.ml b/src/codegen/javaModern.ml index 69854636ce4..2a56cefa378 100644 --- a/src/codegen/javaModern.ml +++ b/src/codegen/javaModern.ml @@ -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 @@ -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 diff --git a/src/compiler/args.ml b/src/compiler/args.ml index 73452acf2a5..fcd72ecb143 100644 --- a/src/compiler/args.ml +++ b/src/compiler/args.ml @@ -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; diff --git a/std/java/lang/Boolean.hx b/std/java/lang/Boolean.hx index ba3284a6170..58d9d7a30cc 100644 --- a/std/java/lang/Boolean.hx +++ b/std/java/lang/Boolean.hx @@ -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 diff --git a/std/java/lang/Byte.hx b/std/java/lang/Byte.hx index 443d60ce003..1f5f7803879 100644 --- a/std/java/lang/Byte.hx +++ b/std/java/lang/Byte.hx @@ -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 diff --git a/std/java/lang/Character.hx b/std/java/lang/Character.hx index 922647012a3..a4233ea6660 100644 --- a/std/java/lang/Character.hx +++ b/std/java/lang/Character.hx @@ -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 diff --git a/std/java/lang/Double.hx b/std/java/lang/Double.hx index 14155e47285..140c9150a35 100644 --- a/std/java/lang/Double.hx +++ b/std/java/lang/Double.hx @@ -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 diff --git a/std/java/lang/Float.hx b/std/java/lang/Float.hx index 9c173b3ec6b..0b50d8dd628 100644 --- a/std/java/lang/Float.hx +++ b/std/java/lang/Float.hx @@ -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 diff --git a/std/java/lang/Integer.hx b/std/java/lang/Integer.hx index dcf3371967a..c066bf57683 100644 --- a/std/java/lang/Integer.hx +++ b/std/java/lang/Integer.hx @@ -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 diff --git a/std/java/lang/Long.hx b/std/java/lang/Long.hx index bc015461586..893b0c26298 100644 --- a/std/java/lang/Long.hx +++ b/std/java/lang/Long.hx @@ -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 diff --git a/std/java/lang/Short.hx b/std/java/lang/Short.hx index e3f1902d2fa..c40f3f31fdc 100644 --- a/std/java/lang/Short.hx +++ b/std/java/lang/Short.hx @@ -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