forked from LeenkxTeam/LNXSDK
		
	Update Files
This commit is contained in:
		
							
								
								
									
										65
									
								
								Kha/Tools/linux_x64/std/jvm/Closure.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								Kha/Tools/linux_x64/std/jvm/Closure.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,65 @@ | ||||
| package jvm; | ||||
|  | ||||
| import java.NativeArray; | ||||
| import java.lang.reflect.Method; | ||||
|  | ||||
| @:native("haxe.jvm.Closure") | ||||
| @:nativeGen | ||||
| @:keep | ||||
| class Closure extends ClosureDispatch { | ||||
| 	public var context:Dynamic; | ||||
| 	public var method:Method; | ||||
|  | ||||
| 	var isStatic:Bool; | ||||
| 	var params:NativeArray<java.lang.Class<Dynamic>>; | ||||
|  | ||||
| 	public function new(context:Null<Dynamic>, method:Method) { | ||||
| 		super(); | ||||
| 		this.context = context; | ||||
| 		this.method = method; | ||||
| 		isStatic = method.getModifiers() & java.lang.reflect.Modifier.STATIC != 0; | ||||
| 		params = method.getParameterTypes(); | ||||
| 	} | ||||
|  | ||||
| 	public function bindTo(context:Dynamic) { | ||||
| 		return new Closure(context, method); | ||||
| 	} | ||||
|  | ||||
| 	override public function equals(other:java.lang.Object) { | ||||
| 		if (!Jvm.instanceof(other, Closure)) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		var other:Closure = cast other; | ||||
| 		return context == other.context && method == other.method; | ||||
| 	} | ||||
|  | ||||
| 	public override function invokeDynamic(args:NativeArray<Dynamic>):Dynamic { | ||||
| 		if (isStatic && context != null) { | ||||
| 			var newArgs = new NativeArray(args.length + 1); | ||||
| 			haxe.ds.Vector.blit(cast args, 0, cast newArgs, 1, args.length); | ||||
| 			newArgs[0] = context; | ||||
| 			args = newArgs; | ||||
| 		} | ||||
| 		var args = switch (jvm.Jvm.unifyCallArguments(args, params, true)) { | ||||
| 			case Some(args): | ||||
| 				args; | ||||
| 			case None: | ||||
| 				args; | ||||
| 		}; | ||||
| 		try { | ||||
| 			return method.invoke(context, args); | ||||
| 		} catch (e:java.lang.reflect.InvocationTargetException) { | ||||
| 			throw e.getCause(); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @:native("haxe.jvm.ClosureDispatch") | ||||
| extern class ClosureDispatch extends Function {} | ||||
|  | ||||
| @:native("haxe.jvm.VarArgs") | ||||
| extern class VarArgs extends Function { | ||||
| 	var func:Function; | ||||
|  | ||||
| 	public function new(func:Function):Void; | ||||
| } | ||||
							
								
								
									
										32
									
								
								Kha/Tools/linux_x64/std/jvm/CompiledPattern.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								Kha/Tools/linux_x64/std/jvm/CompiledPattern.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2020 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| package jvm; | ||||
|  | ||||
| import java.util.regex.Pattern; | ||||
|  | ||||
| @:structInit | ||||
| @:native("haxe.jvm.CompiledPattern") | ||||
| class CompiledPattern { | ||||
| 	public final pattern:Pattern; | ||||
| 	public final isGlobal:Bool; | ||||
| } | ||||
							
								
								
									
										93
									
								
								Kha/Tools/linux_x64/std/jvm/DynamicObject.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								Kha/Tools/linux_x64/std/jvm/DynamicObject.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,93 @@ | ||||
| package jvm; | ||||
|  | ||||
| import haxe.ds.StringMap; | ||||
|  | ||||
| @:keep | ||||
| @:native('haxe.jvm.DynamicObject') | ||||
| @:nativeGen | ||||
| class DynamicObject implements java.lang.Cloneable extends Object { | ||||
| 	@:private static var __hx_toString_depth = 0; | ||||
|  | ||||
| 	@:private var _hx_fields:Null<StringMap<Dynamic>>; | ||||
|  | ||||
| 	@:jvm.synthetic public var _hx_deletedAField:Null<Bool>; | ||||
|  | ||||
| 	public function toString() { | ||||
| 		if (__hx_toString_depth >= 5) { | ||||
| 			return "..."; | ||||
| 		} | ||||
| 		++__hx_toString_depth; | ||||
| 		_hx_initReflection(); | ||||
| 		if (_hx_hasField("toString")) { | ||||
| 			--__hx_toString_depth; | ||||
| 			return _hx_getField("toString")(); | ||||
| 		} | ||||
| 		var buf = new StringBuf(); | ||||
| 		buf.addChar("{".code); | ||||
| 		var first = true; | ||||
| 		try { | ||||
| 			for (key in _hx_fields.keys()) { | ||||
| 				if (first) | ||||
| 					first = false | ||||
| 				else | ||||
| 					buf.add(", "); | ||||
| 				buf.add(key); | ||||
| 				buf.add(": "); | ||||
| 				buf.add(_hx_fields.get(key)); | ||||
| 			} | ||||
| 		} catch (e:Dynamic) { | ||||
| 			--__hx_toString_depth; | ||||
| 			throw(e); | ||||
| 		} | ||||
| 		--__hx_toString_depth; | ||||
| 		buf.addChar("}".code); | ||||
| 		return buf.toString(); | ||||
| 	} | ||||
|  | ||||
| 	@:jvm.synthetic final public function _hx_deleteField(name:String) { | ||||
| 		_hx_initReflection(); | ||||
| 		_hx_deletedAField = true; | ||||
| 		try { | ||||
| 			Jvm.writeFieldNoObject(this, name, null); | ||||
| 		} catch (_:Dynamic) {} | ||||
| 		return _hx_fields.remove(name); | ||||
| 	} | ||||
|  | ||||
| 	@:jvm.synthetic final public function _hx_getFields() { | ||||
| 		_hx_initReflection(); | ||||
| 		return [for (key in _hx_fields.keys()) key]; | ||||
| 	} | ||||
|  | ||||
| 	@:jvm.synthetic override public function _hx_getField<T>(name:String) { | ||||
| 		_hx_initReflection(); | ||||
| 		return _hx_fields.get(name); | ||||
| 	} | ||||
|  | ||||
| 	@:jvm.synthetic final public function _hx_hasField(name:String) { | ||||
| 		_hx_initReflection(); | ||||
| 		return _hx_fields.exists(name); | ||||
| 	} | ||||
|  | ||||
| 	@:jvm.synthetic override public function _hx_setField(name:String, value:Dynamic) { | ||||
| 		_hx_initReflection(); | ||||
| 		_hx_fields.set(name, value); | ||||
| 	} | ||||
|  | ||||
| 	@:jvm.synthetic final public function _hx_clone() { | ||||
| 		var clone:DynamicObject = (cast this : java.lang.Object).clone(); | ||||
| 		if (_hx_fields != null) { | ||||
| 			clone._hx_fields = this._hx_fields.copy(); | ||||
| 		} | ||||
| 		return clone; | ||||
| 	} | ||||
|  | ||||
| 	@:jvm.synthetic final function _hx_initReflection() { | ||||
| 		if (_hx_fields == null) { | ||||
| 			_hx_fields = _hx_getKnownFields(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	@:jvm.synthetic function _hx_getKnownFields():StringMap<Dynamic> { | ||||
| 		return new StringMap(); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										27
									
								
								Kha/Tools/linux_x64/std/jvm/EmptyConstructor.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								Kha/Tools/linux_x64/std/jvm/EmptyConstructor.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| package jvm; | ||||
|  | ||||
| @:keep | ||||
| @:native('haxe.jvm.EmptyConstructor') | ||||
| class EmptyConstructor {} | ||||
							
								
								
									
										51
									
								
								Kha/Tools/linux_x64/std/jvm/Enum.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								Kha/Tools/linux_x64/std/jvm/Enum.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,51 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| package jvm; | ||||
|  | ||||
| import java.NativeArray; | ||||
|  | ||||
| @:keep | ||||
| @:native('haxe.jvm.Enum') | ||||
| class Enum<T:EnumValue> extends java.lang.Enum<T> { | ||||
| 	@:nativeGen public function new(index:Int, name:String) { | ||||
| 		super(name, index); | ||||
| 	} | ||||
|  | ||||
| 	@:overload public function equals<T:EnumValue>(other:Enum<T>) { | ||||
| 		return super.equals(other); | ||||
| 	} | ||||
|  | ||||
| 	@:jvm.synthetic public function _hx_getParameters() { | ||||
| 		return new java.NativeArray(0); | ||||
| 	} | ||||
|  | ||||
| 	@:overload | ||||
| 	override public function toString() { | ||||
| 		var baseName = Type.getEnumConstructs(Type.getEnum(cast this))[ordinal()]; | ||||
| 		var parameters = Type.enumParameters(cast this); | ||||
| 		if (parameters.length == 0) { | ||||
| 			return baseName; | ||||
| 		} | ||||
| 		return '$baseName(${@:privateAccess parameters.join(",")})'; | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										13
									
								
								Kha/Tools/linux_x64/std/jvm/Function.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Kha/Tools/linux_x64/std/jvm/Function.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| package jvm; | ||||
|  | ||||
| import java.NativeArray; | ||||
|  | ||||
| @:native("haxe.jvm.Function") | ||||
| @:nativeGen | ||||
| extern class Function implements java.lang.Runnable { | ||||
| 	function new():Void; | ||||
| 	function invokeDynamic(args:NativeArray<Dynamic>):Dynamic; | ||||
| 	function equals(other:java.lang.Object):Bool; | ||||
| 	function invoke(arg1:java.lang.Object):java.lang.Object; | ||||
| 	function run():Void; | ||||
| } | ||||
							
								
								
									
										617
									
								
								Kha/Tools/linux_x64/std/jvm/Jvm.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										617
									
								
								Kha/Tools/linux_x64/std/jvm/Jvm.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,617 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| package jvm; | ||||
|  | ||||
| import Enum; | ||||
| import haxe.Constraints; | ||||
| import haxe.ds.Option; | ||||
| import haxe.ds.Vector; | ||||
| import haxe.extern.Rest; | ||||
| import java.Init; | ||||
| import java.NativeArray; | ||||
| import java.lang.NullPointerException; | ||||
| import jvm.DynamicObject; | ||||
| import jvm.EmptyConstructor; | ||||
| import jvm.Object; | ||||
| import jvm.annotation.ClassReflectionInformation; | ||||
| import jvm.annotation.EnumReflectionInformation; | ||||
| import jvm.annotation.EnumValueReflectionInformation; | ||||
|  | ||||
| @:keep | ||||
| @:native('haxe.jvm.Jvm') | ||||
| class Jvm { | ||||
| 	extern static public function instanceof<S, T>(obj:S, type:T):Bool; | ||||
|  | ||||
| 	extern static public function referenceEquals<T>(v1:T, v2:T):Bool; | ||||
|  | ||||
| 	static public function stringCompare(v1:String, v2:String):Int { | ||||
| 		if (v1 == null) { | ||||
| 			return v2 == null ? 0 : 1; | ||||
| 		} | ||||
| 		if (v2 == null) { | ||||
| 			return -1; | ||||
| 		} | ||||
| 		return (cast v1 : java.NativeString).compareTo(v2); | ||||
| 	} | ||||
|  | ||||
| 	static public function compare<T>(v1:T, v2:T):Int { | ||||
| 		return Reflect.compare(v1, v2); | ||||
| 	} | ||||
|  | ||||
| 	static public function enumEq(v1:Dynamic, v2:Dynamic) { | ||||
| 		if (!instanceof(v1, jvm.Enum)) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		if (!instanceof(v2, jvm.Enum)) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		return Type.enumEq(v1, v2); | ||||
| 	} | ||||
|  | ||||
| 	static public function maybeEnumEq(v1:Dynamic, v2:Dynamic) { | ||||
| 		if (!instanceof(v1, jvm.Enum)) { | ||||
| 			return compare(v1, v2) == 0; | ||||
| 		} | ||||
| 		if (!instanceof(v2, jvm.Enum)) { | ||||
| 			return compare(v1, v2) == 0; | ||||
| 		} | ||||
| 		return Type.enumEq(v1, v2); | ||||
| 	} | ||||
|  | ||||
| 	// calls | ||||
|  | ||||
| 	static public function getArgumentTypes(args:NativeArray<Dynamic>):NativeArray<java.lang.Class<Dynamic>> { | ||||
| 		var argTypes:NativeArray<java.lang.Class<Dynamic>> = new NativeArray(args.length); | ||||
| 		for (i in 0...args.length) { | ||||
| 			var arg = (cast args[i] : java.lang.Object); | ||||
| 			argTypes[i] = arg == null ? (cast java.lang.Object) : arg.getClass(); | ||||
| 		} | ||||
| 		return argTypes; | ||||
| 	} | ||||
|  | ||||
| 	static public function unifyCallArguments(args:NativeArray<Dynamic>, params:NativeArray<java.lang.Class<Dynamic>>, | ||||
| 			allowPadding:Bool = false):Option<NativeArray<Dynamic>> { | ||||
| 		var callArgs:NativeArray<Dynamic> = { | ||||
| 			if (args.length < params.length) { | ||||
| 				var callArgs = new NativeArray(params.length); | ||||
| 				Vector.blit(cast args, 0, cast callArgs, 0, args.length); | ||||
| 				callArgs; | ||||
| 			} else { | ||||
| 				Vector.fromData(args).copy().toData(); | ||||
| 			} | ||||
| 		} | ||||
| 		if (params.length < args.length) { | ||||
| 			return None; | ||||
| 		} | ||||
| 		for (i in 0...params.length) { | ||||
| 			var paramType = params[i]; | ||||
| 			if (i >= args.length) { | ||||
| 				if (paramType == cast Bool) { | ||||
| 					callArgs[i] = false; | ||||
| 				} else if (paramType == cast Float) { | ||||
| 					callArgs[i] = 0.0; | ||||
| 				} else if (paramType == cast Int) { | ||||
| 					callArgs[i] = 0; | ||||
| 				} else { | ||||
| 					if (!allowPadding) { | ||||
| 						return None; | ||||
| 					} | ||||
| 					callArgs[i] = null; | ||||
| 				} | ||||
| 				continue; | ||||
| 			} | ||||
| 			var argValue = args[i]; | ||||
| 			if (argValue == null) { | ||||
| 				if (paramType.isPrimitive()) { | ||||
| 					if (paramType == cast Bool) { | ||||
| 						callArgs[i] = false; | ||||
| 					} else if (paramType == cast Float) { | ||||
| 						callArgs[i] = 0.0; | ||||
| 					} else if (paramType == cast Int) { | ||||
| 						callArgs[i] = 0; | ||||
| 					} else { | ||||
| 						throw 'Unexpected basic type: $paramType'; | ||||
| 					} | ||||
| 				} else { | ||||
| 					callArgs[i] = null; | ||||
| 				} | ||||
| 				continue; | ||||
| 			}; | ||||
| 			var argType = (argValue : java.lang.Object).getClass(); | ||||
| 			var arg = getWrapperClass(paramType); | ||||
| 			if (arg.isAssignableFrom(argType)) { | ||||
| 				callArgs[i] = args[i]; | ||||
| 				continue; | ||||
| 			} | ||||
| 			if (arg == (cast java.lang.Double.DoubleClass) && argType == cast java.lang.Integer.IntegerClass) { | ||||
| 				callArgs[i] = numberToDouble(args[i]); | ||||
| 			} else { | ||||
| 				return None; | ||||
| 			} | ||||
| 		} | ||||
| 		return Some(callArgs); | ||||
| 	} | ||||
|  | ||||
| 	static public function call(func:jvm.Function, args:NativeArray<Dynamic>) { | ||||
| 		return func.invokeDynamic(args); | ||||
| 	} | ||||
|  | ||||
| 	// casts | ||||
|  | ||||
| 	static public function dynamicToByte<T>(d:T):Null<java.lang.Byte> { | ||||
| 		if (instanceof(d, java.lang.Number)) { | ||||
| 			return numberToByte(cast d); | ||||
| 		} | ||||
| 		return null; | ||||
| 	} | ||||
|  | ||||
| 	static public function dynamicToShort<T>(d:T):Null<java.lang.Short> { | ||||
| 		if (instanceof(d, java.lang.Number)) { | ||||
| 			return numberToShort(cast d); | ||||
| 		} | ||||
| 		return null; | ||||
| 	} | ||||
|  | ||||
| 	static public function dynamicToInteger<T>(d:T):Null<Int> { | ||||
| 		if (instanceof(d, java.lang.Number)) { | ||||
| 			return numberToInteger(cast d); | ||||
| 		} | ||||
| 		return null; | ||||
| 	} | ||||
|  | ||||
| 	static public function dynamicToLong<T>(d:T):Null<java.lang.Long> { | ||||
| 		if (instanceof(d, java.lang.Number)) { | ||||
| 			return numberToLong(cast d); | ||||
| 		} | ||||
| 		return null; | ||||
| 	} | ||||
|  | ||||
| 	static public function dynamicToFloat<T>(d:T):Null<java.lang.Float> { | ||||
| 		if (instanceof(d, java.lang.Number)) { | ||||
| 			return numberToFloat(cast d); | ||||
| 		} | ||||
| 		return null; | ||||
| 	} | ||||
|  | ||||
| 	static public function dynamicToDouble<T>(d:T):Null<Float> { | ||||
| 		if (instanceof(d, java.lang.Number)) { | ||||
| 			return numberToDouble(cast d); | ||||
| 		} | ||||
| 		return null; | ||||
| 	} | ||||
|  | ||||
| 	static public function numberToByte(n:java.lang.Number):Null<java.lang.Byte> { | ||||
| 		return n == null ? null : n.byteValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function numberToShort(n:java.lang.Number):Null<java.lang.Short> { | ||||
| 		return n == null ? null : n.shortValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function numberToInteger(n:java.lang.Number):Null<Int> { | ||||
| 		return n == null ? null : n.intValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function numberToLong(n:java.lang.Number):Null<java.lang.Long> { | ||||
| 		return n == null ? null : n.longValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function numberToFloat(n:java.lang.Number):Null<java.lang.Float> { | ||||
| 		return n == null ? null : n.floatValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function numberToDouble(n:java.lang.Number):Null<Float> { | ||||
| 		return n == null ? null : n.doubleValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function toByte(d:Dynamic) { | ||||
| 		return d == null ? 0 : (d : java.lang.Number).byteValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function toChar(d:Dynamic) { | ||||
| 		return d == null ? 0 : (d : java.lang.Character).charValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function toDouble(d:Dynamic) { | ||||
| 		return d == null ? 0. : (d : java.lang.Number).doubleValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function toFloat(d:Dynamic):Single { | ||||
| 		return d == null ? 0. : (d : java.lang.Number).floatValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function toInt(d:Dynamic) { | ||||
| 		return d == null ? 0 : (d : java.lang.Number).intValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function toLong(d:Dynamic) { | ||||
| 		return d == null ? 0 : (d : java.lang.Number).longValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function toShort(d:Dynamic) { | ||||
| 		return d == null ? 0 : (d : java.lang.Number).shortValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function toBoolean(d:Dynamic) { | ||||
| 		return d == null ? false : (d : java.lang.Boolean).booleanValue(); | ||||
| 	} | ||||
|  | ||||
| 	static public function getWrapperClass<S, T>(c:java.lang.Class<S>):java.lang.Class<S> { | ||||
| 		if (!c.isPrimitive()) { | ||||
| 			return c; | ||||
| 		} | ||||
| 		// TODO: other basic types | ||||
| 		return if (c == cast Int) { | ||||
| 			cast java.lang.Integer.IntegerClass; | ||||
| 		} else if (c == cast Float) { | ||||
| 			cast java.lang.Double.DoubleClass; | ||||
| 		} else if (c == cast Bool) { | ||||
| 			cast java.lang.Boolean.BooleanClass; | ||||
| 		} else { | ||||
| 			c; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// access | ||||
|  | ||||
| 	static public function arrayRead(obj:Dynamic, index:Int) { | ||||
| 		if (instanceof(obj, Array)) { | ||||
| 			return (obj : Array<Dynamic>)[index]; | ||||
| 		} | ||||
| 		throw 'Cannot array-read on $obj'; | ||||
| 	} | ||||
|  | ||||
| 	static public function arrayWrite(obj:Dynamic, index:Int, value:Dynamic):Void { | ||||
| 		if (instanceof(obj, Array)) { | ||||
| 			(obj : Array<Dynamic>)[index] = value; | ||||
| 			return; | ||||
| 		} | ||||
| 		throw 'Cannot array-write on $obj'; | ||||
| 	} | ||||
|  | ||||
| 	static public function readFieldClosure(obj:Dynamic, name:String, parameterTypes:NativeArray<java.lang.Class<Dynamic>>):Dynamic { | ||||
| 		var cl = (obj : java.lang.Object).getClass(); | ||||
| 		var method = cl.getMethod(name, parameterTypes); | ||||
| 		if (method.isBridge()) { | ||||
| 			/* This is probably not what we want... go through all methods and see if we find one that | ||||
| 				isn't a bridge. This is pretty awkward, but I can't figure out how to use the Java reflection | ||||
| 				API properly. */ | ||||
| 			for (meth in cl.getMethods()) { | ||||
| 				if (meth.getName() == name && !meth.isBridge() && method.getParameterTypes().length == parameterTypes.length) { | ||||
| 					method = meth; | ||||
| 					break; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		return new jvm.Closure(obj, method); | ||||
| 	} | ||||
|  | ||||
| 	static function readStaticField<T>(cl:java.lang.Class<T>, name:String):Dynamic { | ||||
| 		var methods = cl.getMethods(); | ||||
| 		for (m in methods) { | ||||
| 			if (m.getName() == name && !m.isSynthetic()) { | ||||
| 				return new jvm.Closure(null, m); | ||||
| 			} | ||||
| 		} | ||||
| 		try { | ||||
| 			var field = cl.getField(name); | ||||
| 			field.setAccessible(true); | ||||
| 			return field.get(null); | ||||
| 		} catch (_:java.lang.NoSuchFieldException) { | ||||
| 			return null; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	static public function readFieldNoObject(obj:Dynamic, name:String):Dynamic { | ||||
| 		var cl = (obj : java.lang.Object).getClass(); | ||||
| 		try { | ||||
| 			var field = cl.getField(name); | ||||
| 			field.setAccessible(true); | ||||
| 			return field.get(obj); | ||||
| 		} catch (_:java.lang.NoSuchFieldException) { | ||||
| 			while (cl != null) { | ||||
| 				var methods = cl.getMethods(); | ||||
| 				for (m in methods) { | ||||
| 					if (m.getName() == name && !m.isSynthetic()) { | ||||
| 						return new jvm.Closure(obj, m); | ||||
| 					} | ||||
| 				} | ||||
| 				cl = cl.getSuperclass(); | ||||
| 			} | ||||
| 			return null; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	static public function readField(obj:Dynamic, name:String):Dynamic { | ||||
| 		if (obj == null) { | ||||
| 			throw new NullPointerException(name); | ||||
| 		} | ||||
| 		if (name == null) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		if (instanceof(obj, jvm.Object)) { | ||||
| 			return (cast obj : jvm.Object)._hx_getField(name); | ||||
| 		} | ||||
| 		if (instanceof(obj, java.lang.Class)) { | ||||
| 			return readStaticField(cast obj, name); | ||||
| 		} | ||||
| 		if (instanceof(obj, java.NativeString)) { | ||||
| 			switch (name) { | ||||
| 				case "length": | ||||
| 					return (obj : String).length; | ||||
| 				case "charAt": | ||||
| 					return StringExt.charAt.bind(obj); | ||||
| 				case "charCodeAt": | ||||
| 					return StringExt.charCodeAt.bind(obj); | ||||
| 				case "indexOf": | ||||
| 					return StringExt.indexOf.bind(obj); | ||||
| 				case "iterator": | ||||
| 					return function() return new haxe.iterators.StringIterator(obj); | ||||
| 				case "keyValueIterator": | ||||
| 					return function() return new haxe.iterators.StringKeyValueIterator(obj); | ||||
| 				case "lastIndexOf": | ||||
| 					return StringExt.lastIndexOf.bind(obj); | ||||
| 				case "split": | ||||
| 					return StringExt.split.bind(obj); | ||||
| 				case "substr": | ||||
| 					return StringExt.substr.bind(obj); | ||||
| 				case "substring": | ||||
| 					return StringExt.substring.bind(obj); | ||||
| 				case "toLowerCase": | ||||
| 					return StringExt.toLowerCase.bind(obj); | ||||
| 				case "toUpperCase": | ||||
| 					return StringExt.toUpperCase.bind(obj); | ||||
| 			} | ||||
| 		} | ||||
| 		return readFieldNoObject(obj, name); | ||||
| 	} | ||||
|  | ||||
| 	static public function writeFieldNoObject<T>(obj:Dynamic, name:String, value:T) { | ||||
| 		try { | ||||
| 			var cl = (obj : java.lang.Object).getClass(); | ||||
| 			var field = cl.getField(name); | ||||
| 			field.setAccessible(true); | ||||
| 			try { | ||||
| 				field.set(obj, value); | ||||
| 			} catch (_:java.lang.IllegalArgumentException) { | ||||
| 				if (value == null) { | ||||
| 					field.setByte(obj, 0); // rely on widening | ||||
| 				} else if (field.getType() == (cast Int) && instanceof(value, java.lang.Number)) { | ||||
| 					// Can happen with ++ on Dynamic because that defaults to Float | ||||
| 					field.setInt(obj, (cast value : java.lang.Number).intValue()); | ||||
| 				} | ||||
| 			} | ||||
| 		} catch (_:java.lang.NoSuchFieldException) { | ||||
| 			return; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	static public function writeField<T>(obj:Dynamic, name:String, value:T) { | ||||
| 		if (obj == null || name == null) { | ||||
| 			return; | ||||
| 		} | ||||
| 		if (instanceof(obj, Object)) { | ||||
| 			return (obj : Object)._hx_setField(name, value); | ||||
| 		} | ||||
| 		writeFieldNoObject(obj, name, value); | ||||
| 	} | ||||
|  | ||||
| 	// string | ||||
|  | ||||
| 	static public function toString<T:java.lang.Object>(obj:T):String { | ||||
| 		if (obj == null) { | ||||
| 			return "null"; | ||||
| 		} else if (instanceof(obj, java.lang.Double.DoubleClass)) { | ||||
| 			var n:java.lang.Number = cast obj; | ||||
| 			if (n.doubleValue() == n.intValue()) { | ||||
| 				return java.lang.Integer.IntegerClass.valueOf(n.intValue()).toString(); | ||||
| 			} | ||||
| 			return obj.toString(); | ||||
| 		} else { | ||||
| 			return obj.toString(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	static public function stringConcat<A:java.lang.Object, B:java.lang.Object>(a:A, b:B):String { | ||||
| 		return (cast toString(a) : java.NativeString).concat(toString(b)); | ||||
| 	} | ||||
|  | ||||
| 	// ops | ||||
|  | ||||
| 	static public function opAdd<T1:java.lang.Object, T2:java.lang.Object>(a:T1, b:T2):Dynamic { | ||||
| 		if (instanceof(a, java.NativeString) || instanceof(b, java.NativeString)) { | ||||
| 			return stringConcat(a, b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Double.DoubleClass) || instanceof(b, java.lang.Double.DoubleClass)) { | ||||
| 			return toDouble(a) + toDouble(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Long.LongClass) || instanceof(b, java.lang.Long.LongClass)) { | ||||
| 			return toLong(a) + toLong(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass) || instanceof(b, java.lang.Integer.IntegerClass)) { | ||||
| 			return toInt(a) + toInt(b); | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opSub<T1:java.lang.Object, T2:java.lang.Object>(a:T1, b:T2):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Double.DoubleClass) || instanceof(b, java.lang.Double.DoubleClass)) { | ||||
| 			return toDouble(a) - toDouble(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Long.LongClass) || instanceof(b, java.lang.Long.LongClass)) { | ||||
| 			return toLong(a) - toLong(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass) || instanceof(b, java.lang.Integer.IntegerClass)) { | ||||
| 			return toInt(a) - toInt(b); | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opMul<T1:java.lang.Object, T2:java.lang.Object>(a:T1, b:T2):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Double.DoubleClass) || instanceof(b, java.lang.Double.DoubleClass)) { | ||||
| 			return toDouble(a) * toDouble(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Long.LongClass) || instanceof(b, java.lang.Long.LongClass)) { | ||||
| 			return toLong(a) * toLong(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass) || instanceof(b, java.lang.Integer.IntegerClass)) { | ||||
| 			return toInt(a) * toInt(b); | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opDiv<T1:java.lang.Object, T2:java.lang.Object>(a:T1, b:T2):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Double.DoubleClass) || instanceof(b, java.lang.Double.DoubleClass)) { | ||||
| 			return toDouble(a) / toDouble(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Long.LongClass) || instanceof(b, java.lang.Long.LongClass)) { | ||||
| 			return toLong(a) / toLong(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass) || instanceof(b, java.lang.Integer.IntegerClass)) { | ||||
| 			return toInt(a) / toInt(b); | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opMod<T1:java.lang.Object, T2:java.lang.Object>(a:T1, b:T2):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Double.DoubleClass) || instanceof(b, java.lang.Double.DoubleClass)) { | ||||
| 			return toDouble(a) % toDouble(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Long.LongClass) || instanceof(b, java.lang.Long.LongClass)) { | ||||
| 			return toLong(a) % toLong(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass) || instanceof(b, java.lang.Integer.IntegerClass)) { | ||||
| 			return toInt(a) % toInt(b); | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opAnd<T1:java.lang.Object, T2:java.lang.Object>(a:T1, b:T2):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Long.LongClass) || instanceof(b, java.lang.Long.LongClass)) { | ||||
| 			return toLong(a) & toLong(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass) || instanceof(b, java.lang.Integer.IntegerClass)) { | ||||
| 			return toInt(a) & toInt(b); | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opOr<T1:java.lang.Object, T2:java.lang.Object>(a:T1, b:T2):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Long.LongClass) || instanceof(b, java.lang.Long.LongClass)) { | ||||
| 			return toLong(a) | toLong(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass) || instanceof(b, java.lang.Integer.IntegerClass)) { | ||||
| 			return toInt(a) | toInt(b); | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opXor<T1:java.lang.Object, T2:java.lang.Object>(a:T1, b:T2):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Long.LongClass) || instanceof(b, java.lang.Long.LongClass)) { | ||||
| 			return toLong(a) ^ toLong(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass) || instanceof(b, java.lang.Integer.IntegerClass)) { | ||||
| 			return toInt(a) ^ toInt(b); | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opShl<T1:java.lang.Object, T2:java.lang.Object>(a:T1, b:T2):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Long.LongClass) || instanceof(b, java.lang.Long.LongClass)) { | ||||
| 			return toLong(a) << toInt(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass) || instanceof(b, java.lang.Integer.IntegerClass)) { | ||||
| 			return toInt(a) << toInt(b); | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opShr<T1:java.lang.Object, T2:java.lang.Object>(a:T1, b:T2):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Long.LongClass) || instanceof(b, java.lang.Long.LongClass)) { | ||||
| 			return toLong(a) >> toInt(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass) || instanceof(b, java.lang.Integer.IntegerClass)) { | ||||
| 			return toInt(a) >> toInt(b); | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opUshr<T1:java.lang.Object, T2:java.lang.Object>(a:T1, b:T2):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Long.LongClass) || instanceof(b, java.lang.Long.LongClass)) { | ||||
| 			return toLong(a) >>> toInt(b); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass) || instanceof(b, java.lang.Integer.IntegerClass)) { | ||||
| 			return toInt(a) >>> toInt(b); | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opIncrement<T1:java.lang.Object>(a:T1):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Double.DoubleClass)) { | ||||
| 			return toDouble(a) + 1.; | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Long.LongClass)) { | ||||
| 			return toLong(a) + 1.; | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass)) { | ||||
| 			return toInt(a) + 1; | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opDecrement<T1:java.lang.Object>(a:T1):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Double.DoubleClass)) { | ||||
| 			return toDouble(a) - 1.; | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Long.LongClass)) { | ||||
| 			return toLong(a) - 1.; | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass)) { | ||||
| 			return toInt(a) - 1; | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opNeg<T1:java.lang.Object>(a:T1):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Double.DoubleClass)) { | ||||
| 			return -toDouble(a); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Long.LongClass)) { | ||||
| 			return -toLong(a); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass)) { | ||||
| 			return -toInt(a); | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
|  | ||||
| 	static public function opNegBits<T1:java.lang.Object>(a:T1):Dynamic { | ||||
| 		if (instanceof(a, java.lang.Long.LongClass)) { | ||||
| 			return ~toLong(a); | ||||
| 		} | ||||
| 		if (instanceof(a, java.lang.Integer.IntegerClass)) { | ||||
| 			return ~toInt(a); | ||||
| 		} | ||||
| 		throw "Invalid operation"; | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										49
									
								
								Kha/Tools/linux_x64/std/jvm/NativeTools.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								Kha/Tools/linux_x64/std/jvm/NativeTools.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,49 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| package jvm; | ||||
|  | ||||
| extern class ObjectTools { | ||||
| 	static inline function object<T>(t:T):java.lang.Object { | ||||
| 		return cast t; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| extern class NativeClassTools { | ||||
| 	static inline function native<T>(c:Class<T>):java.lang.Class<T> { | ||||
| 		return cast c; | ||||
| 	} | ||||
|  | ||||
| 	static inline function haxe<T>(c:java.lang.Class<T>):Class<T> { | ||||
| 		return cast c; | ||||
| 	} | ||||
|  | ||||
| 	static inline function haxeEnum<T>(c:java.lang.Class<T>):std.Enum<T> { | ||||
| 		return cast c; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| extern class NativeEnumTools { | ||||
| 	static inline function native<T>(e:std.Enum<Dynamic>):java.lang.Class<T> { | ||||
| 		return cast e; | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										38
									
								
								Kha/Tools/linux_x64/std/jvm/Object.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Kha/Tools/linux_x64/std/jvm/Object.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,38 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| package jvm; | ||||
|  | ||||
| @:keep | ||||
| @:native('haxe.jvm.Object') | ||||
| @:nativeGen | ||||
| class Object { | ||||
| 	public function new() {} | ||||
|  | ||||
| 	@:jvm.synthetic public function _hx_getField(name:String) { | ||||
| 		return Jvm.readFieldNoObject(this, name); | ||||
| 	} | ||||
|  | ||||
| 	@:jvm.synthetic public function _hx_setField(name:String, value:Dynamic) { | ||||
| 		return Jvm.writeFieldNoObject(this, name, value); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										133
									
								
								Kha/Tools/linux_x64/std/jvm/StringExt.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								Kha/Tools/linux_x64/std/jvm/StringExt.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,133 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| package jvm; | ||||
|  | ||||
| import java.NativeString; | ||||
|  | ||||
| @:native("haxe.jvm.StringExt") | ||||
| @:keep | ||||
| class StringExt { | ||||
| 	public static function fromCharCode(code:Int):String { | ||||
| 		var a = new java.NativeArray(1); | ||||
| 		a[0] = code; | ||||
| 		return new String(a, 0, 1); | ||||
| 	} | ||||
|  | ||||
| 	public static function charAt(me:String, index:Int):String { | ||||
| 		if (index >= me.length || index < 0) | ||||
| 			return ""; | ||||
| 		else | ||||
| 			return java.lang.Character._toString((cast me : NativeString).charAt(index)); | ||||
| 	} | ||||
|  | ||||
| 	public static function charCodeAt(me:String, index:Int):Null<Int> { | ||||
| 		if (index >= me.length || index < 0) | ||||
| 			return null; | ||||
| 		else | ||||
| 			return cast((cast me : NativeString).charAt(index), Int); | ||||
| 	} | ||||
|  | ||||
| 	public static function indexOf(me:String, str:String, startIndex:Null<Int>) { | ||||
| 		return if (startIndex == null) (cast me : NativeString).indexOf(str) else (cast me : NativeString).indexOf(str, startIndex); | ||||
| 	} | ||||
|  | ||||
| 	public static function lastIndexOf(me:String, str:String, ?startIndex:Int):Int { | ||||
| 		if(str == '') { | ||||
| 			return startIndex == null || startIndex > me.length ? me.length : startIndex; | ||||
| 		} | ||||
| 		if (startIndex == null || startIndex > me.length || startIndex < 0) { | ||||
| 			startIndex = me.length - 1; | ||||
| 		} | ||||
| 		return (cast me : NativeString).lastIndexOf(str, startIndex); | ||||
| 	} | ||||
|  | ||||
| 	public static function split(me:String, delimiter:String):Array<String> { | ||||
| 		var ret = []; | ||||
| 		if (delimiter.length == 0) { | ||||
| 			for (i in 0...me.length) { | ||||
| 				ret.push(me.charAt(i)); | ||||
| 			} | ||||
| 		} else { | ||||
| 			var start = 0; | ||||
| 			var pos = me.indexOf(delimiter, start); | ||||
| 			while (pos >= 0) { | ||||
| 				ret.push((cast me : NativeString).substring(start, pos)); | ||||
| 				start = pos + delimiter.length; | ||||
| 				pos = me.indexOf(delimiter, start); | ||||
| 			} | ||||
| 			ret.push((cast me : NativeString).substring(start)); | ||||
| 		} | ||||
| 		return ret; | ||||
| 	} | ||||
|  | ||||
| 	public static function substr(me:String, pos:Int, ?len:Int):String { | ||||
| 		var len:Int = len == null ? me.length : len; | ||||
| 		if (pos != 0 && len < 0) { | ||||
| 			return ""; | ||||
| 		} | ||||
| 		if (pos < 0) { | ||||
| 			pos = me.length + pos; | ||||
| 			if (pos < 0) { | ||||
| 				pos = 0; | ||||
| 			} | ||||
| 		} else if (len < 0) { | ||||
| 			len = me.length + len - pos; | ||||
| 		} | ||||
| 		if (pos + len > me.length) { | ||||
| 			len = me.length - pos; | ||||
| 		} | ||||
| 		if (pos < 0 || len <= 0) { | ||||
| 			return ""; | ||||
| 		} | ||||
| 		return (cast me : NativeString).substring(pos, pos + len); | ||||
| 	} | ||||
|  | ||||
| 	public static function substring(me:String, startIndex:Int, ?endIndex:Int):String { | ||||
| 		var endIndex:Int = endIndex == null ? me.length : endIndex; | ||||
| 		if (endIndex < 0) { | ||||
| 			endIndex = 0; | ||||
| 		} else if (endIndex > me.length) { | ||||
| 			endIndex = me.length; | ||||
| 		} | ||||
| 		if (startIndex < 0) { | ||||
| 			startIndex = 0; | ||||
| 		} else if (startIndex > me.length) { | ||||
| 			startIndex = me.length; | ||||
| 		} | ||||
|  | ||||
| 		if (startIndex > endIndex) { | ||||
| 			var tmp = startIndex; | ||||
| 			startIndex = endIndex; | ||||
| 			endIndex = tmp; | ||||
| 		} | ||||
| 		return (cast me : NativeString).substring(startIndex, endIndex); | ||||
| 	} | ||||
|  | ||||
| 	public static function toLowerCase(me:String):String { | ||||
| 		return me.toLowerCase(); | ||||
| 	} | ||||
|  | ||||
| 	public static function toUpperCase(me:String):String { | ||||
| 		return me.toUpperCase(); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										182
									
								
								Kha/Tools/linux_x64/std/jvm/_std/EReg.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										182
									
								
								Kha/Tools/linux_x64/std/jvm/_std/EReg.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,182 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| import java.util.regex.*; | ||||
| import jvm.CompiledPattern; | ||||
|  | ||||
| using StringTools; | ||||
|  | ||||
| @:coreApi class EReg { | ||||
| 	private var matcher:Matcher; | ||||
| 	private var cur:String; | ||||
| 	private var isGlobal:Bool; | ||||
|  | ||||
| 	@:overload | ||||
| 	public function new(r:String, opt:String) { | ||||
| 		initialize(compilePattern(r, opt)); | ||||
| 	} | ||||
|  | ||||
| 	@:overload | ||||
| 	function new(compiledPattern:CompiledPattern) { | ||||
| 		initialize(compiledPattern); | ||||
| 	} | ||||
|  | ||||
| 	function initialize(compiledPattern:CompiledPattern):Void { | ||||
| 		matcher = compiledPattern.pattern.matcher(""); | ||||
| 		isGlobal = compiledPattern.isGlobal; | ||||
| 	} | ||||
|  | ||||
| 	public function match(s:String):Bool { | ||||
| 		cur = s; | ||||
| 		matcher = matcher.reset(s); | ||||
| 		return matcher.find(); | ||||
| 	} | ||||
|  | ||||
| 	public function matched(n:Int):String { | ||||
| 		if (n == 0) | ||||
| 			return matcher.group(); | ||||
| 		else | ||||
| 			return matcher.group(n); | ||||
| 	} | ||||
|  | ||||
| 	public function matchedLeft():String { | ||||
| 		return untyped cur.substring(0, matcher.start()); | ||||
| 	} | ||||
|  | ||||
| 	public function matchedRight():String { | ||||
| 		return untyped cur.substring(matcher.end(), cur.length); | ||||
| 	} | ||||
|  | ||||
| 	public function matchedPos():{pos:Int, len:Int} { | ||||
| 		var start = matcher.start(); | ||||
| 		return {pos: start, len: matcher.end() - start}; | ||||
| 	} | ||||
|  | ||||
| 	public function matchSub(s:String, pos:Int, len:Int = -1):Bool { | ||||
| 		matcher = matcher.reset(len < 0 ? s : s.substr(0, pos + len)); | ||||
| 		cur = s; | ||||
| 		return matcher.find(pos); | ||||
| 	} | ||||
|  | ||||
| 	public function split(s:String):Array<String> { | ||||
| 		if (isGlobal) { | ||||
| 			var ret = []; | ||||
| 			matcher.reset(s); | ||||
| 			matcher = matcher.useAnchoringBounds(false).useTransparentBounds(true); | ||||
| 			var copyOffset = 0; | ||||
| 			while (true) { | ||||
| 				if (!matcher.find()) { | ||||
| 					ret.push(s.substring(copyOffset, s.length)); | ||||
| 					break; | ||||
| 				} | ||||
| 				ret.push(s.substring(copyOffset, matcher.start())); | ||||
| 				var nextStart = matcher.end(); | ||||
| 				copyOffset = nextStart; | ||||
| 				if (nextStart == matcher.regionStart()) { | ||||
| 					nextStart++; // zero-length match - shift region one forward | ||||
| 				} | ||||
| 				if (nextStart >= s.length) { | ||||
| 					ret.push(""); | ||||
| 					break; | ||||
| 				} | ||||
| 				matcher.region(nextStart, s.length); | ||||
| 			} | ||||
| 			return ret; | ||||
| 		} else { | ||||
| 			var m = matcher; | ||||
| 			m.reset(s); | ||||
| 			if (m.find()) { | ||||
| 				return untyped [s.substring(0, m.start()), s.substring(m.end(), s.length)]; | ||||
| 			} else { | ||||
| 				return [s]; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	inline function start(group:Int):Int { | ||||
| 		return matcher.start(group); | ||||
| 	} | ||||
|  | ||||
| 	inline function len(group:Int):Int { | ||||
| 		return matcher.end(group) - matcher.start(group); | ||||
| 	} | ||||
|  | ||||
| 	public function replace(s:String, by:String):String { | ||||
| 		matcher.reset(s); | ||||
| 		by = by.replace("\\", "\\\\").replace("$$", "\\$"); | ||||
| 		return isGlobal ? matcher.replaceAll(by) : matcher.replaceFirst(by); | ||||
| 	} | ||||
|  | ||||
| 	public function map(s:String, f:EReg->String):String { | ||||
| 		var offset = 0; | ||||
| 		var buf = new StringBuf(); | ||||
| 		do { | ||||
| 			if (offset >= s.length) | ||||
| 				break; | ||||
| 			else if (!matchSub(s, offset)) { | ||||
| 				buf.add(s.substr(offset)); | ||||
| 				break; | ||||
| 			} | ||||
| 			var p = matchedPos(); | ||||
| 			buf.add(s.substr(offset, p.pos - offset)); | ||||
| 			buf.add(f(this)); | ||||
| 			if (p.len == 0) { | ||||
| 				buf.add(s.substr(p.pos, 1)); | ||||
| 				offset = p.pos + 1; | ||||
| 			} else | ||||
| 				offset = p.pos + p.len; | ||||
| 		} while (isGlobal); | ||||
| 		if (!isGlobal && offset > 0 && offset < s.length) | ||||
| 			buf.add(s.substr(offset)); | ||||
| 		return buf.toString(); | ||||
| 	} | ||||
|  | ||||
| 	public static inline function escape(s:String):String { | ||||
| 		return Pattern.quote(s); | ||||
| 	} | ||||
|  | ||||
| 	static function compilePattern(r:String, opt:String):CompiledPattern { | ||||
| 		var flags = 0; | ||||
| 		var isGlobal = false; | ||||
| 		for (i in 0...opt.length) { | ||||
| 			switch (StringTools.fastCodeAt(opt, i)) { | ||||
| 				case 'i'.code: | ||||
| 					flags |= Pattern.CASE_INSENSITIVE; | ||||
| 				case 'm'.code: | ||||
| 					flags |= Pattern.MULTILINE; | ||||
| 				case 's'.code: | ||||
| 					flags |= Pattern.DOTALL; | ||||
| 				case 'g'.code: | ||||
| 					isGlobal = true; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		flags |= Pattern.UNICODE_CASE; | ||||
| 		#if !android // see https://github.com/HaxeFoundation/haxe/issues/7632 | ||||
| 		flags |= Pattern.UNICODE_CHARACTER_CLASS; | ||||
| 		#end | ||||
| 		return { | ||||
| 			pattern: Pattern.compile(r, flags), | ||||
| 			isGlobal: isGlobal | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										208
									
								
								Kha/Tools/linux_x64/std/jvm/_std/Reflect.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										208
									
								
								Kha/Tools/linux_x64/std/jvm/_std/Reflect.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,208 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| import jvm.Jvm; | ||||
|  | ||||
| import java.lang.Number; | ||||
| import java.lang.Long.LongClass; | ||||
| import java.lang.Double.DoubleClass; | ||||
| import java.lang.Float.FloatClass; | ||||
| import java.math.BigDecimal; | ||||
| import java.math.BigInteger; | ||||
|  | ||||
| using jvm.NativeTools.NativeClassTools; | ||||
|  | ||||
| @:coreApi | ||||
| class Reflect { | ||||
| 	public static function hasField(o:Dynamic, field:String):Bool { | ||||
| 		if (!Jvm.instanceof(o, jvm.DynamicObject)) { | ||||
| 			var c:java.lang.Class<Dynamic> = Jvm.instanceof(o, java.lang.Class) ? cast o : (cast o : java.lang.Object).getClass(); | ||||
| 			try { | ||||
| 				c.getField(field); | ||||
| 				return true; | ||||
| 			} catch (e:Dynamic) { | ||||
| 				return false; | ||||
| 			} | ||||
| 		} | ||||
| 		return (cast o : jvm.DynamicObject)._hx_hasField(field); | ||||
| 	} | ||||
|  | ||||
| 	public static function field(o:Dynamic, field:String):Dynamic { | ||||
| 		if (o == null) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		return Jvm.readField(o, field); | ||||
| 	} | ||||
|  | ||||
| 	public static function setField(o:Dynamic, field:String, value:Dynamic):Void { | ||||
| 		Jvm.writeField(o, field, value); | ||||
| 	} | ||||
|  | ||||
| 	public static function getProperty(o:Dynamic, field:String):Dynamic { | ||||
| 		var f = Reflect.field(o, "get_" + field); | ||||
| 		if (f != null) { | ||||
| 			return f(); | ||||
| 		} | ||||
| 		return Reflect.field(o, field); | ||||
| 	} | ||||
|  | ||||
| 	public static function setProperty(o:Dynamic, field:String, value:Dynamic):Void { | ||||
| 		var f = Reflect.field(o, "set_" + field); | ||||
| 		if (f != null) { | ||||
| 			f(value); | ||||
| 			return; | ||||
| 		} | ||||
| 		Reflect.setField(o, field, value); | ||||
| 	} | ||||
|  | ||||
| 	public static function callMethod(o:Dynamic, func:haxe.Constraints.Function, args:Array<Dynamic>):Dynamic { | ||||
| 		return Jvm.call(cast func, @:privateAccess args.getNative()); | ||||
| 	} | ||||
|  | ||||
| 	public static function fields(o:Dynamic):Array<String> { | ||||
| 		if (!Jvm.instanceof(o, jvm.DynamicObject)) { | ||||
| 			if (Jvm.instanceof(o, java.lang.Class)) { | ||||
| 				return Type.getClassFields(o); | ||||
| 			} | ||||
| 			var c = (o : java.lang.Object).getClass(); | ||||
| 			var ret = []; | ||||
| 			for (f in c.getDeclaredFields()) { | ||||
| 				if (java.lang.reflect.Modifier.isStatic(f.getModifiers()) == false && !f.isSynthetic()) { | ||||
| 					ret.push(f.getName()); | ||||
| 				} | ||||
| 			} | ||||
| 			return ret; | ||||
| 		} | ||||
| 		return (cast o : jvm.DynamicObject)._hx_getFields(); | ||||
| 	} | ||||
|  | ||||
| 	public static function isFunction(f:Dynamic):Bool { | ||||
| 		return Jvm.instanceof(f, jvm.Function); | ||||
| 	} | ||||
|  | ||||
| 	public static function compare<T>(a:T, b:T):Int { | ||||
| 		if (Jvm.referenceEquals(a, b)) { | ||||
| 			return 0; | ||||
| 		} | ||||
| 		if (a == null) { | ||||
| 			return -1; | ||||
| 		} | ||||
| 		if (b == null) { | ||||
| 			return 1; | ||||
| 		} | ||||
| 		if (Jvm.instanceof(a, Number) && Jvm.instanceof(b, Number)) { | ||||
| 			var a = (cast a:Number); | ||||
| 			var b = (cast b:Number); | ||||
| 			inline function isBig(v:Number) | ||||
| 				return Jvm.instanceof(v, BigDecimal) || Jvm.instanceof(v, BigInteger); | ||||
| 			inline function cmpLongTo(long:Number, another:Number) { | ||||
| 				if(Jvm.instanceof(another, DoubleClass)) { | ||||
| 					return new BigDecimal(long.longValue()).compareTo(new BigDecimal(another.doubleValue())); | ||||
| 				} else if(Jvm.instanceof(another, FloatClass)) { | ||||
| 					return new BigDecimal(long.longValue()).compareTo(new BigDecimal(another.floatValue())); | ||||
| 				} else { | ||||
| 					return LongClass.compare(long.longValue(), another.longValue()); | ||||
| 				} | ||||
| 			} | ||||
| 			if(isBig(a) || isBig(b)) | ||||
| 				return new BigDecimal((cast a:java.lang.Object).toString()).compareTo((cast a:java.lang.Object).toString()); | ||||
| 			if(Jvm.instanceof(a, LongClass)) | ||||
| 				return cmpLongTo(a, b); | ||||
| 			if(Jvm.instanceof(b, LongClass)) | ||||
| 				return -1 * cmpLongTo(b, a); | ||||
| 			return DoubleClass.compare(a.doubleValue(), b.doubleValue()); | ||||
| 		} | ||||
| 		if (Jvm.instanceof(a, java.NativeString)) { | ||||
| 			if (!Jvm.instanceof(b, java.NativeString)) { | ||||
| 				return -1; | ||||
| 			} | ||||
| 			return (cast a : java.NativeString).compareTo(cast b); | ||||
| 		} | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	public static function compareMethods(f1:Dynamic, f2:Dynamic):Bool { | ||||
| 		if (f1 == f2) { | ||||
| 			return true; | ||||
| 		} | ||||
| 		if (f1 == null || f2 == null) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		var c1 = (f1 : java.lang.Object).getClass(); | ||||
| 		if (c1 != (f2 : java.lang.Object).getClass()) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		if (Std.isOfType(f1, jvm.Function)) { | ||||
| 			if (!Std.isOfType(f2, jvm.Function)) { | ||||
| 				return false; | ||||
| 			} | ||||
| 			return (f1 : jvm.Function).equals(f2); | ||||
| 		} | ||||
| 		return false; | ||||
| 	} | ||||
|  | ||||
| 	public static function isObject(v:Dynamic):Bool { | ||||
| 		if (v == null) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		if (Jvm.instanceof(v, jvm.Enum)) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		if (Jvm.instanceof(v, java.lang.Number)) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		if (Jvm.instanceof(v, java.lang.Boolean.BooleanClass)) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		if (Jvm.instanceof(v, jvm.Function)) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		return true; | ||||
| 	} | ||||
|  | ||||
| 	public static function isEnumValue(v:Dynamic):Bool { | ||||
| 		if (v == null) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		return @:privateAccess Type.isEnumValueClass((cast v : java.lang.Object).getClass()); | ||||
| 	} | ||||
|  | ||||
| 	public static function deleteField(o:Dynamic, field:String):Bool { | ||||
| 		if (!Jvm.instanceof(o, jvm.DynamicObject)) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		return (cast o : jvm.DynamicObject)._hx_deleteField(field); | ||||
| 	} | ||||
|  | ||||
| 	public static function copy<T>(o:Null<T>):Null<T> { | ||||
| 		if (!Jvm.instanceof(o, jvm.DynamicObject)) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		var o = (cast o : jvm.DynamicObject); | ||||
| 		return cast o._hx_clone(); | ||||
| 	} | ||||
|  | ||||
| 	@:overload(function(f:Array<Dynamic>->Void):Dynamic {}) | ||||
| 	public static function makeVarArgs(f:Array<Dynamic>->Dynamic):Dynamic { | ||||
| 		return new jvm.Closure.VarArgs((cast f : jvm.Function)); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										179
									
								
								Kha/Tools/linux_x64/std/jvm/_std/Std.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										179
									
								
								Kha/Tools/linux_x64/std/jvm/_std/Std.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,179 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| import jvm.Jvm; | ||||
|  | ||||
| @:coreApi | ||||
| class Std { | ||||
| 	@:deprecated('Std.is is deprecated. Use Std.isOfType instead.') | ||||
| 	public static inline function is(v:Dynamic, t:Dynamic):Bool { | ||||
| 		return isOfType(v, t); | ||||
| 	} | ||||
|  | ||||
| 	public static function isOfType(v:Dynamic, t:Dynamic):Bool { | ||||
| 		if (v == null || t == null) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		var clt:java.lang.Class<Dynamic> = cast t; | ||||
| 		if (clt == null) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		if (clt == cast java.lang.Object) { | ||||
| 			return true; | ||||
| 		} | ||||
| 		clt = Jvm.getWrapperClass(clt); | ||||
| 		if (clt == cast java.lang.Double.DoubleClass) { | ||||
| 			// Haxe semantics: any number is assignable to Float | ||||
| 			clt = cast java.lang.Number; | ||||
| 		} else if (clt == cast java.lang.Integer.IntegerClass) { | ||||
| 			if (!Jvm.instanceof(v, java.lang.Number)) { | ||||
| 				return false; | ||||
| 			} | ||||
| 			var n = (cast v : java.lang.Number); | ||||
| 			// Haxe semantics: 2.0 is an integer... | ||||
| 			return n.doubleValue() == n.intValue(); | ||||
| 		} | ||||
| 		return clt.isAssignableFrom((v : java.lang.Object).getClass()); | ||||
| 	} | ||||
|  | ||||
| 	public static function string(s:Dynamic):String { | ||||
| 		return jvm.Jvm.toString(s); | ||||
| 	} | ||||
|  | ||||
| 	public static function int(x:Float):Int { | ||||
| 		return cast x; | ||||
| 	} | ||||
|  | ||||
| 	public static function parseInt(x:String):Null<Int> { | ||||
| 		if (x == null) { | ||||
| 			return null; | ||||
| 		} | ||||
|  | ||||
| 		var base = 10; | ||||
| 		var len = x.length; | ||||
| 		var foundCount = 0; | ||||
| 		var sign = 0; | ||||
| 		var firstDigitIndex = 0; | ||||
| 		var lastDigitIndex = -1; | ||||
| 		var previous = 0; | ||||
|  | ||||
| 		for (i in 0...len) { | ||||
| 			var c = StringTools.fastCodeAt(x, i); | ||||
| 			switch c { | ||||
| 				case _ if ((c > 8 && c < 14) || c == 32): | ||||
| 					if (foundCount > 0) { | ||||
| 						return null; | ||||
| 					} | ||||
| 					continue; | ||||
| 				case '-'.code if (foundCount == 0): | ||||
| 					sign = -1; | ||||
| 				case '+'.code if (foundCount == 0): | ||||
| 					sign = 1; | ||||
| 				case '0'.code if (foundCount == 0 || (foundCount == 1 && sign != 0)): | ||||
| 				case 'x'.code | 'X'.code if (previous == '0'.code && ((foundCount == 1 && sign == 0) || (foundCount == 2 && sign != 0))): | ||||
| 					base = 16; | ||||
| 				case _ if ('0'.code <= c && c <= '9'.code): | ||||
| 				case _ if (base == 16 && (('a'.code <= c && c <= 'z'.code) || ('A'.code <= c && c <= 'Z'.code))): | ||||
| 				case _: | ||||
| 					break; | ||||
| 			} | ||||
| 			if ((foundCount == 0 && sign == 0) || (foundCount == 1 && sign != 0)) { | ||||
| 				firstDigitIndex = i; | ||||
| 			} | ||||
| 			foundCount++; | ||||
| 			lastDigitIndex = i; | ||||
| 			previous = c; | ||||
| 		} | ||||
| 		if (firstDigitIndex <= lastDigitIndex) { | ||||
| 			var digits = x.substring(firstDigitIndex + (base == 16 ? 2 : 0), lastDigitIndex + 1); | ||||
| 			return try { | ||||
| 				(sign == -1 ? -1 : 1) * java.lang.Integer.parseInt(digits, base); | ||||
| 			} catch (e:java.lang.NumberFormatException) { | ||||
| 				null; | ||||
| 			} | ||||
| 		} | ||||
| 		return null; | ||||
| 	} | ||||
|  | ||||
| 	public static function parseFloat(x:String):Float { | ||||
| 		if (x == null) { | ||||
| 			return Math.NaN; | ||||
| 		} | ||||
| 		x = StringTools.ltrim(x); | ||||
| 		var xn:java.NativeString = cast x; | ||||
| 		var found = false, | ||||
| 			hasDot = false, | ||||
| 			hasSign = false, | ||||
| 			hasE = false, | ||||
| 			hasESign = false, | ||||
| 			hasEData = false; | ||||
| 		var i = -1; | ||||
|  | ||||
| 		while (++i < x.length) { | ||||
| 			var chr:Int = cast xn.charAt(i); | ||||
| 			if (chr >= '0'.code && chr <= '9'.code) { | ||||
| 				if (hasE) { | ||||
| 					hasEData = true; | ||||
| 				} | ||||
| 				found = true; | ||||
| 			} else | ||||
| 				switch (chr) { | ||||
| 					case 'e'.code | 'E'.code if (!hasE): | ||||
| 						hasE = true; | ||||
| 					case '.'.code if (!hasDot): | ||||
| 						hasDot = true; | ||||
| 					case '-'.code, '+'.code if (!found && !hasSign): | ||||
| 						hasSign = true; | ||||
| 					case '-'.code | '+'.code if (found && !hasESign && hasE && !hasEData): | ||||
| 						hasESign = true; | ||||
| 					case _: | ||||
| 						break; | ||||
| 				} | ||||
| 		} | ||||
| 		if (hasE && !hasEData) { | ||||
| 			i--; | ||||
| 			if (hasESign) | ||||
| 				i--; | ||||
| 		} | ||||
|  | ||||
| 		if (i != x.length) { | ||||
| 			x = x.substr(0, i); | ||||
| 		} | ||||
| 		return try java.lang.Double.DoubleClass.parseDouble(x) catch (e:Dynamic) Math.NaN; | ||||
| 	} | ||||
|  | ||||
| 	inline public static function downcast<T:{}, S:T>(value:T, c:Class<S>):S { | ||||
| 		return Std.isOfType(value, c) ? cast value : null; | ||||
| 	} | ||||
|  | ||||
| 	@:deprecated('Std.instance() is deprecated. Use Std.downcast() instead.') | ||||
| 	inline public static function instance<T:{}, S:T>(value:T, c:Class<S>):S { | ||||
| 		return downcast(value, c); | ||||
| 	} | ||||
|  | ||||
| 	public static function random(x:Int):Int { | ||||
| 		if (x <= 0) { | ||||
| 			return 0; | ||||
| 		} | ||||
| 		return Std.int(Math.random() * x); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										76
									
								
								Kha/Tools/linux_x64/std/jvm/_std/String.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								Kha/Tools/linux_x64/std/jvm/_std/String.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,76 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
| @:coreApi | ||||
| @:native("java.lang.String") | ||||
| extern class String implements java.lang.CharSequence { | ||||
| 	var length(default, null):Int; | ||||
|  | ||||
| 	@:overload(function(b:haxe.io.BytesData, offset:Int, length:Int, charsetName:String):Void {}) | ||||
| 	@:overload(function(b:haxe.io.BytesData, offset:Int, length:Int):Void {}) | ||||
| 	@:overload(function(b:java.NativeArray<java.StdTypes.Char16>):Void {}) | ||||
| 	@:overload(function(b:java.NativeArray<Int>, offset:Int, count:Int):Void {}) | ||||
| 	function new(string:String):Void; | ||||
|  | ||||
| 	function toUpperCase():String; | ||||
| 	function toLowerCase():String; | ||||
|  | ||||
| 	@:runtime inline function charAt(index:Int):String { | ||||
| 		return jvm.StringExt.charAt(this, index); | ||||
| 	} | ||||
|  | ||||
| 	inline function charCodeAt(index:Int):Null<Int> { | ||||
| 		return jvm.StringExt.charCodeAt(this, index); | ||||
| 	} | ||||
|  | ||||
| 	inline function indexOf(str:String, ?startIndex:Int):Int { | ||||
| 		return jvm.StringExt.indexOf(this, str, startIndex); | ||||
| 	} | ||||
|  | ||||
| 	@:runtime inline function lastIndexOf(str:String, ?startIndex:Int):Int { | ||||
| 		return jvm.StringExt.lastIndexOf(this, str, startIndex); | ||||
| 	} | ||||
|  | ||||
| 	@:runtime inline function split(delimiter:String):Array<String> { | ||||
| 		return jvm.StringExt.split(this, delimiter); | ||||
| 	} | ||||
|  | ||||
| 	@:runtime inline function substr(pos:Int, ?len:Int):String { | ||||
| 		return jvm.StringExt.substr(this, pos, len); | ||||
| 	} | ||||
|  | ||||
| 	@:runtime inline function substring(startIndex:Int, ?endIndex:Int):String { | ||||
| 		return jvm.StringExt.substring(this, startIndex, endIndex); | ||||
| 	} | ||||
|  | ||||
| 	function toString():String; | ||||
|  | ||||
| 	private function compareTo(anotherString:String):Int; | ||||
|  | ||||
| 	private function codePointAt(idx:Int):Int; | ||||
|  | ||||
| 	@:overload(function():haxe.io.BytesData {}) | ||||
| 	private function getBytes(encoding:String):haxe.io.BytesData; | ||||
|  | ||||
| 	@:runtime static inline function fromCharCode(code:Int):String { | ||||
| 		return jvm.StringExt.fromCharCode(code); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										105
									
								
								Kha/Tools/linux_x64/std/jvm/_std/StringBuf.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										105
									
								
								Kha/Tools/linux_x64/std/jvm/_std/StringBuf.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,105 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
| @:coreApi | ||||
| class StringBuf { | ||||
| 	private var b:java.lang.StringBuilder; | ||||
|  | ||||
| 	public var length(get, never):Int; | ||||
|  | ||||
| 	public function new():Void { | ||||
| 		b = new java.lang.StringBuilder(); | ||||
| 	} | ||||
|  | ||||
| 	inline function get_length():Int { | ||||
| 		return b.length(); | ||||
| 	} | ||||
|  | ||||
| 	public function add<T>(x:T):Void { | ||||
| 		if (jvm.Jvm.instanceof(x, java.lang.Double.DoubleClass)) { | ||||
| 			b.append(jvm.Jvm.toString(cast x)); | ||||
| 		} else { | ||||
| 			b.append(x); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	@:overload | ||||
| 	@:native("add") | ||||
| 	@:ifFeature("StringBuf.add") | ||||
| 	function addOpt(v:Bool):Void { | ||||
| 		b.append(v); | ||||
| 	} | ||||
|  | ||||
| 	@:overload | ||||
| 	@:native("add") | ||||
| 	@:ifFeature("StringBuf.add") | ||||
| 	function addOpt(v:java.types.Char16):Void { | ||||
| 		b.append(v); | ||||
| 	} | ||||
|  | ||||
| 	@:overload | ||||
| 	@:native("add") | ||||
| 	@:ifFeature("StringBuf.add") | ||||
| 	function addOpt(v:Float):Void { | ||||
| 		b.append(v); | ||||
| 	} | ||||
|  | ||||
| 	@:overload | ||||
| 	@:native("add") | ||||
| 	@:ifFeature("StringBuf.add") | ||||
| 	function addOpt(v:Single):Void { | ||||
| 		b.append(v); | ||||
| 	} | ||||
|  | ||||
| 	@:overload | ||||
| 	@:native("add") | ||||
| 	@:ifFeature("StringBuf.add") | ||||
| 	function addOpt(v:Int):Void { | ||||
| 		b.append(v); | ||||
| 	} | ||||
|  | ||||
| 	@:overload | ||||
| 	@:native("add") | ||||
| 	@:ifFeature("StringBuf.add") | ||||
| 	function addOpt(v:haxe.Int64):Void { | ||||
| 		b.append(v); | ||||
| 	} | ||||
|  | ||||
| 	@:overload | ||||
| 	@:native("add") | ||||
| 	@:ifFeature("StringBuf.add") | ||||
| 	function addOpt(v:String):Void { | ||||
| 		b.append(v); | ||||
| 	} | ||||
|  | ||||
| 	public function addSub(s:String, pos:Int, ?len:Int):Void { | ||||
| 		var l:Int = (len == null) ? s.length - pos : len; | ||||
| 		b.append(s, pos, pos + l); | ||||
| 	} | ||||
|  | ||||
| 	public function addChar(c:Int):Void { | ||||
| 		b.appendCodePoint(c); | ||||
| 	} | ||||
|  | ||||
| 	public function toString():String { | ||||
| 		return b.toString(); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										312
									
								
								Kha/Tools/linux_x64/std/jvm/_std/Type.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										312
									
								
								Kha/Tools/linux_x64/std/jvm/_std/Type.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,312 @@ | ||||
| import java.lang.NoSuchMethodException; | ||||
| import jvm.Jvm; | ||||
| import jvm.annotation.*; | ||||
|  | ||||
| using jvm.NativeTools.NativeClassTools; | ||||
| using jvm.NativeTools.NativeEnumTools; | ||||
| using jvm.NativeTools.ObjectTools; | ||||
|  | ||||
| enum ValueType { | ||||
| 	TNull; | ||||
| 	TInt; | ||||
| 	TFloat; | ||||
| 	TBool; | ||||
| 	TObject; | ||||
| 	TFunction; | ||||
| 	TClass(c:Class<Dynamic>); | ||||
| 	TEnum(e:Enum<Dynamic>); | ||||
| 	TUnknown; | ||||
| } | ||||
|  | ||||
| @:coreApi | ||||
| class Type { | ||||
| 	static function isEnumClass<T>(c:java.lang.Class<T>):Bool { | ||||
| 		// TODO: have to be careful if we ever decide to omit EnumReflectionInformation | ||||
| 		// Maybe a separate HaxeEnum annotation would be better here | ||||
| 		return c.isAnnotationPresent(cast EnumReflectionInformation); | ||||
| 	} | ||||
|  | ||||
| 	static function isEnumValueClass<T>(c:java.lang.Class<T>):Bool { | ||||
| 		// TODO: have to be careful if we ever decide to omit EnumValueReflectionInformation | ||||
| 		// Maybe a separate HaxeEnum annotation would be better here | ||||
| 		return c.isAnnotationPresent(cast EnumValueReflectionInformation); | ||||
| 	} | ||||
|  | ||||
| 	public static function getClass<T>(o:T):Class<T> { | ||||
| 		if (o == null) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		if (Jvm.instanceof(o, Class)) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		var c = o.object().getClass(); | ||||
| 		if (isEnumValueClass(c)) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		if (c == jvm.DynamicObject.native() || Jvm.instanceof(o, jvm.DynamicObject)) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		return c.haxe(); | ||||
| 	} | ||||
|  | ||||
| 	public static function getEnum(o:EnumValue):Enum<Dynamic> { | ||||
| 		if (o == null) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		var c = o.object().getClass().getSuperclass(); | ||||
| 		if (!c.isAnnotationPresent(cast EnumReflectionInformation)) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		return c.haxeEnum(); | ||||
| 	} | ||||
|  | ||||
| 	public static function getSuperClass(c:Class<Dynamic>):Class<Dynamic> { | ||||
| 		if (c == String) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		var c = c.native(); | ||||
| 		var cSuper = c.getSuperclass(); | ||||
| 		if (cSuper == null) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		var annotation = c.getAnnotation((cast ClassReflectionInformation : java.lang.Class<ClassReflectionInformation>)); | ||||
| 		if (annotation != null && annotation.hasSuperClass() == false) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		return cSuper.haxe(); | ||||
| 	} | ||||
|  | ||||
| 	public static function getClassName(c:Class<Dynamic>):String { | ||||
| 		return switch (c.native().getName()) { | ||||
| 			case "java.lang.String": "String"; | ||||
| 			case "java.lang.Math": "Math"; | ||||
| 			case s if (s.indexOf("haxe.root.") == 0): s.substr(10); | ||||
| 			case s: s; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public static function getEnumName(e:Enum<Dynamic>):String { | ||||
| 		return switch e.native().getName() { | ||||
| 			case s if(s.indexOf("haxe.root.") == 0): s.substr(10); | ||||
| 			case s: s; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public static function resolveClass(name:String):Class<Dynamic> { | ||||
| 		if (name.indexOf(".") == -1) { | ||||
| 			name = "haxe.root." + name; | ||||
| 		} | ||||
| 		return try { | ||||
| 			java.lang.Class.forName(name).haxe(); | ||||
| 		} catch (e:java.lang.ClassNotFoundException) { | ||||
| 			return switch (name) { | ||||
| 				case "haxe.root.String": java.NativeString; | ||||
| 				case "haxe.root.Math": java.lang.Math; | ||||
| 				case _: null; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public static function resolveEnum(name:String):Enum<Dynamic> { | ||||
| 		if (name.indexOf(".") == -1) { | ||||
| 			name = "haxe.root." + name; | ||||
| 		} | ||||
| 		return try { | ||||
| 			var c = java.lang.Class.forName(name); | ||||
| 			if (!isEnumClass(c)) { | ||||
| 				null; | ||||
| 			} else { | ||||
| 				c.haxeEnum(); | ||||
| 			} | ||||
| 		} catch (e:java.lang.ClassNotFoundException) { | ||||
| 			return null; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	static final emptyArg = { | ||||
| 		var a = new java.NativeArray(1); | ||||
| 		a[0] = (null : jvm.EmptyConstructor); | ||||
| 		a; | ||||
| 	} | ||||
|  | ||||
| 	static final emptyClass = { | ||||
| 		var a = new java.NativeArray(1); | ||||
| 		a[0] = jvm.EmptyConstructor.native(); | ||||
| 		a; | ||||
| 	} | ||||
|  | ||||
| 	public static function createInstance<T>(cl:Class<T>, args:Array<Dynamic>):T { | ||||
| 		var args = @:privateAccess args.getNative(); | ||||
| 		var cl = cl.native(); | ||||
| 		var ctors = cl.getConstructors(); | ||||
| 		var emptyCtor:Null<java.lang.reflect.Constructor<T>> = null; | ||||
| 		// 1. Look for real constructor. If we find the EmptyConstructor constructor, store it | ||||
| 		for (ctor in ctors) { | ||||
| 			var params = ctor.getParameterTypes(); | ||||
| 			if (params.length == 1 && params[0] == jvm.EmptyConstructor.native()) { | ||||
| 				emptyCtor = cast ctor; | ||||
| 				continue; | ||||
| 			} | ||||
| 			switch (Jvm.unifyCallArguments(args, params, true)) { | ||||
| 				case Some(args): | ||||
| 					ctor.setAccessible(true); | ||||
| 					return ctor.newInstance(args); | ||||
| 				case None: | ||||
| 			} | ||||
| 		} | ||||
| 		// 2. If there was the EmptyConstructor constructor, look for a matching new method | ||||
| 		if (emptyCtor != null) { | ||||
| 			var methods = cl.getMethods(); | ||||
| 			for (method in methods) { | ||||
| 				if (method.getName() != "new") { | ||||
| 					continue; | ||||
| 				} | ||||
| 				var params = method.getParameterTypes(); | ||||
| 				switch (Jvm.unifyCallArguments(args, params, true)) { | ||||
| 					case Some(args): | ||||
| 						var obj = emptyCtor.newInstance(emptyArg); | ||||
| 						method.setAccessible(true); | ||||
| 						method.invoke(obj, args); | ||||
| 						return obj; | ||||
| 					case None: | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		return null; | ||||
| 	} | ||||
|  | ||||
| 	public static function createEmptyInstance<T>(cl:Class<T>):T { | ||||
| 		var annotation = (cl.native().getAnnotation((cast ClassReflectionInformation : java.lang.Class<ClassReflectionInformation>))); | ||||
| 		if (annotation != null) { | ||||
| 			return cl.native().getConstructor(emptyClass).newInstance(emptyArg); | ||||
| 		} else { | ||||
| 			return cl.native().newInstance(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public static function createEnum<T>(e:Enum<T>, constr:String, ?params:Array<Dynamic>):T { | ||||
| 		if (params == null || params.length == 0) { | ||||
| 			var v:Dynamic = Jvm.readField(e, constr); | ||||
| 			if (!Std.isOfType(v, e)) { | ||||
| 				throw 'Could not create enum value ${getEnumName(e)}.$constr: Unexpected value $v'; | ||||
| 			} | ||||
| 			return v; | ||||
| 		} else { | ||||
| 			return Reflect.callMethod(null, Jvm.readField(e, constr), params); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public static function createEnumIndex<T>(e:Enum<T>, index:Int, ?params:Array<Dynamic>):T { | ||||
| 		var clInfo:java.lang.Class<EnumReflectionInformation> = cast EnumReflectionInformation; | ||||
| 		var annotation = e.native().getAnnotation(clInfo); | ||||
| 		if (params == null || params.length == 0) { | ||||
| 			return Jvm.readField(e, annotation.constructorNames()[index]); | ||||
| 		} else { | ||||
| 			return Reflect.callMethod(null, Jvm.readField(e, annotation.constructorNames()[index]), params); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	static function getFields<T>(c:java.lang.Class<T>, statics:Bool):Array<String> { | ||||
| 		var ret = []; | ||||
| 		for (f in c.getDeclaredFields()) { | ||||
| 			if (java.lang.reflect.Modifier.isStatic(f.getModifiers()) == statics && !f.isSynthetic()) { | ||||
| 				ret.push(f.getName()); | ||||
| 			} | ||||
| 		} | ||||
| 		for (m in c.getDeclaredMethods()) { | ||||
| 			if (java.lang.reflect.Modifier.isStatic(m.getModifiers()) == statics && !m.isSynthetic()) { | ||||
| 				ret.push(m.getName()); | ||||
| 			} | ||||
| 		} | ||||
| 		return ret; | ||||
| 	} | ||||
|  | ||||
| 	public static function getInstanceFields(c:Class<Dynamic>):Array<String> { | ||||
| 		var fields = []; | ||||
| 		while (c != null) { | ||||
| 			for (field in fields.concat(getFields(c.native(), false))) { | ||||
| 				if (fields.indexOf(field) == -1) { | ||||
| 					fields.push(field); | ||||
| 				} | ||||
| 			} | ||||
| 			c = getSuperClass(c); | ||||
| 		}; | ||||
| 		return fields; | ||||
| 	} | ||||
|  | ||||
| 	public static function getClassFields(c:Class<Dynamic>):Array<String> { | ||||
| 		return getFields(c.native(), true); | ||||
| 	} | ||||
|  | ||||
| 	public static function getEnumConstructs(e:Enum<Dynamic>):Array<String> { | ||||
| 		var clInfo:java.lang.Class<EnumReflectionInformation> = cast EnumReflectionInformation; | ||||
| 		var annotation = e.native().getAnnotation(clInfo); | ||||
| 		return @:privateAccess Array.ofNative(annotation.constructorNames()); | ||||
| 	} | ||||
|  | ||||
| 	public static function typeof(v:Dynamic):ValueType { | ||||
| 		// could optimize this with an annotation on Haxe classes | ||||
| 		if (v == null) { | ||||
| 			return TNull; | ||||
| 		} | ||||
| 		if (Jvm.instanceof(v, java.lang.Number)) { | ||||
| 			var v:java.lang.Number = cast v; | ||||
| 			if (v.intValue() == v.doubleValue()) { | ||||
| 				return TInt; | ||||
| 			} | ||||
| 			return TFloat; | ||||
| 		} | ||||
| 		if (Jvm.instanceof(v, java.lang.Boolean.BooleanClass)) { | ||||
| 			return TBool; | ||||
| 		} | ||||
| 		if (Jvm.instanceof(v, jvm.DynamicObject)) { | ||||
| 			return TObject; | ||||
| 		} | ||||
| 		if (Jvm.instanceof(v, jvm.Function)) { | ||||
| 			return TFunction; | ||||
| 		} | ||||
| 		var c = (cast v : java.lang.Object).getClass(); | ||||
| 		// TODO: native enums? | ||||
| 		if (isEnumValueClass(c)) { | ||||
| 			return TEnum(c.getSuperclass().haxeEnum()); | ||||
| 		} | ||||
| 		if (Jvm.instanceof(v, java.lang.Class)) { | ||||
| 			return TObject; | ||||
| 		} | ||||
| 		return TClass(c.haxe()); | ||||
| 	} | ||||
|  | ||||
| 	public static function enumEq<T>(a:T, b:T):Bool { | ||||
| 		if (a == null) { | ||||
| 			return b == null; | ||||
| 		} | ||||
| 		var a:jvm.Enum<Dynamic> = cast a; | ||||
| 		var b:jvm.Enum<Dynamic> = cast b; | ||||
| 		return a.equals(b); | ||||
| 	} | ||||
|  | ||||
| 	public static function enumConstructor(e:EnumValue):String { | ||||
| 		return (cast e : java.lang.Enum<Dynamic>).name(); | ||||
| 	} | ||||
|  | ||||
| 	public static function enumParameters(e:EnumValue):Array<Dynamic> { | ||||
| 		var a = (cast e : jvm.Enum<Dynamic>)._hx_getParameters(); | ||||
| 		return @:privateAccess Array.ofNative(a); | ||||
| 	} | ||||
|  | ||||
| 	public static function enumIndex(e:EnumValue):Int { | ||||
| 		return (cast e : java.lang.Enum<Dynamic>).ordinal(); | ||||
| 	} | ||||
|  | ||||
| 	public static function allEnums<T>(e:Enum<T>):Array<T> { | ||||
| 		var all = getEnumConstructs(e); | ||||
| 		var ret = []; | ||||
| 		for (name in all) { | ||||
| 			var v = Jvm.readField(e, name); | ||||
| 			if (Jvm.instanceof(v, jvm.Enum)) { | ||||
| 				ret.push(v); | ||||
| 			} | ||||
| 		} | ||||
| 		return ret; | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										91
									
								
								Kha/Tools/linux_x64/std/jvm/_std/haxe/ds/StringMap.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								Kha/Tools/linux_x64/std/jvm/_std/haxe/ds/StringMap.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,91 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| package haxe.ds; | ||||
|  | ||||
| @:coreApi | ||||
| class StringMap<T> implements haxe.Constraints.IMap<String, T> { | ||||
| 	var hashMap:java.util.HashMap<String, T>; | ||||
|  | ||||
| 	@:overload | ||||
| 	public function new():Void { | ||||
| 		hashMap = new java.util.HashMap(); | ||||
| 	} | ||||
|  | ||||
| 	@:overload | ||||
| 	function new(hashMap:java.util.HashMap<String, T>):Void { | ||||
| 		this.hashMap = hashMap; | ||||
| 	} | ||||
|  | ||||
| 	public function set(key:String, value:T):Void { | ||||
| 		hashMap.put(key, value); | ||||
| 	} | ||||
|  | ||||
| 	public function get(key:String):Null<T> { | ||||
| 		return hashMap.get(key); | ||||
| 	} | ||||
|  | ||||
| 	public function exists(key:String):Bool { | ||||
| 		return hashMap.containsKey(key); | ||||
| 	} | ||||
|  | ||||
| 	public function remove(key:String):Bool { | ||||
| 		var has = exists(key); | ||||
| 		hashMap.remove(key); | ||||
| 		return has; | ||||
| 	} | ||||
|  | ||||
| 	public inline function keys():Iterator<String> { | ||||
| 		return hashMap.keySet().iterator(); | ||||
| 	} | ||||
|  | ||||
| 	@:runtime public inline function keyValueIterator():KeyValueIterator<String, T> { | ||||
| 		return new haxe.iterators.MapKeyValueIterator(this); | ||||
| 	} | ||||
|  | ||||
| 	public inline function iterator():Iterator<T> { | ||||
| 		return hashMap.values().iterator(); | ||||
| 	} | ||||
|  | ||||
| 	public function copy():StringMap<T> { | ||||
| 		return new StringMap(hashMap.clone()); | ||||
| 	} | ||||
|  | ||||
| 	public function toString():String { | ||||
| 		var s = new StringBuf(); | ||||
| 		s.add("{"); | ||||
| 		var it = keys(); | ||||
| 		for (i in it) { | ||||
| 			s.add(i); | ||||
| 			s.add(" => "); | ||||
| 			s.add(Std.string(get(i))); | ||||
| 			if (it.hasNext()) | ||||
| 				s.add(", "); | ||||
| 		} | ||||
| 		s.add("}"); | ||||
| 		return s.toString(); | ||||
| 	} | ||||
|  | ||||
| 	public function clear():Void { | ||||
| 		hashMap.clear(); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										43
									
								
								Kha/Tools/linux_x64/std/jvm/_std/sys/thread/Lock.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								Kha/Tools/linux_x64/std/jvm/_std/sys/thread/Lock.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,43 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| package sys.thread; | ||||
|  | ||||
| import java.util.concurrent.LinkedBlockingDeque; | ||||
|  | ||||
| @:coreApi | ||||
| class Lock { | ||||
| 	final deque = new LinkedBlockingDeque<String>(); | ||||
|  | ||||
| 	public function new() {} | ||||
|  | ||||
| 	public function wait(?timeout:Float):Bool { | ||||
| 		return switch timeout == null ? deque.take() : deque.poll(Std.int(timeout * 1000.0), MILLISECONDS) { | ||||
| 			case null: false; | ||||
| 			case _: true; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public function release():Void { | ||||
| 		deque.put(""); | ||||
| 	} | ||||
| } | ||||
| @ -0,0 +1,30 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| package jvm.annotation; | ||||
|  | ||||
| @:annotation | ||||
| @:native("haxe.jvm.annotation.ClassReflectionInformation") | ||||
| @:keep | ||||
| interface ClassReflectionInformation extends java.lang.annotation.Annotation { | ||||
| 	function hasSuperClass():Bool; | ||||
| } | ||||
| @ -0,0 +1,30 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| package jvm.annotation; | ||||
|  | ||||
| @:annotation | ||||
| @:native("haxe.jvm.annotation.EnumReflectionInformation") | ||||
| @:keep | ||||
| interface EnumReflectionInformation extends java.lang.annotation.Annotation { | ||||
| 	function constructorNames():java.NativeArray<String>; | ||||
| } | ||||
| @ -0,0 +1,30 @@ | ||||
| /* | ||||
|  * Copyright (C)2005-2019 Haxe Foundation | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|  * to deal in the Software without restriction, including without limitation | ||||
|  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|  * and/or sell copies of the Software, and to permit persons to whom the | ||||
|  * Software is furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  * The above copyright notice and this permission notice shall be included in | ||||
|  * all copies or substantial portions of the Software. | ||||
|  * | ||||
|  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||
|  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||
|  * DEALINGS IN THE SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| package jvm.annotation; | ||||
|  | ||||
| @:annotation | ||||
| @:native("haxe.jvm.annotation.EnumValueReflectionInformation") | ||||
| @:keep | ||||
| interface EnumValueReflectionInformation extends java.lang.annotation.Annotation { | ||||
| 	function argumentNames():java.NativeArray<String>; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user