public static string colorToString(Color c) { try { foreach (Field field in (PaintUtilities.class\u0024java\u0024awt\u0024Color != null ? PaintUtilities.class\u0024java\u0024awt\u0024Color : (PaintUtilities.class\u0024java\u0024awt\u0024Color = PaintUtilities.class\u0024("java.awt.Color"))).getFields(PaintUtilities.__\u003CGetCallerID\u003E())) { if (Modifier.isPublic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && Modifier.isStatic(field.getModifiers())) { string name = field.getName(); object obj = field.get((object) null, PaintUtilities.__\u003CGetCallerID\u003E()); if (obj is Color && c.equals(obj)) return name; } } goto label_9; } catch (Exception ex) { int num = 2; if (ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num) == null) throw; } label_9: string str = Integer.toHexString(c.getRGB() & 16777215); StringBuffer stringBuffer = new StringBuffer(7); stringBuffer.append("#"); int num1 = 6 - String.instancehelper_length(str); for (int index = 0; index < num1; ++index) stringBuffer.append("0"); stringBuffer.append(str); return stringBuffer.toString(); }
public virtual void load(string resourceName, Class resourceSource) { InputStream relativeAsStream = ObjectUtilities.getResourceRelativeAsStream(resourceName, resourceSource); if (relativeAsStream != null) { // ISSUE: fault handler try { this.load(relativeAsStream); } __fault { try { relativeAsStream.close(); goto label_5; } catch (IOException exception_1) { } label_5:; } try { relativeAsStream.close(); } catch (IOException ex) { } } else Log.debug((object) new StringBuffer().append("Configuration file not found in the classpath: ").append(resourceName).toString()); }
public static ClassLoader getClassLoader(Class c) { Class @class; Monitor.Enter((object) (@class = ObjectUtilities.class\u0024org\u0024jfree\u0024util\u0024ObjectUtilities != null ? ObjectUtilities.class\u0024org\u0024jfree\u0024util\u0024ObjectUtilities : (ObjectUtilities.class\u0024org\u0024jfree\u0024util\u0024ObjectUtilities = ObjectUtilities.class\u0024("org.jfree.util.ObjectUtilities")))); string str; // ISSUE: fault handler try { if (ObjectUtilities.classLoader != null) { ClassLoader classLoader = ObjectUtilities.classLoader; Monitor.Exit((object) @class); return classLoader; } else { str = ObjectUtilities.classLoaderSource; Monitor.Exit((object) @class); } } __fault { Monitor.Exit((object) @class); } if (String.instancehelper_equals("ThreadContext", (object) str)) { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); if (contextClassLoader != null) return contextClassLoader; } return c.getClassLoader(ObjectUtilities.__\u003CGetCallerID\u003E()) ?? ClassLoader.getSystemClassLoader(ObjectUtilities.__\u003CGetCallerID\u003E()); }
protected internal virtual void validatePublicVoidNoArgMethods(Class annotation, bool isStatic, List errors) { int num = isStatic ? 1 : 0; Iterator iterator = this.getTestClass().getAnnotatedMethods(annotation).iterator(); while (iterator.hasNext()) ((FrameworkMethod) iterator.next()).validatePublicVoidNoArg(num != 0, errors); }
public TestSuite(Class theClass) { base.\u002Ector(); TestSuite testSuite = this; this.fTests = new Vector(10); this.addTestsFromTestCase(theClass); }
public DynamicTimeSeriesCollection(int nSeries, int nMoments, RegularTimePeriod timeSample, TimeZone zone) { DynamicTimeSeriesCollection seriesCollection = this; this.maximumItemCount = 2000; this.timePeriodClass = DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Minute != null ? DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Minute : (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Minute = DynamicTimeSeriesCollection.class\u0024("org.jfree.data.time.Minute")); this.minValue = new Float(0.0f); this.maxValue = (Float) null; this.maximumItemCount = nMoments; this.historyCount = nMoments; this.seriesKeys = new IComparable[nSeries]; for (int index = 0; index < nSeries; ++index) this.seriesKeys[index] = (IComparable) ""; this.newestAt = nMoments - 1; this.valueHistory = new DynamicTimeSeriesCollection.ValueSequence[nSeries]; this.timePeriodClass = Object.instancehelper_getClass((object) timeSample); if (this.timePeriodClass == (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Second != null ? DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Second : (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Second = DynamicTimeSeriesCollection.class\u0024("org.jfree.data.time.Second")))) this.pointsInTime = (RegularTimePeriod[]) new Second[nMoments]; else if (this.timePeriodClass == (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Minute != null ? DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Minute : (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Minute = DynamicTimeSeriesCollection.class\u0024("org.jfree.data.time.Minute")))) this.pointsInTime = (RegularTimePeriod[]) new Minute[nMoments]; else if (this.timePeriodClass == (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Hour != null ? DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Hour : (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Hour = DynamicTimeSeriesCollection.class\u0024("org.jfree.data.time.Hour")))) this.pointsInTime = (RegularTimePeriod[]) new Hour[nMoments]; this.workingCalendar = Calendar.getInstance(zone); this.position = 0; this.domainIsPointsInTime = true; }
private EnumCreatureType(string s, int i, Class class1, int j, Material material, bool flag) { creatureClass = class1; maxNumberOfCreature = j; creatureMaterial = material; field_21106_g = flag; }
public JUnit4ClassRunner(Class klass) { JUnit4ClassRunner junit4ClassRunner = this; this.fTestClass = new TestClass(klass); this.fTestMethods = this.getTestMethods(); this.validate(); }
private ParameterSignature([In] Class obj0, [In] Annotation[] obj1) { base.\u002Ector(); ParameterSignature parameterSignature = this; this.type = obj0; this.annotations = obj1; }
public DotnetBaseClassFieldExtractor(Class clazz, string fieldName) : base(null, null) { Type type = null; foreach (Assembly assem in AppDomain.CurrentDomain.GetAssemblies()) { type = assem.GetType(clazz.getName().Replace("cli.", "")); if(type != null) break; } this.fieldName = fieldName; FieldInfo[] info = type.GetFields(); string fieldType = type.GetProperty(fieldName).PropertyType.FullName; //string originalClassName = clazz.getName().Replace('.', '/'); //string className = CSClassFieldExtractorFactory.BASE_PACKAGE + "/" + originalClassName + "$" + fieldName; try { //this.index = getIndex(type, fieldName); this.index = FieldIndexGenerator.getIndex(); this.fieldType = type.GetProperty(fieldName).PropertyType; this.objectType = DotnetClassFieldExtractorFactory.getClassObjectType( this.fieldType ); } catch ( System.Exception e ) { throw new RuntimeDroolsException( e ); } }
public override Runner runnerForClass(Class testClass) { RunnerBuilder[] runnerBuilderArray = new RunnerBuilder[5]; int index1 = 0; IgnoredBuilder ignoredBuilder = this.ignoredBuilder(); runnerBuilderArray[index1] = (RunnerBuilder) ignoredBuilder; int index2 = 1; AnnotatedBuilder annotatedBuilder = this.annotatedBuilder(); runnerBuilderArray[index2] = (RunnerBuilder) annotatedBuilder; int index3 = 2; RunnerBuilder runnerBuilder = this.suiteMethodBuilder(); runnerBuilderArray[index3] = runnerBuilder; int index4 = 3; JUnit3Builder junit3Builder = this.junit3Builder(); runnerBuilderArray[index4] = (RunnerBuilder) junit3Builder; int index5 = 4; JUnit4Builder junit4Builder = this.junit4Builder(); runnerBuilderArray[index5] = (RunnerBuilder) junit4Builder; Iterator iterator = Arrays.asList((object[]) runnerBuilderArray).iterator(); while (iterator.hasNext()) { Runner runner = ((RunnerBuilder) iterator.next()).safeRunnerForClass(testClass); if (runner != null) return runner; } return (Runner) null; }
public MobSpawnerHell() { biomeMonsters = (new Class[] { typeof (EntityGhast), typeof (EntityPigZombie) }); biomeCreatures = new Class[0]; }
public java.lang.Class parseClass(java.io.File file) { java.lang.Class[] args = new java.lang.Class[] { java.lang.Class.forName("java.io.File") }; java.lang.reflect.Method parseClass = this._groovyClassLoaderClass.getMethod("parseClass", args); java.lang.Class clazz = (java.lang.Class)parseClass.invoke(this._classLoader, file); return(clazz); }
public java.lang.Class parseClass(string text) { java.lang.Class[] args = new java.lang.Class[] { java.lang.Class.forName("java.lang.String") }; java.lang.reflect.Method parseClass = this._groovyClassLoaderClass.getMethod("parseClass", args); java.lang.Class clazz = (java.lang.Class)parseClass.invoke(this._classLoader, text); return(clazz); }
public JUnit4TestAdapter(Class newTestClass, JUnit4TestAdapterCache cache) { base.\u002Ector(); JUnit4TestAdapter junit4TestAdapter = this; this.fCache = cache; this.fNewTestClass = newTestClass; this.fRunner = Request.classWithoutSuiteMethod(newTestClass).getRunner(); }
public static unsafe void Unregister(Class jvmProxy, JNIEnv env) { JNIResult res = env.UnregisterNatives(jvmProxy); if (res != JNIResult.JNI_OK) { throw new JNIException("Can't unbind native methods to class " + jvmProxy); } }
public override Runner getSuite(RunnerBuilder builder, Class[] classes) { Runner suite = base.getSuite(builder, classes); if (this.fClasses) return ParallelComputer.parallelize(suite); else return suite; }
protected internal override Runner getRunner(RunnerBuilder builder, Class testClass) { Runner runner = base.getRunner(builder, testClass); if (this.fMethods) return ParallelComputer.parallelize(runner); else return runner; }
protected internal ParentRunner(Class testClass) { ParentRunner parentRunner = this; this.fFilter = (org.junit.runner.manipulation.Filter) null; this.fSorter = Sorter.NULL; this.fScheduler = (RunnerScheduler) new ParentRunner\u00241(this); this.fTestClass = new TestClass(testClass); this.validate(); }
private PrintableResult([In] Class obj0) { Class[] classArray = new Class[1]; int index = 0; Class @class = obj0; classArray[index] = @class; // ISSUE: explicit constructor call this.\u002Ector(JUnitCore.runClasses(classArray)); }
public Parameterized(Class klass) : base(klass, Collections.emptyList()) { Parameterized parameterized = this; this.runners = new ArrayList(); List parametersList = this.getParametersList(this.getTestClass()); for (int index = 0; index < parametersList.size(); ++index) this.runners.add((object) new Parameterized.TestClassRunnerForParameters(this, this.getTestClass().getJavaClass(), parametersList, index)); }
public virtual int getCacheSize(Class cls) { SparseArray l2 = (SparseArray)sWindows.get(cls); if (l2 == null) { return 0; } return l2.size(); }
protected override string DetermineCallingFunction() { System.Exception e = new System.Exception (); java.lang.Class c = vmw.common.TypeUtils.ToClass (e); java.lang.reflect.Method m = c.getMethod ("getStackTrace", new java.lang.Class [0]); java.lang.StackTraceElement [] els = (java.lang.StackTraceElement []) m.invoke (e, new object [0]); java.lang.StackTraceElement el = els [4]; return el.getClassName () + "." + _ownerClass + "." + el.getMethodName (); }
public BlockSign(int i, Class class1, bool flag) : base(i, Material.wood) { isFreestanding = flag; blockIndexInTexture = 4; signEntityClass = class1; float f = 0.25F; float f1 = 1.0F; setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); }
public override void initialize(SubSystem subSystem) { if (LogConfiguration.isDisableLogging() || !String.instancehelper_equals(LogConfiguration.getLogTarget(), (object) (DefaultLogModule.class\u0024org\u0024jfree\u0024util\u0024PrintStreamLogTarget != null ? DefaultLogModule.class\u0024org\u0024jfree\u0024util\u0024PrintStreamLogTarget : (DefaultLogModule.class\u0024org\u0024jfree\u0024util\u0024PrintStreamLogTarget = DefaultLogModule.class\u0024("org.jfree.util.PrintStreamLogTarget"))).getName())) return; DefaultLog.installDefaultLog(); Log.getInstance().addTarget((LogTarget) new PrintStreamLogTarget()); if (String.instancehelper_equals("true", (object) subSystem.getGlobalConfig().getConfigProperty("org.jfree.base.LogAutoInit"))) Log.getInstance().init(); Log.info((object) "Default log target started ... previous log messages could have been ignored."); }
public virtual XWindow getCache(int id, Class cls) { SparseArray l2 = (SparseArray)sWindows.get(cls); if (l2 == null) { return null; } return (XWindow)l2.get(id); }
public virtual Annotation getAnnotation(Class annotationType) { Iterator iterator = this.getAnnotations().iterator(); while (iterator.hasNext()) { Annotation annotation = (Annotation) iterator.next(); if (annotationType.isInstance((object) annotation)) return (Annotation) annotationType.cast((object) annotation); } return (Annotation) null; }
static URLUtilities() { Class[] classArray = new Class[2]; int index1 = 0; Class class1 = URLUtilities.class\u0024java\u0024lang\u0024String != null ? URLUtilities.class\u0024java\u0024lang\u0024String : (URLUtilities.class\u0024java\u0024lang\u0024String = URLUtilities.class\u0024("java.lang.String")); classArray[index1] = class1; int index2 = 1; Class class2 = URLUtilities.class\u0024java\u0024lang\u0024String != null ? URLUtilities.class\u0024java\u0024lang\u0024String : (URLUtilities.class\u0024java\u0024lang\u0024String = URLUtilities.class\u0024("java.lang.String")); classArray[index2] = class2; URLUtilities.STRING_ARGS_2 = classArray; }
public virtual void addChangeListener(OverlayChangeListener listener) { if (listener == null) { string str = "Null 'listener' argument."; Throwable.__\u003CsuppressFillInStackTrace\u003E(); throw new IllegalArgumentException(str); } else this.changeListeners.add(AbstractOverlay.class\u0024org\u0024jfree\u0024chart\u0024event\u0024OverlayChangeListener != null ? AbstractOverlay.class\u0024org\u0024jfree\u0024chart\u0024event\u0024OverlayChangeListener : (AbstractOverlay.class\u0024org\u0024jfree\u0024chart\u0024event\u0024OverlayChangeListener = AbstractOverlay.class\u0024("org.jfree.chart.event.OverlayChangeListener")), (EventListener) listener); }
public virtual void putCache(int id, Class cls, XWindow window) { SparseArray l2 = (SparseArray)sWindows.get(cls); if (l2 == null) { l2 = new SparseArray(); sWindows.put(cls, l2); } l2.put(id, window); }
protected internal virtual void notifyListeners(DialLayerChangeEvent @event) { object[] listenerList = this.listenerList.getListenerList(); int index = listenerList.Length - 2; while (index >= 0) { if (listenerList[index] == (AbstractDialLayer.class\u0024org\u0024jfree\u0024chart\u0024plot\u0024dial\u0024DialLayerChangeListener != null ? AbstractDialLayer.class\u0024org\u0024jfree\u0024chart\u0024plot\u0024dial\u0024DialLayerChangeListener : (AbstractDialLayer.class\u0024org\u0024jfree\u0024chart\u0024plot\u0024dial\u0024DialLayerChangeListener = AbstractDialLayer.class\u0024("org.jfree.chart.plot.dial.DialLayerChangeListener")))) ((DialLayerChangeListener) listenerList[index + 1]).dialLayerChanged(@event); index += -2; } }
public TimeSeries(IComparable name, string domain, string range, Class timePeriodClass) : base(name) { TimeSeries timeSeries = this; this.domain = domain; this.range = range; this.timePeriodClass = timePeriodClass; this.data = (List) new ArrayList(); this.maximumItemCount = int.MaxValue; this.maximumItemAge = long.MaxValue; }
protected internal virtual void notifyListeners(OverlayChangeEvent @event) { object[] listenerList = this.changeListeners.getListenerList(); int index = listenerList.Length - 2; while (index >= 0) { if (listenerList[index] == (AbstractOverlay.class\u0024org\u0024jfree\u0024chart\u0024event\u0024OverlayChangeListener != null ? AbstractOverlay.class\u0024org\u0024jfree\u0024chart\u0024event\u0024OverlayChangeListener : (AbstractOverlay.class\u0024org\u0024jfree\u0024chart\u0024event\u0024OverlayChangeListener = AbstractOverlay.class\u0024("org.jfree.chart.event.OverlayChangeListener")))) ((OverlayChangeListener) listenerList[index + 1]).overlayChanged(@event); index += -2; } }
public override java.lang.Class[] getClasses(java.lang.Class requiredInterface) { //Console.WriteLine("looking up " + requiredInterface.getName()); List <Class> returnClasses = new List <Class>(); Type requiredType = Type.GetType(requiredInterface.getName() + ", liquibase-core"); if (requiredType == null) { Console.WriteLine("could not find required type for " + requiredInterface.getName()); return(new java.lang.Class[0]); } Assembly assembly = Assembly.GetExecutingAssembly(); foreach (Type type in assembly.GetTypes()) { //if (type.AssemblyQualifiedName.Contains("LiquiBase")) { // Console.WriteLine("type: " + type); //} if (!type.IsInterface && !type.IsAbstract && requiredType.IsAssignableFrom(type)) { //Console.WriteLine("Adding class " + type.AssemblyQualifiedName); returnClasses.Add(Class.forName(type.AssemblyQualifiedName)); } } foreach (AssemblyName refAsm in assembly.GetReferencedAssemblies()) { foreach (Type type in Assembly.Load(refAsm).GetTypes()) { //if (type.AssemblyQualifiedName.Contains("LiquiBase")) { // Console.WriteLine("type: " + type); //} if (!type.IsInterface && !type.IsAbstract && requiredType.IsAssignableFrom(type)) { //Console.WriteLine("Adding class " + type.AssemblyQualifiedName); returnClasses.Add(Class.forName(type.AssemblyQualifiedName)); } } } return(returnClasses.ToArray()); }
private java.lang.ClassLoader createClassLoader() { java.io.File[] jarFiles = this.getGroovyClasspath(); java.net.URL[] jarFilesAsURLs = new java.net.URL[jarFiles.Length]; for (int i = 0; i < jarFiles.Length; i++) { jarFilesAsURLs[i] = jarFiles[i].toURI().toURL(); } java.net.URLClassLoader urlClassLoader = new java.net.URLClassLoader(jarFilesAsURLs, java.lang.ClassLoader.getSystemClassLoader()); java.lang.Class groovyClassLoaderClass = java.lang.Class.forName("groovy.lang.GroovyClassLoader", true, urlClassLoader); java.lang.reflect.Method addClassPathMethod = groovyClassLoaderClass.getMethod("addClasspath", java.lang.Class.forName("java.lang.String")); java.lang.ClassLoader groovyClassLoader = (java.lang.ClassLoader)groovyClassLoaderClass.newInstance(); foreach (java.io.File file in jarFiles) { addClassPathMethod.invoke(groovyClassLoader, file.getAbsolutePath()); } this._groovyClassLoaderClass = groovyClassLoaderClass; return(groovyClassLoader); }
public static bool isInterface(java.lang.Class thisClass) { return(TypeWrapper.FromClass(thisClass).IsInterface); }
internal SaveAssemblyShutdownHook(java.lang.Class clazz) : base("SaveAssemblyShutdownHook") { this.clazz = clazz; }
public static void resolveClass0(java.lang.ClassLoader thisClassLoader, java.lang.Class clazz) { // no-op }
public static bool desiredAssertionStatus0(java.lang.Class clazz) { return(IKVM.Runtime.Assertions.IsEnabled(TypeWrapper.FromClass(clazz))); }
public static object multiNewArray(java.lang.Class componentType, int[] dimensions) { return(null); }
public static java.lang.Class getSuperclass(java.lang.Class thisClass) { TypeWrapper super = TypeWrapper.FromClass(thisClass).BaseTypeWrapper; return(super != null ? super.ClassObject : null); }
public static object newArray(java.lang.Class componentType, int length) { return(null); }
internal override java.lang.ClassLoader getAndCacheClassLoader() { java.lang.Class clazz = getAndCacheClass(); return(clazz == null ? null : TypeWrapper.FromClass(clazz).GetClassLoader().GetJavaClassLoader()); }
public static java.lang.Class getComponentType(java.lang.Class thisClass) { TypeWrapper tw = TypeWrapper.FromClass(thisClass); return(tw.IsArray ? tw.ElementTypeWrapper.ClassObject : null); }
static int Main(string[] args) { Tracer.EnableTraceConsoleListener(); Tracer.EnableTraceForDebug(); System.Collections.Hashtable props = new System.Collections.Hashtable(); string classpath = Environment.GetEnvironmentVariable("CLASSPATH"); if (classpath == null || classpath == "") { classpath = "."; } props["java.class.path"] = classpath; bool jar = false; bool saveAssembly = false; bool saveAssemblyX = false; bool waitOnExit = false; bool showVersion = false; string mainClass = null; int vmargsIndex = -1; bool debug = false; String debugArg = null; bool noglobbing = false; for (int i = 0; i < args.Length; i++) { String arg = args[i]; if (arg[0] == '-') { if (arg == "-help" || arg == "-?") { PrintHelp(); return(1); } else if (arg == "-X") { PrintXHelp(); return(1); } else if (arg == "-Xsave") { saveAssembly = true; IKVM.Internal.Starter.PrepareForSaveDebugImage(); } else if (arg == "-XXsave") { saveAssemblyX = true; IKVM.Internal.Starter.PrepareForSaveDebugImage(); } else if (arg == "-Xtime") { new Timer(); } else if (arg == "-Xwait") { waitOnExit = true; } else if (arg == "-Xbreak") { System.Diagnostics.Debugger.Break(); } else if (arg == "-Xnoclassgc") { IKVM.Internal.Starter.ClassUnloading = false; } else if (arg == "-Xverify") { IKVM.Internal.Starter.RelaxedVerification = false; } else if (arg == "-jar") { jar = true; } else if (arg == "-version") { Console.WriteLine(Startup.getVersionAndCopyrightInfo()); Console.WriteLine(); Console.WriteLine("CLR version: {0} ({1} bit)", Environment.Version, IntPtr.Size * 8); System.Type type = System.Type.GetType("Mono.Runtime"); if (type != null) { Console.WriteLine("Mono version: {0}", type.InvokeMember("GetDisplayName", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.NonPublic, null, null, new object[0])); } foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) { Console.WriteLine("{0}: {1}", asm.GetName().Name, asm.GetName().Version); } string ver = java.lang.System.getProperty("openjdk.version"); if (ver != null) { Console.WriteLine("OpenJDK version: {0}", ver); } return(0); } else if (arg == "-showversion") { showVersion = true; } else if (arg.StartsWith("-D")) { arg = arg.Substring(2); string[] keyvalue = arg.Split('='); string value; if (keyvalue.Length == 2) // -Dabc=x { value = keyvalue[1]; } else if (keyvalue.Length == 1) // -Dabc { value = ""; } else // -Dabc=x=y { value = arg.Substring(keyvalue[0].Length + 1); } props[keyvalue[0]] = value; } else if (arg == "-ea" || arg == "-enableassertions") { IKVM.Runtime.Assertions.EnableAssertions(); } else if (arg == "-da" || arg == "-disableassertions") { IKVM.Runtime.Assertions.DisableAssertions(); } else if (arg == "-esa" || arg == "-enablesystemassertions") { IKVM.Runtime.Assertions.EnableSystemAssertions(); } else if (arg == "-dsa" || arg == "-disablesystemassertions") { IKVM.Runtime.Assertions.DisableSystemAssertions(); } else if (arg.StartsWith("-ea:") || arg.StartsWith("-enableassertions:")) { IKVM.Runtime.Assertions.EnableAssertions(arg.Substring(arg.IndexOf(':') + 1)); } else if (arg.StartsWith("-da:") || arg.StartsWith("-disableassertions:")) { IKVM.Runtime.Assertions.DisableAssertions(arg.Substring(arg.IndexOf(':') + 1)); } else if (arg == "-cp" || arg == "-classpath") { props["java.class.path"] = args[++i]; } else if (arg.StartsWith("-Xtrace:")) { Tracer.SetTraceLevel(arg.Substring(8)); } else if (arg.StartsWith("-Xmethodtrace:")) { Tracer.HandleMethodTrace(arg.Substring(14)); } else if (arg == "-Xdebug") { debug = true; } else if (arg == "-Xnoagent") { //ignore it, disable support for oldjdb } else if (arg.StartsWith("-Xrunjdwp") || arg.StartsWith("-agentlib:jdwp")) { debugArg = arg; debug = true; } else if (arg.StartsWith("-Xreference:")) { Startup.addBootClassPathAssembly(Assembly.LoadFrom(arg.Substring(12))); } else if (arg == "-Xnoglobbing") { noglobbing = true; } else if (arg == "-XX:+AllowNonVirtualCalls") { IKVM.Internal.Starter.AllowNonVirtualCalls = true; } else if (arg.StartsWith("-Xms") || arg.StartsWith("-Xmx") || arg.StartsWith("-Xmn") || arg.StartsWith("-Xss") || arg.StartsWith("-XX:") || arg == "-Xmixed" || arg == "-Xint" || arg == "-Xincgc" || arg == "-Xbatch" || arg == "-Xfuture" || arg == "-Xrs" || arg == "-Xcheck:jni" || arg == "-Xshare:off" || arg == "-Xshare:auto" || arg == "-Xshare:on" ) { Console.Error.WriteLine("Unsupported option ignored: {0}", arg); } else if (arg.StartsWith("-Xoptimize:")) { try{ Helper.optpasses = (int)Convert.ToUInt32(arg.Replace("-Xoptimize:", "")); } catch { Console.Error.WriteLine("SORRY, IKVM.NET experimental optimizations disabled, reason: negative or invalid number of optimization passes."); } } else if (arg == "-Xextremeoptimize") { Helper.extremeOptimizations = true; } else if (arg == "-Xpreoptimize") { Helper.enableJITPreOptimization = true; } else { Console.Error.WriteLine("{0}: illegal argument", arg); break; } } else { mainClass = arg; vmargsIndex = i + 1; break; } } if (mainClass == null || showVersion) { Console.Error.WriteLine(Startup.getVersionAndCopyrightInfo()); Console.Error.WriteLine(); } if (mainClass == null) { PrintHelp(); return(1); } try { if (debug) { // Starting the debugger Assembly asm = Assembly.GetExecutingAssembly(); String arguments = debugArg + " -pid:" + System.Diagnostics.Process.GetCurrentProcess().Id; String program = new FileInfo(asm.Location).DirectoryName + "\\debugger.exe"; try { ProcessStartInfo info = new ProcessStartInfo(program, arguments); info.UseShellExecute = false; Process debugger = new Process(); debugger.StartInfo = info; debugger.Start(); } catch (Exception ex) { Console.Error.WriteLine(program + " " + arguments); throw ex; } } if (jar) { props["java.class.path"] = mainClass; } // like the JDK we don't quote the args (even if they contain spaces) props["sun.java.command"] = String.Join(" ", args, vmargsIndex - 1, args.Length - (vmargsIndex - 1)); props["sun.java.launcher"] = "SUN_STANDARD"; Startup.setProperties(props); Startup.enterMainThread(); string[] vmargs; if (noglobbing) { vmargs = new string[args.Length - vmargsIndex]; System.Array.Copy(args, vmargsIndex, vmargs, 0, vmargs.Length); } else { // Startup.glob() uses Java code, so we need to do this after we've initialized vmargs = Startup.glob(args, vmargsIndex); } try { java.lang.Class clazz = sun.launcher.LauncherHelper.checkAndLoadMain(true, jar ? 2 : 1, mainClass); // we don't need to do any checking on the main method, as that was already done by checkAndLoadMain Method method = clazz.getMethod("main", typeof(string[])); // if clazz isn't public, we can still call main method.setAccessible(true); if (saveAssembly) { java.lang.Runtime.getRuntime().addShutdownHook(new SaveAssemblyShutdownHook(clazz)); } if (waitOnExit) { java.lang.Runtime.getRuntime().addShutdownHook(new WaitShutdownHook()); } try { method.invoke(null, new object[] { vmargs }); return(0); } catch (InvocationTargetException x) { throw x.getCause(); } } finally { if (saveAssemblyX) { IKVM.Internal.Starter.SaveDebugImage(); } } } catch (System.Exception x) { java.lang.Thread thread = java.lang.Thread.currentThread(); thread.getThreadGroup().uncaughtException(thread, ikvm.runtime.Util.mapException(x)); } finally { Startup.exitMainThread(); } return(1); }
static int Main(string[] args) { Tracer.EnableTraceConsoleListener(); Tracer.EnableTraceForDebug(); System.Collections.Hashtable props = new System.Collections.Hashtable(); string classpath = Environment.GetEnvironmentVariable("CLASSPATH"); if (classpath == null || classpath == "") { classpath = "."; } props["java.class.path"] = classpath; bool jar = false; bool saveAssembly = false; bool saveAssemblyX = false; bool waitOnExit = false; bool showVersion = false; string mainClass = null; int vmargsIndex = -1; bool debug = false; String debugArg = null; for (int i = 0; i < args.Length; i++) { String arg = args[i]; if (arg[0] == '-') { if (arg == "-help" || arg == "-?") { break; } else if (arg == "-Xsave") { saveAssembly = true; IKVM.Internal.Starter.PrepareForSaveDebugImage(); } else if (arg == "-XXsave") { saveAssemblyX = true; IKVM.Internal.Starter.PrepareForSaveDebugImage(); } else if (arg == "-Xtime") { new Timer(); } else if (arg == "-Xwait") { waitOnExit = true; } else if (arg == "-Xbreak") { System.Diagnostics.Debugger.Break(); } else if (arg == "-Xnoclassgc") { IKVM.Internal.Starter.ClassUnloading = false; } else if (arg == "-jar") { jar = true; } else if (arg == "-version") { Console.WriteLine(Startup.getVersionAndCopyrightInfo()); Console.WriteLine(); Console.WriteLine("CLR version: {0} ({1} bit)", Environment.Version, IntPtr.Size * 8); System.Type type = System.Type.GetType("Mono.Runtime"); if (type != null) { Console.WriteLine("Mono version: {0}", type.InvokeMember("GetDisplayName", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.NonPublic, null, null, new object[0])); } foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) { Console.WriteLine("{0}: {1}", asm.GetName().Name, asm.GetName().Version); } string ver = java.lang.System.getProperty("openjdk.version"); if (ver != null) { Console.WriteLine("OpenJDK version: {0}", ver); } return(0); } else if (arg == "-showversion") { showVersion = true; } else if (arg.StartsWith("-D")) { string[] keyvalue = args[i].Substring(2).Split('='); if (keyvalue.Length != 2) { keyvalue = new string[] { keyvalue[0], "" }; } props[keyvalue[0]] = keyvalue[1]; } else if (arg == "-ea" || arg == "-enableassertions") { IKVM.Runtime.Assertions.EnableAssertions(); } else if (arg == "-da" || arg == "-disableassertions") { IKVM.Runtime.Assertions.DisableAssertions(); } else if (arg == "-esa" || arg == "-enablesystemassertions") { IKVM.Runtime.Assertions.EnableSystemAssertions(); } else if (arg == "-dsa" || arg == "-disablesystemassertions") { IKVM.Runtime.Assertions.DisableSystemAssertions(); } else if (arg.StartsWith("-ea:") || arg.StartsWith("-enableassertions:")) { IKVM.Runtime.Assertions.EnableAssertions(arg.Substring(arg.IndexOf(':') + 1)); } else if (arg.StartsWith("-da:") || arg.StartsWith("-disableassertions:")) { IKVM.Runtime.Assertions.DisableAssertions(arg.Substring(arg.IndexOf(':') + 1)); } else if (arg == "-cp" || arg == "-classpath") { props["java.class.path"] = args[++i]; } else if (arg.StartsWith("-Xtrace:")) { Tracer.SetTraceLevel(arg.Substring(8)); } else if (arg.StartsWith("-Xmethodtrace:")) { Tracer.HandleMethodTrace(arg.Substring(14)); } else if (arg == "-Xdebug") { debug = true; } else if (arg == "-Xnoagent") { //ignore it, disable support for oldjdb } else if (arg.StartsWith("-Xrunjdwp") || arg.StartsWith("-agentlib:jdwp")) { debugArg = arg; debug = true; } else if (arg.StartsWith("-Xms") || arg.StartsWith("-Xmx") || arg.StartsWith("-Xss") || arg == "-Xmixed" || arg == "-Xint" || arg == "-Xnoclassgc" || arg == "-Xincgc" || arg == "-Xbatch" || arg == "-Xfuture" || arg == "-Xrs" || arg == "-Xcheck:jni" || arg == "-Xshare:off" || arg == "-Xshare:auto" || arg == "-Xshare:on" ) { Console.Error.WriteLine("Unsupported option ignored: {0}", arg); } else { Console.Error.WriteLine("{0}: illegal argument", arg); break; } } else { mainClass = arg; vmargsIndex = i + 2; break; } } if (mainClass == null || showVersion) { Console.Error.WriteLine(Startup.getVersionAndCopyrightInfo()); Console.Error.WriteLine(); } if (mainClass == null) { Console.Error.WriteLine("usage: ikvm [-options] <class> [args...]"); Console.Error.WriteLine(" (to execute a class)"); Console.Error.WriteLine(" or ikvm -jar [-options] <jarfile> [args...]"); Console.Error.WriteLine(" (to execute a jar file)"); Console.Error.WriteLine(); Console.Error.WriteLine("where options include:"); Console.Error.WriteLine(" -? -help Display this message"); Console.Error.WriteLine(" -version Display IKVM and runtime version"); Console.Error.WriteLine(" -showversion Display version and continue running"); Console.Error.WriteLine(" -cp -classpath <directories and zip/jar files separated by {0}>", Path.PathSeparator); Console.Error.WriteLine(" Set search path for application classes and resources"); Console.Error.WriteLine(" -D<name>=<value> Set a system property"); Console.Error.WriteLine(" -ea[:<packagename>...|:<classname>]"); Console.Error.WriteLine(" -enableassertions[:<packagename>...|:<classname>]"); Console.Error.WriteLine(" Enable assertions."); Console.Error.WriteLine(" -da[:<packagename>...|:<classname>]"); Console.Error.WriteLine(" -disableassertions[:<packagename>...|:<classname>]"); Console.Error.WriteLine(" Disable assertions"); Console.Error.WriteLine(" -Xsave Save the generated assembly (for debugging)"); Console.Error.WriteLine(" -Xtime Time the execution"); Console.Error.WriteLine(" -Xtrace:<string> Displays all tracepoints with the given name"); Console.Error.WriteLine(" -Xmethodtrace:<string>"); Console.Error.WriteLine(" Builds method trace into the specified output methods"); Console.Error.WriteLine(" -Xwait Keep process hanging around after exit"); Console.Error.WriteLine(" -Xbreak Trigger a user defined breakpoint at startup"); Console.Error.WriteLine(" -Xnoclassgc Disable class garbage collection"); return(1); } try { if (debug) { // Starting the debugger Assembly asm = Assembly.GetExecutingAssembly(); String arguments = debugArg + " -pid:" + System.Diagnostics.Process.GetCurrentProcess().Id; String program = new FileInfo(asm.Location).DirectoryName + "\\debugger.exe"; try { ProcessStartInfo info = new ProcessStartInfo(program, arguments); info.UseShellExecute = false; Process debugger = new Process(); debugger.StartInfo = info; debugger.Start(); } catch (Exception ex) { Console.Error.WriteLine(program + " " + arguments); throw ex; } } if (jar) { props["java.class.path"] = mainClass; } Startup.setProperties(props); Startup.enterMainThread(); // HACK Starup.glob() uses Java code, so we need to do this after we've initialized string[] vmargs = Startup.glob(vmargsIndex); if (jar) { mainClass = GetMainClassFromJarManifest(mainClass); if (mainClass == null) { return(1); } } java.lang.Class clazz = java.lang.Class.forName(mainClass, true, java.lang.ClassLoader.getSystemClassLoader()); try { Method method = IKVM.Internal.Starter.FindMainMethod(clazz); if (method == null) { throw new java.lang.NoSuchMethodError("main"); } else if (!Modifier.isPublic(method.getModifiers())) { Console.Error.WriteLine("Main method not public."); } else { // if clazz isn't public, we can still call main method.setAccessible(true); if (saveAssembly) { java.lang.Runtime.getRuntime().addShutdownHook(new SaveAssemblyShutdownHook(clazz)); } if (waitOnExit) { java.lang.Runtime.getRuntime().addShutdownHook(new WaitShutdownHook()); } try { method.invoke(null, new object[] { vmargs }); return(0); } catch (InvocationTargetException x) { throw x.getCause(); } } } finally { if (saveAssemblyX) { IKVM.Internal.Starter.SaveDebugImage(); } } } catch (System.Exception x) { java.lang.Thread thread = java.lang.Thread.currentThread(); thread.getThreadGroup().uncaughtException(thread, ikvm.runtime.Util.mapException(x)); } finally { Startup.exitMainThread(); } return(1); }
public static bool isDynamicTypeWrapper(java.lang.Class cl) { TypeWrapper wrapper = TypeWrapper.FromClass(cl); return(!wrapper.IsFastClassLiteralSafe); }
public GroovyTask(Class groovyScript, Method method, string[] argumentNames) { this._script = groovyScript; this._method = method; this._argumentNames = argumentNames; }
public static bool isInstance(java.lang.Class thisClass, object obj) { return(TypeWrapper.FromClass(thisClass).IsInstance(obj)); }
private static void ResolveMethod(MemberName self, java.lang.Class caller) { bool invokeSpecial = self.getReferenceKind() == MethodHandleNatives.Constants.REF_invokeSpecial; bool newInvokeSpecial = self.getReferenceKind() == MethodHandleNatives.Constants.REF_newInvokeSpecial; bool searchBaseClasses = !newInvokeSpecial; MethodWrapper mw = TypeWrapper.FromClass(self.getDeclaringClass()).GetMethodWrapper(self.getName(), self.getSignature().Replace('/', '.'), searchBaseClasses); if (mw == null) { if (self.getReferenceKind() == MethodHandleNatives.Constants.REF_invokeInterface) { mw = CoreClasses.java.lang.Object.Wrapper.GetMethodWrapper(self.getName(), self.getSignature().Replace('/', '.'), false); if (mw != null && mw.IsConstructor) { throw new java.lang.IncompatibleClassChangeError("Found interface " + self.getDeclaringClass().getName() + ", but class was expected"); } } if (mw == null) { string msg = String.Format(invokeSpecial ? "{0}: method {1}{2} not found" : "{0}.{1}{2}", self.getDeclaringClass().getName(), self.getName(), self.getSignature()); throw new java.lang.NoSuchMethodError(msg); } } if (mw.IsStatic != IsReferenceKindStatic(self.getReferenceKind())) { string msg = String.Format(mw.IsStatic ? "Expecting non-static method {0}.{1}{2}" : "Expected static method {0}.{1}{2}", mw.DeclaringType.Name, self.getName(), self.getSignature()); throw new java.lang.IncompatibleClassChangeError(msg); } if (mw.IsConstructor && mw.DeclaringType == CoreClasses.java.lang.String.Wrapper) { typeof(MemberName).GetField("type", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(self, self.getMethodType().changeReturnType(typeof(string))); self.vmtarget = CreateMemberNameDelegate(mw, caller, false, self.getMethodType()); } else if (!mw.IsConstructor || invokeSpecial || newInvokeSpecial) { MethodType methodType = self.getMethodType(); if (!mw.IsStatic) { methodType = methodType.insertParameterTypes(0, mw.DeclaringType.ClassObject); if (newInvokeSpecial) { methodType = methodType.changeReturnType(java.lang.Void.TYPE); } } self.vmtarget = CreateMemberNameDelegate(mw, caller, self.hasReceiverTypeDispatch(), methodType); } SetModifiers(self, mw); self._flags(self._flags() | (mw.IsConstructor ? MethodHandleNatives.Constants.MN_IS_CONSTRUCTOR : MethodHandleNatives.Constants.MN_IS_METHOD)); if (self.getReferenceKind() == MethodHandleNatives.Constants.REF_invokeVirtual && (mw.IsPrivate || mw.IsFinal || mw.IsConstructor)) { int flags = self._flags(); flags -= MethodHandleNatives.Constants.REF_invokeVirtual << MethodHandleNatives.Constants.MN_REFERENCE_KIND_SHIFT; flags += MethodHandleNatives.Constants.REF_invokeSpecial << MethodHandleNatives.Constants.MN_REFERENCE_KIND_SHIFT; self._flags(flags); } if (mw.HasCallerID || DynamicTypeWrapper.RequiresDynamicReflectionCallerClass(mw.DeclaringType.Name, mw.Name, mw.Signature)) { self._flags(self._flags() | MemberName.CALLER_SENSITIVE); } if (mw.IsConstructor && mw.DeclaringType == CoreClasses.java.lang.String.Wrapper) { int flags = self._flags(); flags -= MethodHandleNatives.Constants.REF_invokeSpecial << MethodHandleNatives.Constants.MN_REFERENCE_KIND_SHIFT; flags += MethodHandleNatives.Constants.REF_invokeStatic << MethodHandleNatives.Constants.MN_REFERENCE_KIND_SHIFT; flags -= MethodHandleNatives.Constants.MN_IS_CONSTRUCTOR; flags += MethodHandleNatives.Constants.MN_IS_METHOD; flags += MethodHandleNatives.Constants.ACC_STATIC; self._flags(flags); } }
public static byte[] getRawTypeAnnotations(java.lang.Class thisClass) { return(TypeWrapper.FromClass(thisClass).GetRawTypeAnnotations()); }
public static void setSigners(java.lang.Class thisClass, object[] signers) { #if !FIRST_PASS thisClass.signers = signers; #endif }
public static java.lang.Class loadClassInternal(java.lang.Class hostClass, byte[] classFile, object[] patchArray) { throw new NotImplementedException(); }
public static bool shouldBeInitialized(object thisUnsafe, java.lang.Class clazz) { return(TypeWrapper.FromClass(clazz).HasStaticInitializer); }
public static bool isPrimitive(java.lang.Class thisClass) { return(TypeWrapper.FromClass(thisClass).IsPrimitive); }
public static bool isArray(java.lang.Class thisClass) { return(TypeWrapper.FromClass(thisClass).IsArray); }
public static java.lang.ClassLoader getClassLoader0(java.lang.Class thisClass) { return(TypeWrapper.FromClass(thisClass).GetClassLoader().GetJavaClassLoader()); }
public static int getMembers(java.lang.Class defc, string matchName, string matchSig, int matchFlags, java.lang.Class caller, int skip, MemberName[] results) { #if FIRST_PASS return(0); #else if (matchName != null || matchSig != null || matchFlags != MethodHandleNatives.Constants.MN_IS_METHOD) { throw new NotImplementedException(); } MethodWrapper[] methods = TypeWrapper.FromClass(defc).GetMethods(); for (int i = skip, len = Math.Min(results.Length, methods.Length - skip); i < len; i++) { if (!methods[i].IsConstructor && methods[i].Name != StringConstants.CLINIT) { results[i - skip] = new MemberName((java.lang.reflect.Method)methods[i].ToMethodOrConstructor(true), false); } } return(methods.Length - skip); #endif }
public GroovyTarget(Project project, Class groovyScript, Method method) { this.Project = project; this._script = groovyScript; this._method = method; }
public static string getSigName(java.lang.Class thisClass) { return(TypeWrapper.FromClass(thisClass).SigName); }