public TestMethod(Method method, TestClass testClass) { base.\u002Ector(); TestMethod testMethod = this; this.fMethod = method; this.fTestClass = testClass; }
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 static void raise0(int sig) { #if !FIRST_PASS java.security.AccessController.doPrivileged(ikvm.runtime.Delegates.toPrivilegedAction(delegate { java.lang.Class clazz = typeof(sun.misc.Signal); java.lang.reflect.Method dispatch = clazz.getDeclaredMethod("dispatch", java.lang.Integer.TYPE); dispatch.setAccessible(true); dispatch.invoke(null, java.lang.Integer.valueOf(sig)); return(null); })); #endif }
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); }
protected internal virtual TestMethod wrapMethod(Method method) { return new TestMethod(method, this.fTestClass); }
private static void RegisterJVMMethod(GType type, Method method, bool register) { var modifiers = (ModifierFlags)method.getModifiers(); Annotation annotation = HasAnnotation(method, "net.sf.jni4net.attributes.ClrMethod"); if (annotation != null || (modifiers & (ModifierFlags.Private | ModifierFlags.Synthetic)) != ModifierFlags.None) { if (annotation == null) { if (config.Verbose) { Console.WriteLine("Skip " + type + "." + method); } } return; } var res = new GMethod(); res.Type = type; res.Name = method.getName(); res.JVMName = res.Name; res.CLRName = res.JVMName; res.IsJVMMethod = true; Class[] parameterTypes = method.getParameterTypes(); for (int i = 0; i < parameterTypes.Length; i++) { Class paramType = parameterTypes[i]; res.ParameterNames.Add("par" + i); //+ paramType.ShortName res.Parameters.Add(RegisterClass(paramType)); } ConvertJVMAttributes(type, res, method); res.LowerName = res.Name + res.GetSignatureLowerNoRet(); res.ReturnType = RegisterClass(method.getReturnType()); if (register) { bool force = false; if (UseMethodModifier(type, res, res.Name, res.GetJVMSignature(), ref force)) { if (config.Verbose) { Console.WriteLine("Skip " + type + "." + method); } return; } FinishRegistration(method.getName(), type, res, force, res.Name + res.GetCLRSignatureNoRet(), skipCLR); } }
public GroovyTask(Class groovyScript, Method method, string[] argumentNames) { this._script = groovyScript; this._method = method; this._argumentNames = argumentNames; }
private static Annotation HasAnnotation(Method tested, string name) { Annotation[] annotations = tested.getAnnotations(); foreach (Annotation annotation in annotations) { if (annotation.annotationType().getName() == name) { return annotation; } } return null; }
protected internal virtual void invokeTestMethod(Method method, RunNotifier notifier) { Description description = this.methodDescription(method); object test; InvocationTargetException invocationTargetException1; Exception exception1; try { try { test = this.createTest(); goto label_8; } catch (InvocationTargetException ex) { int num = 1; invocationTargetException1 = (InvocationTargetException) ByteCodeHelper.MapException<InvocationTargetException>((Exception) ex, (ByteCodeHelper.MapFlags) num); } } catch (Exception ex) { int num = 0; M0 m0 = ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num); if (m0 == null) { throw; } else { exception1 = (Exception) m0; goto label_7; } } InvocationTargetException invocationTargetException2 = invocationTargetException1; this.testAborted(notifier, description, invocationTargetException2.getCause()); return; label_7: Exception exception2 = exception1; this.testAborted(notifier, description, (Exception) exception2); return; label_8: TestMethod method1 = this.wrapMethod(method); new MethodRoadie(test, method1, notifier, description).run(); }
MethodCallExpression(Method method, Expression target, Expression[] arguments) : super(ExpressionKind.MethodCall, method.getReturnType()) {
public void Invoke(params string[] args) { try { // http://bigjavablog.blogspot.com/2008/08/load-jar-files-and-java-classes.html if (Method != null) { var main_args = new string[0]; this.Method.invoke(null, new object[] { main_args }); } else { /* We need and URL to load the jar file. */ URL u = new File(this.AssemblyPath).toURL(); /* Load jar file using URLClassLoader. */ URLClassLoader cl = new URLClassLoader(new URL[] { u }); if (NativeAssemblyPath != null) { var nc = cl.loadClass("jni.CPtrLibrary"); var ncf = nc.getField("LibraryPath"); ncf.set(null, NativeAssemblyPath); } var c = cl.loadClass(this.TypeName); foreach (var m in c.getMethods()) { if (m.getDeclaringClass() == c) { if (m.getName() == "main") { this.Method = m; var main_args = new string[0]; this.Method.invoke(null, new object[] { main_args }); } } } } } catch (csharp.ThrowableException ex) { var exo = (object)ex; Console.WriteLine("error!"); Console.WriteLine(ex.Message + " - " + ex.ToString()); ErrorHandler(exo); } }
private static bool testVirtual(GType type, Class clazz, Method method, bool create, bool isBaseClassPublic) { var modifiers = (ModifierFlags) method.getModifiers(); bool isStatic = (modifiers & ModifierFlags.Static) != ModifierFlags.None; bool isVirtual = (modifiers & ModifierFlags.Final) == ModifierFlags.None; if (!clazz.isInterface()) { if (create && !isStatic && isVirtual && !type.IsRootType) { Method smethod = clazz.getSuperclass().GetMethodNoThrow(method.getName(), method.GetSignature(), false); if (smethod != null && isBaseClassPublic) { create = false; } } } return create; }
public FrameworkMethod(Method method) { FrameworkMethod frameworkMethod = this; this.fMethod = method; }
public static Generator.MethodInformation getMethodInformation(Method method) { if (!Modifier.isNative(method.getModifiers())) return (Generator.MethodInformation) null; Generator.MethodInformation methodInformation1 = new Generator.MethodInformation(); methodInformation1.method = method; methodInformation1.annotations = ((AccessibleObject) method).getAnnotations(); methodInformation1.modifiers = method.getModifiers(); methodInformation1.returnType = method.getReturnType(); methodInformation1.name = method.getName(); methodInformation1.memberName = methodInformation1.name; Name name1 = (Name) method.getAnnotation((Class) ClassLiteral<Name>.Value); if (name1 != null) { methodInformation1.memberName = name1.value(); methodInformation1.memberNameSuffix = name1.suffix(); } methodInformation1.parameterTypes = method.getParameterTypes(); methodInformation1.parameterAnnotations = method.getParameterAnnotations(); Class behavior = Generator.getBehavior(method); int num1 = methodInformation1.returnType != Void.TYPE ? 1 : 0; int num2 = 1; for (int index = 0; index < methodInformation1.parameterTypes.Length; ++index) { if (methodInformation1.parameterTypes[index] != Integer.TYPE && methodInformation1.parameterTypes[index] != Long.TYPE) { num1 = 0; if (index < methodInformation1.parameterTypes.Length - 1) num2 = 0; } } int num3 = Modifier.isStatic(methodInformation1.modifiers) || methodInformation1.returnType != Void.TYPE ? 0 : 1; int num4 = num3 == 0 || methodInformation1.parameterTypes.Length != 1 || methodInformation1.parameterTypes[0] != Integer.TYPE && methodInformation1.parameterTypes[0] != Long.TYPE ? 0 : 1; int num5 = 0; int num6 = 0; int num7 = 0; int num8 = 0; Method method1 = (Method) null; foreach (Method method2 in method.getDeclaringClass().getDeclaredMethods(Generator.__\u003CGetCallerID\u003E())) { int modifiers = method2.getModifiers(); Class returnType = method2.getReturnType(); string name2 = method2.getName(); Class[] parameterTypes = method2.getParameterTypes(); if (!method.equals((object) method2) && Modifier.isNative(modifiers)) { if (String.instancehelper_equals("get", (object) methodInformation1.name) && String.instancehelper_equals("put", (object) name2) && (methodInformation1.parameterTypes.Length == 0 && parameterTypes.Length == 1) && (parameterTypes[0] == methodInformation1.returnType && num1 != 0)) { num5 = 1; method1 = method2; } else if (String.instancehelper_equals("put", (object) methodInformation1.name) && String.instancehelper_equals("get", (object) name2) && (methodInformation1.parameterTypes.Length == 1 && parameterTypes.Length == 0) && (methodInformation1.parameterTypes[0] == returnType && num2 != 0)) { num6 = 1; method1 = method2; } else if (String.instancehelper_equals(name2, (object) methodInformation1.name)) { methodInformation1.overloaded = true; int num9 = 1; for (int index = 0; index < methodInformation1.parameterTypes.Length && index < parameterTypes.Length; ++index) { if (methodInformation1.parameterTypes[index] != parameterTypes[index]) num9 = 0; } if (num9 != 0 && parameterTypes.Length - 1 == methodInformation1.parameterTypes.Length && (methodInformation1.returnType == parameterTypes[parameterTypes.Length - 1] && num1 != 0)) { num7 = 1; method1 = method2; } else if (num9 != 0 && methodInformation1.parameterTypes.Length - 1 == parameterTypes.Length && (returnType == methodInformation1.parameterTypes[methodInformation1.parameterTypes.Length - 1] && num2 != 0)) { num8 = 1; method1 = method2; } } } } if (num1 != 0 && behavior == ClassLiteral<ValueGetter>.Value) methodInformation1.valueGetter = true; else if (num2 != 0 && behavior == ClassLiteral<ValueSetter>.Value) methodInformation1.valueSetter = true; else if (num1 != 0 && behavior == ClassLiteral<MemberGetter>.Value) methodInformation1.memberGetter = true; else if (num2 != 0 && behavior == ClassLiteral<MemberSetter>.Value) methodInformation1.memberSetter = true; else if (num3 != 0 && behavior == ClassLiteral<Allocator>.Value) methodInformation1.allocator = true; else if (num4 != 0 && behavior == ClassLiteral<ArrayAllocator>.Value) { Generator.MethodInformation methodInformation2 = methodInformation1; Generator.MethodInformation methodInformation3 = methodInformation1; int num9 = 1; Generator.MethodInformation methodInformation4 = methodInformation3; int num10 = num9; methodInformation4.arrayAllocator = num9 != 0; methodInformation2.allocator = num10 != 0; } else if (behavior == null) { if (methodInformation1.returnType == Void.TYPE && String.instancehelper_equals("deallocate", (object) methodInformation1.name) && (!Modifier.isStatic(methodInformation1.modifiers) && methodInformation1.parameterTypes.Length == 2) && (methodInformation1.parameterTypes[0] == Long.TYPE && methodInformation1.parameterTypes[1] == Long.TYPE)) methodInformation1.deallocator = true; else if (num3 != 0 && String.instancehelper_equals("allocate", (object) methodInformation1.name)) methodInformation1.allocator = true; else if (num4 != 0 && String.instancehelper_equals("allocateArray", (object) methodInformation1.name)) { Generator.MethodInformation methodInformation2 = methodInformation1; Generator.MethodInformation methodInformation3 = methodInformation1; int num9 = 1; Generator.MethodInformation methodInformation4 = methodInformation3; int num10 = num9; methodInformation4.arrayAllocator = num9 != 0; methodInformation2.allocator = num10 != 0; } else if (methodInformation1.returnType.isAssignableFrom((Class) ClassLiteral<ByteBuffer>.Value) && String.instancehelper_equals("asDirectBuffer", (object) methodInformation1.name) && (!Modifier.isStatic(methodInformation1.modifiers) && methodInformation1.parameterTypes.Length == 1) && (methodInformation1.parameterTypes[0] == Integer.TYPE || methodInformation1.parameterTypes[0] == Long.TYPE)) methodInformation1.bufferGetter = true; else if (num5 != 0) { methodInformation1.valueGetter = true; methodInformation1.pairedMethod = method1; } else if (num6 != 0) { methodInformation1.valueSetter = true; methodInformation1.pairedMethod = method1; } else if (num7 != 0) { methodInformation1.memberGetter = true; methodInformation1.pairedMethod = method1; } else if (num8 != 0) { methodInformation1.memberSetter = true; methodInformation1.pairedMethod = method1; } } else { Generator.logger.log((Level) Level.WARNING, new StringBuilder().append("Method \"").append((object) method).append("\" cannot behave like a \"").append((object) behavior).append("\". No code will be generated.").toString()); return (Generator.MethodInformation) null; } if (name1 == null && methodInformation1.pairedMethod != null) { Name name2 = (Name) methodInformation1.pairedMethod.getAnnotation((Class) ClassLiteral<Name>.Value); if (name2 != null) { methodInformation1.memberName = name2.value(); methodInformation1.memberNameSuffix = name2.suffix(); } } methodInformation1.noOffset = ((AccessibleObject) method).isAnnotationPresent((Class) ClassLiteral<NoOffset>.Value); if (!methodInformation1.noOffset && methodInformation1.pairedMethod != null) methodInformation1.noOffset = ((AccessibleObject) methodInformation1.pairedMethod).isAnnotationPresent((Class) ClassLiteral<NoOffset>.Value); return methodInformation1; }
public static Class getBehavior(Method method) { Annotation[] annotations = ((AccessibleObject) method).getAnnotations(); Annotation annotation1 = (Annotation) null; Annotation[] annotationArray = annotations; int length = annotationArray.Length; for (int index = 0; index < length; ++index) { Annotation annotation2 = annotationArray[index]; if (annotation2 is Function || annotation2 is Allocator || (annotation2 is ArrayAllocator || annotation2 is ValueSetter) || (annotation2 is ValueGetter || annotation2 is MemberGetter || annotation2 is MemberSetter)) { if (annotation1 != null) Generator.logger.log((Level) Level.WARNING, new StringBuilder().append("Behavior annotation \"").append((object) annotation1).append("\" already found. Ignoring superfluous annotation \"").append((object) annotation2).append("\".").toString()); else annotation1 = annotation2; } } return annotation1 != null ? annotation1.annotationType() : (Class) null; }
public static Assignments allUnassigned(Method testMethod, TestClass testClass) { List list = ParameterSignature.signatures(testClass.getOnlyConstructor()); list.addAll((Collection) ParameterSignature.signatures(testMethod)); return new Assignments((List) new ArrayList(), list, testClass); }
public static object getDefaultValue(java.lang.reflect.Method thisMethod) { MethodWrapper mw = MethodWrapper.FromMethod(thisMethod); return(mw.DeclaringType.GetAnnotationDefault(mw)); }
protected internal virtual string testName(Method method) { return method.getName(); }
protected internal virtual Annotation[] testAnnotations(Method method) { return ((AccessibleObject) method).getAnnotations(); }
protected internal virtual Description methodDescription(Method method) { return Description.createTestDescription(this.getTestClass().getJavaClass(), this.testName(method), this.testAnnotations(method)); }
public GroovyTarget(Project project, Class groovyScript, Method method) { this.Project = project; this._script = groovyScript; this._method = method; }
public static ArrayList signatures(Method method) { return ParameterSignature.signatures(method.getParameterTypes(), method.getParameterAnnotations()); }