public static string GetCodeSourceLocation() { var f = default(FileInfo); try { // Error 40 The call is ambiguous between the following methods or properties: 'ScriptCoreLibJava.Extensions.BCLImplementationExtensions.ToClass(System.Type)' and 'ScriptCoreLibJava.Extensions.BCLImplementationExtensions.ToClass(System.Type)' X:\jsc.svn\core\ScriptCoreLib.Ultra\ScriptCoreLib.Ultra\Java\Interop\CodeSourceLocationProvider.cs 22 27 ScriptCoreLib.Ultra var cls = BCLImplementationExtensions.ToClass(typeof(CodeSourceLocationProvider)); ProtectionDomain pDomain = cls.getProtectionDomain(); CodeSource cSource = pDomain.getCodeSource(); URL loc = cSource.getLocation(); var ff = loc.getFile(); var prefix = "file:/"; if (prefix == ff.Substring(0, prefix.Length)) { ff = ff.Substring(prefix.Length); } f = new FileInfo(ff); } catch { throw new NotSupportedException(); } return(f.FullName); }
// https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201403/20140322 public static Type GetType(this InternalURLClassLoader loader, string TypeFullName) { var c = default(Class); try { c = loader.loadClass(TypeFullName); } catch (jvm::csharp.ThrowableException ex) { Console.WriteLine(ex.Message); Console.WriteLine("error: Unable to load: " + TypeFullName); ((jvm::java.lang.Throwable)(object) ex).printStackTrace(); throw new InvalidOperationException(); } return(BCLImplementationExtensions.ToType(c)); }