From 2e0500f7021a88c3daf0e1de448e0ec1aa5934de Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Fri, 23 Feb 2024 20:44:47 +0100 Subject: [PATCH 1/9] Added INativeConvertible on native types to manage conversion in reviewed extensions --- src/net/JNet/Developed/Java/Lang/Boolean.cs | 13 +- src/net/JNet/Developed/Java/Lang/Byte.cs | 13 +- src/net/JNet/Developed/Java/Lang/Character.cs | 13 +- src/net/JNet/Developed/Java/Lang/Double.cs | 13 +- src/net/JNet/Developed/Java/Lang/Float.cs | 13 +- src/net/JNet/Developed/Java/Lang/Integer.cs | 13 +- src/net/JNet/Developed/Java/Lang/Long.cs | 13 +- src/net/JNet/Developed/Java/Lang/Short.cs | 13 +- src/net/JNet/Developed/Java/Lang/String.cs | 107 ++++++- .../Specific/Extensions/JavaLangExtensions.cs | 104 ------- .../Specific/Extensions/JavaUtilExtensions.cs | 269 +++++++++++++----- 11 files changed, 398 insertions(+), 186 deletions(-) delete mode 100644 src/net/JNet/Specific/Extensions/JavaLangExtensions.cs diff --git a/src/net/JNet/Developed/Java/Lang/Boolean.cs b/src/net/JNet/Developed/Java/Lang/Boolean.cs index 889d18525c..256531bd68 100644 --- a/src/net/JNet/Developed/Java/Lang/Boolean.cs +++ b/src/net/JNet/Developed/Java/Lang/Boolean.cs @@ -17,12 +17,23 @@ */ using MASES.JCOBridge.C2JBridge; +using MASES.JNet.Specific.Extensions; using System; namespace Java.Lang { - public partial class Boolean + public partial class Boolean : INativeConvertible { + bool INativeConvertible.ToCLR() + { + return BooleanValue(); + } + + Boolean INativeConvertible.ToJVM(bool clrValue) + { + return ValueOf(clrValue); + } + /// /// Converter from to /// diff --git a/src/net/JNet/Developed/Java/Lang/Byte.cs b/src/net/JNet/Developed/Java/Lang/Byte.cs index 36be8f7abc..d5dd22272a 100644 --- a/src/net/JNet/Developed/Java/Lang/Byte.cs +++ b/src/net/JNet/Developed/Java/Lang/Byte.cs @@ -17,12 +17,23 @@ */ using MASES.JCOBridge.C2JBridge; +using MASES.JNet.Specific.Extensions; using System; namespace Java.Lang { - public partial class Byte + public partial class Byte : INativeConvertible { + byte INativeConvertible.ToCLR() + { + return ByteValue(); + } + + Byte INativeConvertible.ToJVM(byte clrValue) + { + return ValueOf(clrValue); + } + /// /// Converter from to /// diff --git a/src/net/JNet/Developed/Java/Lang/Character.cs b/src/net/JNet/Developed/Java/Lang/Character.cs index 7659e8f0be..2b7c523090 100644 --- a/src/net/JNet/Developed/Java/Lang/Character.cs +++ b/src/net/JNet/Developed/Java/Lang/Character.cs @@ -17,12 +17,23 @@ */ using MASES.JCOBridge.C2JBridge; +using MASES.JNet.Specific.Extensions; using System; namespace Java.Lang { - public partial class Character + public partial class Character : INativeConvertible { + char INativeConvertible.ToCLR() + { + return CharValue(); + } + + Character INativeConvertible.ToJVM(char clrValue) + { + return ValueOf(clrValue); + } + /// /// Converter from to /// diff --git a/src/net/JNet/Developed/Java/Lang/Double.cs b/src/net/JNet/Developed/Java/Lang/Double.cs index a299c6d951..9d8be71157 100644 --- a/src/net/JNet/Developed/Java/Lang/Double.cs +++ b/src/net/JNet/Developed/Java/Lang/Double.cs @@ -17,12 +17,23 @@ */ using MASES.JCOBridge.C2JBridge; +using MASES.JNet.Specific.Extensions; using System; namespace Java.Lang { - public partial class Double //: Number + public partial class Double : INativeConvertible { + double INativeConvertible.ToCLR() + { + return DoubleValue(); + } + + Double INativeConvertible.ToJVM(double clrValue) + { + return ValueOf(clrValue); + } + /// /// Converter from to /// diff --git a/src/net/JNet/Developed/Java/Lang/Float.cs b/src/net/JNet/Developed/Java/Lang/Float.cs index d3b0dc5ede..5fce4188a9 100644 --- a/src/net/JNet/Developed/Java/Lang/Float.cs +++ b/src/net/JNet/Developed/Java/Lang/Float.cs @@ -17,12 +17,23 @@ */ using MASES.JCOBridge.C2JBridge; +using MASES.JNet.Specific.Extensions; using System; namespace Java.Lang { - public partial class Float : Number + public partial class Float : INativeConvertible { + float INativeConvertible.ToCLR() + { + return FloatValue(); + } + + Float INativeConvertible.ToJVM(float clrValue) + { + return ValueOf(clrValue); + } + /// /// Converter from to /// diff --git a/src/net/JNet/Developed/Java/Lang/Integer.cs b/src/net/JNet/Developed/Java/Lang/Integer.cs index 82e7e71bb1..56bfa51b46 100644 --- a/src/net/JNet/Developed/Java/Lang/Integer.cs +++ b/src/net/JNet/Developed/Java/Lang/Integer.cs @@ -17,12 +17,23 @@ */ using MASES.JCOBridge.C2JBridge; +using MASES.JNet.Specific.Extensions; using System; namespace Java.Lang { - public partial class Integer : Number + public partial class Integer : INativeConvertible { + int INativeConvertible.ToCLR() + { + return IntValue(); + } + + Integer INativeConvertible.ToJVM(int clrValue) + { + return ValueOf(clrValue); + } + /// /// Converter from to /// diff --git a/src/net/JNet/Developed/Java/Lang/Long.cs b/src/net/JNet/Developed/Java/Lang/Long.cs index 5a3f4bc50c..b4d809edd6 100644 --- a/src/net/JNet/Developed/Java/Lang/Long.cs +++ b/src/net/JNet/Developed/Java/Lang/Long.cs @@ -17,12 +17,23 @@ */ using MASES.JCOBridge.C2JBridge; +using MASES.JNet.Specific.Extensions; using System; namespace Java.Lang { - public partial class Long : Number + public partial class Long : INativeConvertible { + long INativeConvertible.ToCLR() + { + return LongValue(); + } + + Long INativeConvertible.ToJVM(long clrValue) + { + return ValueOf(clrValue); + } + /// /// Converter from to /// diff --git a/src/net/JNet/Developed/Java/Lang/Short.cs b/src/net/JNet/Developed/Java/Lang/Short.cs index b3b6d284bc..a5178d3b8f 100644 --- a/src/net/JNet/Developed/Java/Lang/Short.cs +++ b/src/net/JNet/Developed/Java/Lang/Short.cs @@ -17,12 +17,23 @@ */ using MASES.JCOBridge.C2JBridge; +using MASES.JNet.Specific.Extensions; using System; namespace Java.Lang { - public partial class Short : Number + public partial class Short : INativeConvertible { + short INativeConvertible.ToCLR() + { + return ShortValue(); + } + + Short INativeConvertible.ToJVM(short clrValue) + { + return ValueOf(clrValue); + } + /// /// Converter from to /// diff --git a/src/net/JNet/Developed/Java/Lang/String.cs b/src/net/JNet/Developed/Java/Lang/String.cs index f301fb92e2..6ffa550f16 100644 --- a/src/net/JNet/Developed/Java/Lang/String.cs +++ b/src/net/JNet/Developed/Java/Lang/String.cs @@ -17,12 +17,13 @@ */ using MASES.JCOBridge.C2JBridge; +using MASES.JNet.Specific.Extensions; using System.Runtime.CompilerServices; using SystemNet = System; namespace Java.Lang { - public partial class String : JVMBridgeBase, SystemNet.IComparable, SystemNet.IEquatable + public partial class String : JVMBridgeBase, INativeConvertible, SystemNet.IComparable, SystemNet.IEquatable { #region Constructors /// @@ -76,6 +77,110 @@ bool SystemNet.IEquatable.Equals(Java.Lang.String other) return base.Equals(other); } + string INativeConvertible.ToCLR() + { + return ToString(); + } + + String INativeConvertible.ToJVM(string clrValue) + { + return clrValue != null ? new Java.Lang.String(clrValue) : null; + } + #endregion + + //#region Enumerable/Array Extensions + + ///// + ///// Converts an of to an array of + ///// + ///// The of to be converted + ///// The converted array of + //public static implicit operator string[](Java.Lang.String[] set) + //{ + // SystemNet.Collections.Generic.List list = new(); + // foreach (var item in set) + // { + // list.Add(item); + // } + // return list.ToArray(); + //} + + ///// + ///// Converts an of to an array of + ///// + ///// The of to be converted + ///// The converted array of + //public static implicit operator string[](Java.Util.Collection set) + //{ + // SystemNet.Collections.Generic.List list = new(); + // foreach (var item in set) + // { + // list.Add(item); + // } + // return list.ToArray(); + //} + + ///// + ///// Converts an of to an array of + ///// + ///// The of to be converted + ///// The converted array of + //public static implicit operator string[](Java.Lang.Iterable set) + //{ + // SystemNet.Collections.Generic.List list = new(); + // foreach (var item in set) + // { + // list.Add(item); + // } + // return list.ToArray(); + //} + + ///// + ///// Converts an of to an of + ///// + ///// The of to be converted + ///// The converted of + //public static implicit operator Java.Util.Collection(string[] set) + //{ + // Java.Util.ArrayList list = new(); + // foreach (var item in set) + // { + // list.Add(item); + // } + // return list; + //} + + ///// + ///// Converts an of to an of + ///// + ///// The array of to be converted + ///// The converted of + //public static implicit operator Java.Lang.Iterable(string[] set) + //{ + // Java.Util.ArrayList list = new(); + // foreach (var item in set) + // { + // list.Add(item); + // } + // return list; + //} + + ///// + ///// Converts an of to an array of + ///// + ///// The of to be converted + ///// The array of + //public static implicit operator Java.Lang.String[](string[] collection) + //{ + // SystemNet.Collections.Generic.List list = new(); + // foreach (var item in collection) + // { + // list.Add(item); + // } + // return list.ToArray(); + //} + + //#endregion } } diff --git a/src/net/JNet/Specific/Extensions/JavaLangExtensions.cs b/src/net/JNet/Specific/Extensions/JavaLangExtensions.cs deleted file mode 100644 index ae0329b43c..0000000000 --- a/src/net/JNet/Specific/Extensions/JavaLangExtensions.cs +++ /dev/null @@ -1,104 +0,0 @@ -/* -* Copyright 2024 MASES s.r.l. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* Refer to LICENSE for more information. -*/ - -using Java.Util; -using System; -using System.Collections.Generic; - -namespace MASES.JNet.Specific.Extensions -{ - /// - /// Extension for Java.Util classes - /// - public static class JavaLangExtension - { - #region Enumerable/Array Extensions - - /// - /// Converts an of to an of - /// - /// The of to be converted - /// The converted of - public static System.Collections.Generic.IEnumerable ToEnumerable(this System.Collections.Generic.IEnumerable set) - { - System.Collections.Generic.List list = new(); - foreach (var item in set) - { - list.Add(item); - } - return list; - } - - /// - /// Converts an of to an array of - /// - /// The of to be converted - /// The converted array of - public static string[] ToArray(this System.Collections.Generic.IEnumerable set) - { - System.Collections.Generic.List list = new(); - foreach (var item in set) - { - list.Add(item); - } - return list.ToArray(); - } - - /// - /// Converts an of to an of - /// - /// The of to be converted - /// The converted of - public static Java.Util.Collection ToJCollection(this System.Collections.Generic.IEnumerable set) - { - ArrayList list = new(); - foreach (var item in set) - { - list.Add(item); - } - return list; - } - - /// - /// Converts an of to an of - /// - /// The of to be converted - /// The converted of - public static Java.Lang.Iterable ToIterable(this System.Collections.Generic.IEnumerable set) - { - return ToJCollection(set); - } - - /// - /// Converts an of to an array of - /// - /// The of to be converted - /// The array of - public static Java.Lang.String[] ToArray(this System.Collections.Generic.IEnumerable collection) - { - System.Collections.Generic.List list = new(); - foreach (var item in collection) - { - list.Add(item); - } - return list.ToArray(); - } - - #endregion - } -} diff --git a/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs b/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs index 662ddbe329..23f71397d8 100644 --- a/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs +++ b/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs @@ -18,10 +18,31 @@ using Java.Util; using System; +using System.Collections; using System.Collections.Generic; namespace MASES.JNet.Specific.Extensions { + /// + /// Interface defining the .NET type corresponding to the JVM class implementing + /// + /// The JVM type + /// The .NET type corresponding to + public interface INativeConvertible + { + /// + /// Returns the from this instance + /// + /// The converted + TNetType ToCLR(); + /// + /// Returns the from the instance + /// + /// The of CLR + /// The converted + TJVMType ToJVM(TNetType clrValue); + } + /// /// Extension for Java.Util classes /// @@ -29,107 +50,170 @@ public static class JavaUtilExtensions { #region List Extensions /// - /// Converts a to + /// Converts an of to an of /// - /// Type - /// The - /// The - public static System.Collections.Generic.ICollection ToCollection(this Collection set) + /// A type implementing + /// The expected .NET type + /// The original JVM type + /// The of to be converted + /// An used to convert into + /// The converted of + public static TEnumerableType ToNetCollectionType(this System.Collections.Generic.IEnumerable set, Func func = null) + where TEnumerableType : System.Collections.Generic.ICollection, new() + where TJVMType : INativeConvertible { - System.Collections.Generic.List list = new(); - if (set.IsEmpty()) return list; + var tInstance = new TEnumerableType(); foreach (var item in set) { - list.Add(item); + tInstance.Add(func != null ? func(item) : item.ToCLR()); } - return list; + return tInstance; + } + + /// + /// Converts an of to an array of + /// + /// The of to be converted + /// The converted array of + public static TNetType[] ToNetArray(this System.Collections.Generic.IEnumerable set) + where TJVMType : INativeConvertible + { + var tmpEnum = ToNetCollectionType, TNetType, TJVMType>(set); + return tmpEnum.ToArray(); } + /// - /// Converts a to + /// Converts an of to an of /// - /// Type - /// The - /// The - public static System.Collections.Generic.List ToList(this Collection set) + /// A type implementing + /// The expected JVM type + /// The original .NET type + /// The of to be converted + /// An optional used to return from data of in + /// The converted of + public static TIterableType ToJVMCollectionType(this System.Collections.Generic.IEnumerable set, Func func = null) + where TIterableType : Java.Util.Collection, new() + where TJVMTypeInner : INativeConvertible, new() { - System.Collections.Generic.List list = new(); - if (set.IsEmpty()) return list; + TJVMTypeInner inner = default; + if (func == null) inner = new TJVMTypeInner(); + var tInstance = new TIterableType(); foreach (var item in set) { - list.Add(item); + tInstance.Add(func != null ? func(item) : inner.ToJVM(item)); } - return list; + return tInstance; } + /// - /// Converts a to + /// Converts an of to an of /// - /// Type - /// The - /// The - public static Collection ToJCollection(this System.Collections.Generic.ICollection collection) + /// The of to be converted + /// An optional used to return from data of in + /// The converted of + public static Java.Util.Collection ToJVMCollection(this System.Collections.Generic.IEnumerable set, Func func = null) + where TJVMType : INativeConvertible, new() { - ArrayList list = new(); - if (collection.Count == 0) return list.CastTo>(); - foreach (var item in collection) - { - list.Add(item); - } - return list.CastTo>(); + return ToJVMCollectionType, TJVMType, TNetType>(set, func); } + /// - /// Converts a to + /// Converts an of to an array of /// - /// Type - /// The - /// The - public static Java.Util.List ToJList(this System.Collections.Generic.ICollection collection) + /// The array of to be converted + /// An optional used to return from data of in + /// The array of + public static TJVMType[] ToJVMArray(this TNetType[] collection, Func func = null) + where TJVMType : INativeConvertible, new() { - ArrayList list = new(); - if (collection.Count == 0) return list; + TJVMType inner = default; + if (func == null) inner = new TJVMType(); + System.Collections.Generic.List list = new(); foreach (var item in collection) { - list.Add(item); + list.Add(func != null ? func(item) : inner.ToJVM(item)); } - return list; + return list.ToArray(); } #endregion #region Map/Dictionary Extensions /// - /// Converts a to + /// Converts a to /// - /// Key - /// Value - /// The - /// The - public static System.Collections.Generic.Dictionary ToDictiony(this Map map) + /// Optional converter from to + /// Optional converter from to + /// The over and + /// .NET Key type + /// .NET Value + /// JVM key type + /// JVM value type + /// The + /// The + public static TDictionaryType ToNetDictiony(this Map map, Func keyConverter = null, Func valueConverter = null) + where TDictionaryType : IDictionary, new() + where TJVMK : INativeConvertible, new() + where TJVMV : INativeConvertible, new() { - System.Collections.Generic.Dictionary dictionary = new(); - if (map.IsEmpty()) return dictionary; - foreach (var item in map.EntrySet()) + if (map == null) throw new ArgumentNullException(nameof(map)); + var tInstance = new TDictionaryType(); + foreach (var key in map.KeySet()) { - dictionary.Add(item.Key, item.Value); + var value = map.Get(key); + tInstance.Add(keyConverter != null ? keyConverter(key) : key.ToCLR(), valueConverter != null ? valueConverter(value) : value.ToCLR()); } - return dictionary; + return tInstance; } + /// - /// Converts a to + /// Converts a to /// - /// Key - /// Value + /// Optional converter from to + /// Optional converter from to + /// .NET Key type + /// .NET Value + /// JVM key type + /// JVM value type + /// The + /// The + public static IDictionary ToNetDictiony(this Map map, Func keyConverter = null, Func valueConverter = null) + where TJVMK : INativeConvertible, new() + where TJVMV : INativeConvertible, new() + { + return ToNetDictiony, K, V, TJVMK, TJVMV>(map, keyConverter, valueConverter); + } + + /// + /// Converts a to + /// + /// Optional converter from to + /// Optional converter from to + /// The over and + /// .NET Key type + /// .NET Value + /// JVM key type + /// JVM value type /// The - /// The - public static Map ToMap(this IDictionary dictionary) + /// The + public static TMapType ToJVMMap(this IDictionary dictionary, Func keyConverter = null, Func valueConverter = null) + where TMapType : Java.Util.Map, new() + where TJVMK : INativeConvertible, new() + where TJVMV : INativeConvertible, new() { - HashMap map = new(); - if (dictionary.Count == 0) return map; + if (dictionary == null) throw new ArgumentNullException(nameof(dictionary)); + TJVMK innerK = default; + TJVMV innerV = default; + if (keyConverter == null) innerK = new TJVMK(); + if (valueConverter == null) innerV = new TJVMV(); + var tInstance = new TMapType(); foreach (var item in dictionary) { - map.Put(item.Key, item.Value); + tInstance.Put(keyConverter != null ? keyConverter(item.Key) : innerK.ToJVM(item.Key), valueConverter != null ? valueConverter(item.Value) : innerV.ToJVM(item.Value)); } - return map; + return tInstance; } + /// /// Converts a to /// @@ -141,32 +225,71 @@ public static Map ToMap(this IDictionary dictionary) /// JVM value type /// The /// The - public static Map ToMap(this IDictionary dictionary, Func keyConverter, Func valueConverter) + public static Map ToJVMMap(this IDictionary dictionary, Func keyConverter, Func valueConverter) + { + if (dictionary == null) throw new ArgumentNullException(nameof(dictionary)); + if (keyConverter == null) throw new ArgumentNullException(nameof(keyConverter)); + if (valueConverter == null) throw new ArgumentNullException(nameof(valueConverter)); + var tInstance = new HashMap(); + foreach (var item in dictionary) + { + tInstance.Put(keyConverter(item.Key), valueConverter(item.Value)); + } + return tInstance; + } + + /// + /// Converts a to + /// + /// Optional converter from to + /// Optional converter from to + /// The over and + /// .NET Key type + /// .NET Value + /// JVM key type + /// JVM value type + /// The + /// The + public static TDictionaryType ToJVMDictionary(this IDictionary dictionary, Func keyConverter = null, Func valueConverter = null) + where TDictionaryType : Java.Util.Dictionary, new() + where TJVMK : INativeConvertible, new() + where TJVMV : INativeConvertible, new() { - HashMap map = new(); - if (dictionary.Count == 0) return map; + if (dictionary == null) throw new ArgumentNullException(nameof(dictionary)); + TJVMK innerK = default; + TJVMV innerV = default; + if (keyConverter == null) innerK = new TJVMK(); + if (valueConverter == null) innerV = new TJVMV(); + var tInstance = new TDictionaryType(); foreach (var item in dictionary) { - map.Put(keyConverter(item.Key), valueConverter(item.Value)); + tInstance.Put(keyConverter != null ? keyConverter(item.Key) : innerK.ToJVM(item.Key), valueConverter != null ? valueConverter(item.Value) : innerV.ToJVM(item.Value)); } - return map; + return tInstance; } + /// - /// Converts a to + /// Converts a to /// - /// Key - /// Value + /// Converter from to + /// Converter from to + /// .NET Key type + /// .NET Value + /// JVM key type + /// JVM value type /// The - /// The - public static Hashtable ToHashtable(this IDictionary dictionary) + /// The + public static Java.Util.Dictionary ToJVMDictionary(this IDictionary dictionary, Func keyConverter, Func valueConverter) { - Hashtable hTable = new(); - if (dictionary.Count == 0) return hTable; + if (dictionary == null) throw new ArgumentNullException(nameof(dictionary)); + if (keyConverter == null) throw new ArgumentNullException(nameof(keyConverter)); + if (valueConverter == null) throw new ArgumentNullException(nameof(valueConverter)); + var tInstance = new Hashtable(); foreach (var item in dictionary) { - hTable.Put(item.Key, item.Value); + tInstance.Put(keyConverter(item.Key), valueConverter(item.Value)); } - return hTable; + return tInstance; } #endregion From 53485870d2abe23d9d243b9df1c1199e20576a60 Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Fri, 23 Feb 2024 20:45:36 +0100 Subject: [PATCH 2/9] PowerShell alignment --- .../JNetPS/Cmdlet/JMX/GetJMXConnectorCmdletCommand.cs | 10 ++++++++-- .../JNetPS/Cmdlet/JMX/GetQueryNamesCmdletCommand.cs | 3 ++- .../JNetPS/Cmdlet/JMX/NewObjectNameCmdletCommand.cs | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/net/JNetPS/Cmdlet/JMX/GetJMXConnectorCmdletCommand.cs b/src/net/JNetPS/Cmdlet/JMX/GetJMXConnectorCmdletCommand.cs index 487865c6fa..761031776f 100644 --- a/src/net/JNetPS/Cmdlet/JMX/GetJMXConnectorCmdletCommand.cs +++ b/src/net/JNetPS/Cmdlet/JMX/GetJMXConnectorCmdletCommand.cs @@ -16,6 +16,7 @@ * Refer to LICENSE for more information. */ +using Java.Lang; using Java.Util; using Javax.Management.Remote; using MASES.JNet.Specific.Extensions; @@ -53,9 +54,14 @@ public class GetJMXConnectorCmdletCommand : JNetPSCmdlet protected override void ProcessCommand() { JMXConnector result; + Map map = Collections.EmptyMap(); + if (Environment != null) + { + map = Environment.ToJVMMap((o) => { return (Java.Lang.String)o; }, (o) => { return o; }); + } if (UseNewJMXConnector.IsPresent) { - result = JMXConnectorFactory.NewJMXConnector(ServiceURL, Environment != null ? Environment.ToMap((o) => { return (Java.Lang.String)o; }, (o) => { return o; }) : Collections.EmptyMap()); + result = JMXConnectorFactory.NewJMXConnector(ServiceURL, map); } else { @@ -65,7 +71,7 @@ protected override void ProcessCommand() } else { - result = JMXConnectorFactory.Connect(ServiceURL, Environment.ToMap((o) => { return (Java.Lang.String)o; }, (o) => { return o; })); + result = JMXConnectorFactory.Connect(ServiceURL, map); } } diff --git a/src/net/JNetPS/Cmdlet/JMX/GetQueryNamesCmdletCommand.cs b/src/net/JNetPS/Cmdlet/JMX/GetQueryNamesCmdletCommand.cs index f5868f9026..c7c219e9db 100644 --- a/src/net/JNetPS/Cmdlet/JMX/GetQueryNamesCmdletCommand.cs +++ b/src/net/JNetPS/Cmdlet/JMX/GetQueryNamesCmdletCommand.cs @@ -20,6 +20,7 @@ using Javax.Management.Remote; using MASES.JNet.Specific.Extensions; using MASES.JNetPSCore.Cmdlet; +using System.Collections.Generic; using System.Management.Automation; namespace MASES.JNetPS.Cmdlet.JMX @@ -53,7 +54,7 @@ protected override void ProcessCommand() { var objects = Connector.MBeanServerConnection.QueryNames(ObjectName, Query); - WriteObject(objects.ToList()); + WriteObject(objects); } } } diff --git a/src/net/JNetPS/Cmdlet/JMX/NewObjectNameCmdletCommand.cs b/src/net/JNetPS/Cmdlet/JMX/NewObjectNameCmdletCommand.cs index d6686c76e3..d4e9c6200e 100644 --- a/src/net/JNetPS/Cmdlet/JMX/NewObjectNameCmdletCommand.cs +++ b/src/net/JNetPS/Cmdlet/JMX/NewObjectNameCmdletCommand.cs @@ -16,6 +16,7 @@ * Refer to LICENSE for more information. */ +using Java.Util; using Javax.Management; using MASES.JCOBridge.C2JBridge; using MASES.JNet.Specific.Extensions; @@ -75,7 +76,7 @@ protected override void ProcessCommand() } else if (Table != null) { - result = new ObjectName(NameOrDomain, Table.ToHashtable()); + result = new ObjectName(NameOrDomain, Table.ToJVMDictionary, Java.Lang.String, Java.Lang.String, string, string>()); } else throw new InvalidOperationException("Never been here."); From 8d13df1671e0b1e79ae3f4f0b064433cae1df61c Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Fri, 23 Feb 2024 20:45:47 +0100 Subject: [PATCH 3/9] Test upgrade --- tests/net/JNetTest/Program.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/net/JNetTest/Program.cs b/tests/net/JNetTest/Program.cs index a6782e1b7a..1156d77456 100644 --- a/tests/net/JNetTest/Program.cs +++ b/tests/net/JNetTest/Program.cs @@ -23,6 +23,7 @@ using Java.Lang; using MASES.JCOBridge.C2JBridge; using System.Threading.Tasks; +using System.Linq; namespace MASES.JNetTest { @@ -52,6 +53,7 @@ static void Main(string[] args) } catch (System.Exception ex) { System.Console.WriteLine(ex.Message); } + TestSimpleOperatorsExtension("a", "b", "c"); TestOperators(); TestIterator(); @@ -88,6 +90,20 @@ static void TestOperators() var ccc = astr + bstr; } + static void TestSimpleOperatorsExtension(params TNet[] dataInput) + where TJVM : INativeConvertible, new() + { + var jvmArray = dataInput.ToJVMArray(); + + var jvmIterable = dataInput.ToJVMCollectionType, TJVM, TNet>(); + + var netList = jvmArray.ToNetCollectionType, TNet, TJVM>(); + + TNet[] arrayNet = jvmArray.ToNetArray(); + + if (!dataInput.SequenceEqual(arrayNet)) throw new System.InvalidOperationException(); + } + static async Task TestAsyncIterator() { const int execution = 100; From 7c9ce7ff9b9c91ebffffb7cf2c1a79633a74cd64 Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Sat, 24 Feb 2024 13:47:54 +0100 Subject: [PATCH 4/9] Update extension to manage back conversion to JVM type in .NET Framework --- src/net/JNet/Developed/Java/Lang/Boolean.cs | 8 +- src/net/JNet/Developed/Java/Lang/Byte.cs | 8 +- src/net/JNet/Developed/Java/Lang/Character.cs | 8 +- src/net/JNet/Developed/Java/Lang/Double.cs | 8 +- src/net/JNet/Developed/Java/Lang/Float.cs | 8 +- src/net/JNet/Developed/Java/Lang/Integer.cs | 8 +- src/net/JNet/Developed/Java/Lang/Long.cs | 8 +- src/net/JNet/Developed/Java/Lang/Short.cs | 8 +- src/net/JNet/Developed/Java/Lang/String.cs | 8 +- .../Specific/Extensions/JavaUtilExtensions.cs | 98 ++++++++++++++----- tests/net/JNetTest/Program.cs | 9 +- 11 files changed, 130 insertions(+), 49 deletions(-) diff --git a/src/net/JNet/Developed/Java/Lang/Boolean.cs b/src/net/JNet/Developed/Java/Lang/Boolean.cs index 256531bd68..35c47b049a 100644 --- a/src/net/JNet/Developed/Java/Lang/Boolean.cs +++ b/src/net/JNet/Developed/Java/Lang/Boolean.cs @@ -28,8 +28,12 @@ bool INativeConvertible.ToCLR() { return BooleanValue(); } - - Boolean INativeConvertible.ToJVM(bool clrValue) + /// + /// Returns the from the instance + /// + /// The of CLR + /// The converted + public static Boolean ToJVM(bool clrValue) { return ValueOf(clrValue); } diff --git a/src/net/JNet/Developed/Java/Lang/Byte.cs b/src/net/JNet/Developed/Java/Lang/Byte.cs index d5dd22272a..c2c28b5cab 100644 --- a/src/net/JNet/Developed/Java/Lang/Byte.cs +++ b/src/net/JNet/Developed/Java/Lang/Byte.cs @@ -28,8 +28,12 @@ byte INativeConvertible.ToCLR() { return ByteValue(); } - - Byte INativeConvertible.ToJVM(byte clrValue) + /// + /// Returns the from the instance + /// + /// The of CLR + /// The converted + public static Byte ToJVM(byte clrValue) { return ValueOf(clrValue); } diff --git a/src/net/JNet/Developed/Java/Lang/Character.cs b/src/net/JNet/Developed/Java/Lang/Character.cs index 2b7c523090..77e48eef37 100644 --- a/src/net/JNet/Developed/Java/Lang/Character.cs +++ b/src/net/JNet/Developed/Java/Lang/Character.cs @@ -28,8 +28,12 @@ char INativeConvertible.ToCLR() { return CharValue(); } - - Character INativeConvertible.ToJVM(char clrValue) + /// + /// Returns the from the instance + /// + /// The of CLR + /// The converted + public static Character ToJVM(char clrValue) { return ValueOf(clrValue); } diff --git a/src/net/JNet/Developed/Java/Lang/Double.cs b/src/net/JNet/Developed/Java/Lang/Double.cs index 9d8be71157..62d348cac5 100644 --- a/src/net/JNet/Developed/Java/Lang/Double.cs +++ b/src/net/JNet/Developed/Java/Lang/Double.cs @@ -28,8 +28,12 @@ double INativeConvertible.ToCLR() { return DoubleValue(); } - - Double INativeConvertible.ToJVM(double clrValue) + /// + /// Returns the from the instance + /// + /// The of CLR + /// The converted + public static Double ToJVM(double clrValue) { return ValueOf(clrValue); } diff --git a/src/net/JNet/Developed/Java/Lang/Float.cs b/src/net/JNet/Developed/Java/Lang/Float.cs index 5fce4188a9..e12fdfc2af 100644 --- a/src/net/JNet/Developed/Java/Lang/Float.cs +++ b/src/net/JNet/Developed/Java/Lang/Float.cs @@ -28,8 +28,12 @@ float INativeConvertible.ToCLR() { return FloatValue(); } - - Float INativeConvertible.ToJVM(float clrValue) + /// + /// Returns the from the instance + /// + /// The of CLR + /// The converted + public static Float ToJVM(float clrValue) { return ValueOf(clrValue); } diff --git a/src/net/JNet/Developed/Java/Lang/Integer.cs b/src/net/JNet/Developed/Java/Lang/Integer.cs index 56bfa51b46..42e1a9d004 100644 --- a/src/net/JNet/Developed/Java/Lang/Integer.cs +++ b/src/net/JNet/Developed/Java/Lang/Integer.cs @@ -28,8 +28,12 @@ int INativeConvertible.ToCLR() { return IntValue(); } - - Integer INativeConvertible.ToJVM(int clrValue) + /// + /// Returns the from the instance + /// + /// The of CLR + /// The converted + public static Integer ToJVM(int clrValue) { return ValueOf(clrValue); } diff --git a/src/net/JNet/Developed/Java/Lang/Long.cs b/src/net/JNet/Developed/Java/Lang/Long.cs index b4d809edd6..3b00771a16 100644 --- a/src/net/JNet/Developed/Java/Lang/Long.cs +++ b/src/net/JNet/Developed/Java/Lang/Long.cs @@ -28,8 +28,12 @@ long INativeConvertible.ToCLR() { return LongValue(); } - - Long INativeConvertible.ToJVM(long clrValue) + /// + /// Returns the from the instance + /// + /// The of CLR + /// The converted + public static Long ToJVM(long clrValue) { return ValueOf(clrValue); } diff --git a/src/net/JNet/Developed/Java/Lang/Short.cs b/src/net/JNet/Developed/Java/Lang/Short.cs index a5178d3b8f..2103ec2567 100644 --- a/src/net/JNet/Developed/Java/Lang/Short.cs +++ b/src/net/JNet/Developed/Java/Lang/Short.cs @@ -28,8 +28,12 @@ short INativeConvertible.ToCLR() { return ShortValue(); } - - Short INativeConvertible.ToJVM(short clrValue) + /// + /// Returns the from the instance + /// + /// The of CLR + /// The converted + public static Short ToJVM(short clrValue) { return ValueOf(clrValue); } diff --git a/src/net/JNet/Developed/Java/Lang/String.cs b/src/net/JNet/Developed/Java/Lang/String.cs index 6ffa550f16..10e7d23685 100644 --- a/src/net/JNet/Developed/Java/Lang/String.cs +++ b/src/net/JNet/Developed/Java/Lang/String.cs @@ -81,8 +81,12 @@ string INativeConvertible.ToCLR() { return ToString(); } - - String INativeConvertible.ToJVM(string clrValue) + /// + /// Returns the from the instance + /// + /// The of CLR + /// The converted + public static String ToJVM(string clrValue) { return clrValue != null ? new Java.Lang.String(clrValue) : null; } diff --git a/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs b/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs index 23f71397d8..012bf1fa94 100644 --- a/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs +++ b/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs @@ -35,12 +35,14 @@ public interface INativeConvertible /// /// The converted TNetType ToCLR(); +#if !NET462_OR_GREATER /// /// Returns the from the instance /// /// The of CLR /// The converted - TJVMType ToJVM(TNetType clrValue); + abstract static TJVMType ToJVM(TNetType clrValue); +#endif } /// @@ -48,6 +50,14 @@ public interface INativeConvertible /// public static class JavaUtilExtensions { +#if NET462_OR_GREATER + const string ToJVMMethod = "ToJVM"; + + static Func GetToJVMMethod() + { + return (Func)typeof(TJVMType).GetMethod(ToJVMMethod, new Type[] { typeof(TNetType) }).CreateDelegate(typeof(Func)); + } +#endif #region List Extensions /// /// Converts an of to an of @@ -95,12 +105,20 @@ public static TIterableType ToJVMCollectionType, new() where TJVMTypeInner : INativeConvertible, new() { - TJVMTypeInner inner = default; - if (func == null) inner = new TJVMTypeInner(); +#if NET462_OR_GREATER + if (func == null) + { + func = GetToJVMMethod(); + } +#endif var tInstance = new TIterableType(); foreach (var item in set) { - tInstance.Add(func != null ? func(item) : inner.ToJVM(item)); +#if NET462_OR_GREATER + tInstance.Add(func(item)); +#else + tInstance.Add(func != null ? func(item) : TJVMTypeInner.ToJVM(item)); +#endif } return tInstance; } @@ -126,12 +144,20 @@ public static Java.Util.Collection ToJVMCollection public static TJVMType[] ToJVMArray(this TNetType[] collection, Func func = null) where TJVMType : INativeConvertible, new() { - TJVMType inner = default; - if (func == null) inner = new TJVMType(); +#if NET462_OR_GREATER + if (func == null) + { + func = GetToJVMMethod(); + } +#endif System.Collections.Generic.List list = new(); foreach (var item in collection) { - list.Add(func != null ? func(item) : inner.ToJVM(item)); +#if NET462_OR_GREATER + list.Add(func(item)); +#else + list.Add(func != null ? func(item) : TJVMType.ToJVM(item)); +#endif } return list.ToArray(); } @@ -153,8 +179,8 @@ public static TJVMType[] ToJVMArray(this TNetType[] collecti /// The public static TDictionaryType ToNetDictiony(this Map map, Func keyConverter = null, Func valueConverter = null) where TDictionaryType : IDictionary, new() - where TJVMK : INativeConvertible, new() - where TJVMV : INativeConvertible, new() + where TJVMK : INativeConvertible + where TJVMV : INativeConvertible { if (map == null) throw new ArgumentNullException(nameof(map)); var tInstance = new TDictionaryType(); @@ -178,8 +204,8 @@ public static TDictionaryType ToNetDictiony /// The /// The public static IDictionary ToNetDictiony(this Map map, Func keyConverter = null, Func valueConverter = null) - where TJVMK : INativeConvertible, new() - where TJVMV : INativeConvertible, new() + where TJVMK : INativeConvertible + where TJVMV : INativeConvertible { return ToNetDictiony, K, V, TJVMK, TJVMV>(map, keyConverter, valueConverter); } @@ -198,18 +224,28 @@ public static IDictionary ToNetDictiony(this MapThe public static TMapType ToJVMMap(this IDictionary dictionary, Func keyConverter = null, Func valueConverter = null) where TMapType : Java.Util.Map, new() - where TJVMK : INativeConvertible, new() - where TJVMV : INativeConvertible, new() + where TJVMK : INativeConvertible + where TJVMV : INativeConvertible { +#if NET462_OR_GREATER + if (keyConverter == null) + { + keyConverter = GetToJVMMethod(); + } + if (valueConverter == null) + { + valueConverter = GetToJVMMethod(); + } +#endif if (dictionary == null) throw new ArgumentNullException(nameof(dictionary)); - TJVMK innerK = default; - TJVMV innerV = default; - if (keyConverter == null) innerK = new TJVMK(); - if (valueConverter == null) innerV = new TJVMV(); var tInstance = new TMapType(); foreach (var item in dictionary) { - tInstance.Put(keyConverter != null ? keyConverter(item.Key) : innerK.ToJVM(item.Key), valueConverter != null ? valueConverter(item.Value) : innerV.ToJVM(item.Value)); +#if NET462_OR_GREATER + tInstance.Put(keyConverter(item.Key), valueConverter(item.Value)); +#else + tInstance.Put(keyConverter != null ? keyConverter(item.Key) : TJVMK.ToJVM(item.Key), valueConverter != null ? valueConverter(item.Value) : TJVMV.ToJVM(item.Value)); +#endif } return tInstance; } @@ -252,18 +288,28 @@ public static Map ToJVMMap(this IDictionaryThe public static TDictionaryType ToJVMDictionary(this IDictionary dictionary, Func keyConverter = null, Func valueConverter = null) where TDictionaryType : Java.Util.Dictionary, new() - where TJVMK : INativeConvertible, new() - where TJVMV : INativeConvertible, new() + where TJVMK : INativeConvertible + where TJVMV : INativeConvertible { +#if NET462_OR_GREATER + if (keyConverter == null) + { + keyConverter = GetToJVMMethod(); + } + if (valueConverter == null) + { + valueConverter = GetToJVMMethod(); + } +#endif if (dictionary == null) throw new ArgumentNullException(nameof(dictionary)); - TJVMK innerK = default; - TJVMV innerV = default; - if (keyConverter == null) innerK = new TJVMK(); - if (valueConverter == null) innerV = new TJVMV(); var tInstance = new TDictionaryType(); foreach (var item in dictionary) { - tInstance.Put(keyConverter != null ? keyConverter(item.Key) : innerK.ToJVM(item.Key), valueConverter != null ? valueConverter(item.Value) : innerV.ToJVM(item.Value)); +#if NET462_OR_GREATER + tInstance.Put(keyConverter(item.Key), valueConverter(item.Value)); +#else + tInstance.Put(keyConverter != null ? keyConverter(item.Key) : TJVMK.ToJVM(item.Key), valueConverter != null ? valueConverter(item.Value) : TJVMV.ToJVM(item.Value)); +#endif } return tInstance; } @@ -292,6 +338,6 @@ public static Java.Util.Dictionary ToJVMDictionary("a", "b", "c"); TestOperators(); + TestExtensions(); TestIterator(); TestAsyncIterator().Wait(); - - TestExtensions(); } static void TestOperators() @@ -99,7 +98,7 @@ static void TestSimpleOperatorsExtension(params TNet[] dataInput) var netList = jvmArray.ToNetCollectionType, TNet, TJVM>(); - TNet[] arrayNet = jvmArray.ToNetArray(); + TNet[] arrayNet = jvmIterable.ToNetArray(); if (!dataInput.SequenceEqual(arrayNet)) throw new System.InvalidOperationException(); } @@ -150,8 +149,8 @@ static void TestExtensions() dict.Add("true", true); dict.Add("false", false); dict.Add("true2", true); - var map = dict.ToMap(); - var newDict = map.ToDictiony(); + var map = dict.ToJVMMap, Java.Lang.String, Java.Lang.Boolean, string, bool>(); + var newDict = map.ToNetDictiony(); const int execution = 10000; Stopwatch w = Stopwatch.StartNew(); From 60f95c13815d516244c8fee26d5a933257db5b78 Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Sat, 24 Feb 2024 14:17:27 +0100 Subject: [PATCH 5/9] Fix issue in Docker --- src/net/Common/Common.props | 1 + .../Specific/Extensions/JavaUtilExtensions.cs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/net/Common/Common.props b/src/net/Common/Common.props index 5f398c275a..ba38a6059c 100644 --- a/src/net/Common/Common.props +++ b/src/net/Common/Common.props @@ -25,6 +25,7 @@ net462;net6.0;net7.0;net8.0 + $(DefineConstants);JNET_DOCKER_BUILD_ACTIONS false net6.0 diff --git a/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs b/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs index 012bf1fa94..b8095f9d94 100644 --- a/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs +++ b/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs @@ -50,7 +50,7 @@ public interface INativeConvertible /// public static class JavaUtilExtensions { -#if NET462_OR_GREATER +#if NET462_OR_GREATER || JNET_DOCKER_BUILD_ACTIONS const string ToJVMMethod = "ToJVM"; static Func GetToJVMMethod() @@ -105,7 +105,7 @@ public static TIterableType ToJVMCollectionType, new() where TJVMTypeInner : INativeConvertible, new() { -#if NET462_OR_GREATER +#if NET462_OR_GREATER || JNET_DOCKER_BUILD_ACTIONS if (func == null) { func = GetToJVMMethod(); @@ -144,7 +144,7 @@ public static Java.Util.Collection ToJVMCollection public static TJVMType[] ToJVMArray(this TNetType[] collection, Func func = null) where TJVMType : INativeConvertible, new() { -#if NET462_OR_GREATER +#if NET462_OR_GREATER || JNET_DOCKER_BUILD_ACTIONS if (func == null) { func = GetToJVMMethod(); @@ -153,7 +153,7 @@ public static TJVMType[] ToJVMArray(this TNetType[] collecti System.Collections.Generic.List list = new(); foreach (var item in collection) { -#if NET462_OR_GREATER +#if NET462_OR_GREATER || JNET_DOCKER_BUILD_ACTIONS list.Add(func(item)); #else list.Add(func != null ? func(item) : TJVMType.ToJVM(item)); @@ -227,7 +227,7 @@ public static TMapType ToJVMMap(this IDictionary where TJVMV : INativeConvertible { -#if NET462_OR_GREATER +#if NET462_OR_GREATER || JNET_DOCKER_BUILD_ACTIONS if (keyConverter == null) { keyConverter = GetToJVMMethod(); @@ -241,7 +241,7 @@ public static TMapType ToJVMMap(this IDictionary where TJVMV : INativeConvertible { -#if NET462_OR_GREATER +#if NET462_OR_GREATER || JNET_DOCKER_BUILD_ACTIONS if (keyConverter == null) { keyConverter = GetToJVMMethod(); @@ -305,7 +305,7 @@ public static TDictionaryType ToJVMDictionary Date: Sat, 24 Feb 2024 14:27:23 +0100 Subject: [PATCH 6/9] Missing check --- src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs b/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs index b8095f9d94..a7ef188c22 100644 --- a/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs +++ b/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs @@ -35,7 +35,7 @@ public interface INativeConvertible /// /// The converted TNetType ToCLR(); -#if !NET462_OR_GREATER +#if !NET462_OR_GREATER || JNET_DOCKER_BUILD_ACTIONS /// /// Returns the from the instance /// From c49e56b252c4eb22427b1984bfa64a8f3fc739fd Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Sat, 24 Feb 2024 15:43:35 +0100 Subject: [PATCH 7/9] Other fix --- src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs b/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs index a7ef188c22..f4878f33cc 100644 --- a/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs +++ b/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs @@ -35,7 +35,7 @@ public interface INativeConvertible /// /// The converted TNetType ToCLR(); -#if !NET462_OR_GREATER || JNET_DOCKER_BUILD_ACTIONS +#if !(NET462_OR_GREATER || JNET_DOCKER_BUILD_ACTIONS) /// /// Returns the from the instance /// From e2d2aeb49f989cfe4bf0f9cba15a07ed8f957224 Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Sat, 24 Feb 2024 15:53:14 +0100 Subject: [PATCH 8/9] fix --- src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs b/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs index f4878f33cc..b438e6698c 100644 --- a/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs +++ b/src/net/JNet/Specific/Extensions/JavaUtilExtensions.cs @@ -114,7 +114,7 @@ public static TIterableType ToJVMCollectionType Date: Thu, 29 Feb 2024 16:59:40 +0100 Subject: [PATCH 9/9] Test fix --- tests/net/JNetTest/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/net/JNetTest/Program.cs b/tests/net/JNetTest/Program.cs index 930402fb98..f1b29aecb6 100644 --- a/tests/net/JNetTest/Program.cs +++ b/tests/net/JNetTest/Program.cs @@ -169,7 +169,7 @@ static void TestIterator() static void TestExtensions() { - System.Collections.Generic.Dictionary dict = new(); + System.Collections.Generic.Dictionary dict = new(); dict.Add("true", true); dict.Add("false", false); dict.Add("true2", true);