Browse Source

added Lib.print and Lib.println (fixed #5593) (#5594)

* added Lib.print and Lib.println (fixed #5593)

* inline function and replace untyped

* remove untyped java
Matthijs Kamstra 8 năm trước cách đây
mục cha
commit
0417738353
2 tập tin đã thay đổi với 15 bổ sung1 xóa
  1. 1 1
      std/haxe/Log.hx
  2. 14 0
      std/java/Lib.hx

+ 1 - 1
std/haxe/Log.hx

@@ -96,7 +96,7 @@ class Log {
 			#if cs
 			#if cs
 			cs.system.Console.WriteLine(str);
 			cs.system.Console.WriteLine(str);
 			#elseif java
 			#elseif java
-			untyped __java__("java.lang.System.out.println(str)");
+			Sys.println(str);
 			#elseif lua
 			#elseif lua
 			if (str == null) str = "null";
 			if (str == null) str = "null";
 			untyped __define_feature__("use._hx_print",_hx_print(str));
 			untyped __define_feature__("use._hx_print",_hx_print(str));

+ 14 - 0
std/java/Lib.hx

@@ -29,6 +29,20 @@ package java;
 @:native('haxe.java.Lib') class Lib
 @:native('haxe.java.Lib') class Lib
 {
 {
 
 
+	/**
+		Print the specified value on the default output.
+	**/
+	inline public static function print( v : Dynamic ) : Void {
+		Sys.print(v);
+	}
+
+	/**
+		Print the specified value on the default output followed by a newline character.
+	**/
+	inline public static function println( v : Dynamic ) : Void {
+		Sys.println(v);
+	}
+
 	/**
 	/**
 		Returns a native array from the supplied Array. This native array is unsafe to be written on,
 		Returns a native array from the supplied Array. This native array is unsafe to be written on,
 		as it may or may not be linked to the actual Array implementation.
 		as it may or may not be linked to the actual Array implementation.