From d770b849f4294e2911dd78f1cfbcee5f45c162a7 Mon Sep 17 00:00:00 2001 From: Simon Krajewski Date: Tue, 19 Nov 2024 10:21:59 +0100 Subject: [PATCH] unused, maybe --- std/java2/Boot.hx | 44 ---------- std/java2/Lib.hx | 163 ------------------------------------- std/java2/net/SslSocket.hx | 33 -------- std/java2/vm/AtomicList.hx | 83 ------------------- std/java2/vm/Deque.hx | 25 ------ std/java2/vm/Gc.hx | 34 -------- std/java2/vm/Lock.hx | 25 ------ std/java2/vm/Mutex.hx | 25 ------ std/java2/vm/Thread.hx | 25 ------ std/java2/vm/Tls.hx | 25 ------ 10 files changed, 482 deletions(-) delete mode 100644 std/java2/Boot.hx delete mode 100644 std/java2/Lib.hx delete mode 100644 std/java2/net/SslSocket.hx delete mode 100644 std/java2/vm/AtomicList.hx delete mode 100644 std/java2/vm/Deque.hx delete mode 100644 std/java2/vm/Gc.hx delete mode 100644 std/java2/vm/Lock.hx delete mode 100644 std/java2/vm/Mutex.hx delete mode 100644 std/java2/vm/Thread.hx delete mode 100644 std/java2/vm/Tls.hx diff --git a/std/java2/Boot.hx b/std/java2/Boot.hx deleted file mode 100644 index 72e64d075f5..00000000000 --- a/std/java2/Boot.hx +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 java; - -import java.Lib; -import java.Init; -import java.StdTypes; -import Reflect; -import Map; -import haxe.ds.StringMap; -import java.lang.Boolean; -import java.lang.Character; -import java.lang.Class; -import java.lang.Number; -import java.lang.Byte; -import java.lang.Double; -import java.lang.Float; -import java.lang.Integer; -import java.lang.Long; -import java.lang.Short; -import java.lang.Throwable; - -@:dox(hide) -extern class Boot {} diff --git a/std/java2/Lib.hx b/std/java2/Lib.hx deleted file mode 100644 index 88e7e2b3d21..00000000000 --- a/std/java2/Lib.hx +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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 java; - -/** - Platform-specific Java Library. Provides some platform-specific functions for the Java target, - such as conversion from Haxe types to native types and vice-versa. -**/ -// we cannot use the java package for custom classes, so we're redefining it as "haxe.java.Lib" -@:native('haxe.java.Lib') class Lib { - /** - Print the specified value on the default output. - **/ - inline public static function print(v:Dynamic):Void { - Sys.print(v); - } - - /** - Print the specified value on the default output followed by a newline character. - **/ - inline public static function println(v:Dynamic):Void { - Sys.println(v); - } - - /** - Returns a native array from the supplied Array. This native array is unsafe to be written on, - as it may or may not be linked to the actual Array implementation. - - If `equalLengthRequired` is true, the result might be a copy of an array with the correct size. - **/ - inline public static function nativeArray(arr:Array, equalLengthRequired:Bool):NativeArray { - var ret = new NativeArray(arr.length); - for (i in 0...arr.length) { - ret[i] = arr[i]; - } - return ret; - } - - /** - Gets the native `java.lang.Class` from the supplied object. Will throw an exception in case of null being passed. - [deprecated] - use `getNativeType` instead - **/ - @:deprecated('The function `nativeType` is deprecated and will be removed in later versions. Please use `getNativeType` instead') - inline public static function nativeType(obj:T):java.lang.Class { - return untyped obj.getClass(); - } - - /** - Gets the native `java.lang.Class` from the supplied object. Will throw an exception in case of null being passed. - **/ - inline public static function getNativeType(obj:T):java.lang.Class { - return untyped obj.getClass(); - } - - /** - Returns a Class<> equivalent to the native java.lang.Class type. - **/ - public static inline function fromNativeType(t:java.lang.Class):Class { - return untyped t; - } - - /** - Returns a java.lang.Class equivalent to the Haxe Class<> type. - **/ - public static inline function toNativeType(cl:Class):java.lang.Class { - return untyped cl; - } - - /** - Returns a java.lang.Class equivalent to the Haxe Enum<> type. - **/ - public static inline function toNativeEnum(cl:Enum):java.lang.Class { - return untyped cl; - } - - /** - Returns a Haxe Array of a native Array. - Unless `copy` is true, it won't copy the contents of the native array, - so unless any operation triggers an array resize, all changes made to the Haxe array will affect the native array argument. - **/ - @:generic public static function array(native:java.NativeArray):Array { - return untyped Array.ofNative(native); - } - - extern inline private static function doArray(native:java.NativeArray):Array { - var ret:NativeArray = new NativeArray(native.length); - for (i in 0...native.length) { - ret[i] = native[i]; - } - return untyped Array.ofNative(ret); - } - - public static function array_Int(native:java.NativeArray):Array { - return doArray(native); - } - - public static function array_Float(native:java.NativeArray):Array { - return doArray(native); - } - - public static function array_Bool(native:java.NativeArray):Array { - return doArray(native); - } - - public static function array_java_Int8(native:java.NativeArray):Array { - return doArray(native); - } - - public static function array_java_Int16(native:java.NativeArray):Array { - return doArray(native); - } - - public static function array_java_Char16(native:java.NativeArray):Array { - return doArray(native); - } - - public static function array_Single(native:java.NativeArray):Array { - return doArray(native); - } - - public static function array_haxe_Int64(native:java.NativeArray):Array { - return doArray(native); - } - - /** - Allocates a new Haxe Array with a predetermined size - **/ - public static function arrayAlloc(size:Int):Array { - return untyped Array.alloc(size); - } - - /** - Ensures that one thread does not enter a critical section of code while another thread - is in the critical section. If another thread attempts to enter a locked code, it - will wait, block, until the object is released. - This is the equivalent to "synchronized" in java code. - - This method only exists at compile-time, so it can't be called via reflection. - **/ - extern public static inline function lock(obj:Dynamic, block:T):Void { - untyped __lock__(obj, block); - } -} diff --git a/std/java2/net/SslSocket.hx b/std/java2/net/SslSocket.hx deleted file mode 100644 index f2116afc2e7..00000000000 --- a/std/java2/net/SslSocket.hx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 java.net; - -@:native('haxe.java.net.SslSocket') class SslSocket extends sys.net.Socket { - override private function create():Void { - try { - this.sock = java.javax.net.ssl.SSLSocketFactory.getDefault().createSocket(); - this.server = java.javax.net.ssl.SSLServerSocketFactory.getDefault().createServerSocket(); - } catch (e:Dynamic) - throw e; - } -} diff --git a/std/java2/vm/AtomicList.hx b/std/java2/vm/AtomicList.hx deleted file mode 100644 index f61dc279338..00000000000 --- a/std/java2/vm/AtomicList.hx +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 java.vm; - -import java.util.concurrent.atomic.AtomicReference; - -/** - A lock-free queue implementation -**/ -@:native('haxe.java.vm.AtomicList') -@:nativeGen class AtomicList { - @:volatile @:private var head:AtomicNode; - @:volatile @:private var tail:AtomicReference>; - - public function new() { - this.head = new AtomicNode(null); - this.head.set(new AtomicNode(null)); - this.tail = new AtomicReference(head); - } - - public function add(v:T) { - var n = new AtomicNode(v), tail = this.tail; - var p = null; - while (!((p = tail.get()).compareAndSet(null, n))) { - tail.compareAndSet(p, p.get()); - } - tail.compareAndSet(p, n); - } - - public function pop():Null { - var p = null, pget = null, head = head; - do { - p = head.get(); - if ((pget = p.get()) == null) - return null; // empty - } while (!head.compareAndSet(p, pget)); - - var ret = pget.value; - pget.value = null; - return ret; - } - - public function peek() { - var ret = head.get(); - if (ret == null) - return null; // empty - return ret.value; - } - - public function peekLast() { - return tail.get().value; - } -} - -@:native('haxe.java.vm.AtomicNode') -@:nativeGen class AtomicNode extends AtomicReference> { - public var value:T; - - public function new(value) { - super(); - this.value = value; - } -} diff --git a/std/java2/vm/Deque.hx b/std/java2/vm/Deque.hx deleted file mode 100644 index 004c27e5b45..00000000000 --- a/std/java2/vm/Deque.hx +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 java.vm; - -@:deprecated typedef Deque = sys.thread.Deque; diff --git a/std/java2/vm/Gc.hx b/std/java2/vm/Gc.hx deleted file mode 100644 index 11423660f8c..00000000000 --- a/std/java2/vm/Gc.hx +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 java.vm; - -@:native('haxe.java.vm.Gc') class Gc { - public static function run(major:Bool) { - java.lang.System.gc(); - } - - public static function stats():{heap:Int, free:Int} { - var r = java.lang.Runtime.getRuntime(); - return {heap: cast r.totalMemory(), free: cast r.freeMemory()}; - } -} diff --git a/std/java2/vm/Lock.hx b/std/java2/vm/Lock.hx deleted file mode 100644 index 65286ff7a72..00000000000 --- a/std/java2/vm/Lock.hx +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 java.vm; - -@:deprecated typedef Lock = sys.thread.Lock; diff --git a/std/java2/vm/Mutex.hx b/std/java2/vm/Mutex.hx deleted file mode 100644 index ae0900cff3c..00000000000 --- a/std/java2/vm/Mutex.hx +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 java.vm; - -@:deprecated typedef Mutex = sys.thread.Mutex; diff --git a/std/java2/vm/Thread.hx b/std/java2/vm/Thread.hx deleted file mode 100644 index e1a1dcc9543..00000000000 --- a/std/java2/vm/Thread.hx +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 java.vm; - -@:deprecated typedef Thread = sys.thread.Thread; diff --git a/std/java2/vm/Tls.hx b/std/java2/vm/Tls.hx deleted file mode 100644 index 2bb6f1bc004..00000000000 --- a/std/java2/vm/Tls.hx +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 java.vm; - -@:deprecated typedef Tls = sys.thread.Tls;