public void defineAnnotatedMethodsIndividually(Class clazz) { TypePopulator populator; if (RubyInstanceConfig.FULL_TRACE_ENABLED || RubyInstanceConfig.REFLECTED_HANDLES) { // we want reflected invokers or need full traces, use default (slow) populator if (DEBUG) LOG.info("trace mode, using default populator"); populator = TypePopulator.DEFAULT; } else { try { String qualifiedName = "org.jruby.gen." + clazz.getCanonicalName().replace('.', '$'); if (DEBUG) LOG.info("looking for " + qualifiedName + AnnotationBinder.POPULATOR_SUFFIX); Class populatorClass = Class.forName(qualifiedName + AnnotationBinder.POPULATOR_SUFFIX); populator = (TypePopulator)populatorClass.newInstance(); } catch (Throwable t) { if (DEBUG) LOG.info("Could not find it, using default populator"); populator = TypePopulator.DEFAULT; } } populator.populate(this, clazz); }
TypePopulator.populateMethod( ic, ic.getArity().getValue(),
TypePopulator.populateMethod( ic, ic.getArity().getValue(),
public void defineAnnotatedMethodsIndividually(Class clazz) { TypePopulator populator; if (RubyInstanceConfig.FULL_TRACE_ENABLED || RubyInstanceConfig.REFLECTED_HANDLES) { // we want reflected invokers or need full traces, use default (slow) populator if (DEBUG) LOG.info("trace mode, using default populator"); populator = TypePopulator.DEFAULT; } else { try { String qualifiedName = "org.jruby.gen." + clazz.getCanonicalName().replace('.', '$'); if (DEBUG) LOG.info("looking for " + qualifiedName + AnnotationBinder.POPULATOR_SUFFIX); Class populatorClass = Class.forName(qualifiedName + AnnotationBinder.POPULATOR_SUFFIX); populator = (TypePopulator)populatorClass.newInstance(); } catch (Throwable t) { if (DEBUG) LOG.info("Could not find it, using default populator"); populator = TypePopulator.DEFAULT; } } populator.populate(this, clazz); }
/** * Use reflection to provide a method handle based on an annotated Java * method. * * @see org.jruby.internal.runtime.methods.MethodFactory#getAnnotatedMethod */ public DynamicMethod getAnnotatedMethod(RubyModule implementationClass, JavaMethodDescriptor desc) { try { if (!Modifier.isPublic(desc.getDeclaringClass().getModifiers())) { LOG.warn("warning: binding non-public class {}; reflected handles won't work", desc.declaringClassName); } Method method = desc.getDeclaringClass().getDeclaredMethod(desc.name, desc.getParameterClasses()); JavaMethod ic = new ReflectedJavaMethod(implementationClass, method, desc.anno); TypePopulator.populateMethod( ic, ic.getArity().getValue(), method.getName(), Modifier.isStatic(method.getModifiers()), CallConfiguration.getCallConfigByAnno(desc.anno), desc.anno.notImplemented()); return ic; } catch (Exception e) { throw new RuntimeException(e); } }
public final void defineAnnotatedMethodsIndividually(Class clazz) { getRuntime().POPULATORS.get(clazz).populate(this, clazz); }
/** * Use reflection to provide a method handle based on an annotated Java * method. * * @see org.jruby.internal.runtime.methods.MethodFactory#getAnnotatedMethod */ public DynamicMethod getAnnotatedMethod(RubyModule implementationClass, JavaMethodDescriptor desc) { try { if (!Modifier.isPublic(desc.getDeclaringClass().getModifiers())) { LOG.warn("warning: binding non-public class {}; reflected handles won't work", desc.declaringClassName); } Method method = desc.getDeclaringClass().getDeclaredMethod(desc.name, desc.getParameterClasses()); JavaMethod ic = new ReflectedJavaMethod(implementationClass, method, desc.anno); TypePopulator.populateMethod( ic, ic.getArity().getValue(), method.getName(), Modifier.isStatic(method.getModifiers()), CallConfiguration.getCallConfigByAnno(desc.anno), desc.anno.notImplemented()); return ic; } catch (Exception e) { throw new RuntimeException(e); } }
public final void defineAnnotatedMethodsIndividually(Class clazz) { getRuntime().POPULATORS.get(clazz).populate(this, clazz); }
/** * Use code generation to provide a method handle based on an annotated Java * method. * * @see org.jruby.runtime.MethodFactory#getAnnotatedMethod */ public DynamicMethod getAnnotatedMethod(RubyModule implementationClass, JavaMethodDescriptor desc) { String javaMethodName = desc.name; try { Class c = getAnnotatedMethodClass(Arrays.asList(desc)); JavaMethod ic = (JavaMethod)c.getConstructor(new Class[]{RubyModule.class, Visibility.class}).newInstance(new Object[]{implementationClass, desc.anno.visibility()}); TypePopulator.populateMethod( ic, Arity.fromAnnotation(desc.anno, desc.actualRequired).getValue(), javaMethodName, desc.isStatic, CallConfiguration.getCallConfigByAnno(desc.anno), desc.anno.notImplemented(), desc.getDeclaringClass(), desc.name, desc.getReturnClass(), desc.getParameterClasses()); return ic; } catch(Exception e) { e.printStackTrace(); throw implementationClass.getRuntime().newLoadError(e.getMessage()); } }
/** * Use code generation to provide a method handle based on an annotated Java * method. * * @see org.jruby.runtime.MethodFactory#getAnnotatedMethod */ public DynamicMethod getAnnotatedMethod(RubyModule implementationClass, JavaMethodDescriptor desc) { String javaMethodName = desc.name; try { Class c = getAnnotatedMethodClass(Arrays.asList(desc)); JavaMethod ic = (JavaMethod)c.getConstructor(new Class[]{RubyModule.class, Visibility.class}).newInstance(new Object[]{implementationClass, desc.anno.visibility()}); TypePopulator.populateMethod( ic, Arity.fromAnnotation(desc.anno, desc.actualRequired).getValue(), javaMethodName, desc.isStatic, CallConfiguration.getCallConfigByAnno(desc.anno), desc.anno.notImplemented(), desc.getDeclaringClass(), desc.name, desc.getReturnClass(), desc.getParameterClasses()); return ic; } catch(Exception e) { e.printStackTrace(); throw implementationClass.getRuntime().newLoadError(e.getMessage()); } }
TypePopulator.populateMethod( ic, Arity.optional().getValue(),
TypePopulator.populateMethod( ic, Arity.optional().getValue(),
/** * Use code generation to provide a method handle based on an annotated Java * method. * * @see org.jruby.runtime.MethodFactory#getAnnotatedMethod */ public DynamicMethod getAnnotatedMethod(RubyModule implementationClass, JavaMethodDescriptor desc, String name) { String javaMethodName = desc.name; try { Class c = getAnnotatedMethodClass(Collections.singletonList(desc)); JavaMethod ic = constructJavaMethod(implementationClass, desc, name, c); TypePopulator.populateMethod( ic, Arity.fromAnnotation(desc.anno, desc.actualRequired).getValue(), javaMethodName, desc.isStatic, desc.anno.notImplemented(), desc.declaringClass, desc.name, desc.returnClass, desc.parameters); return ic; } catch(Exception e) { LOG.error(e); throw implementationClass.getRuntime().newLoadError(e.getMessage()); } }
/** * Use code generation to provide a method handle based on an annotated Java * method. * * @see org.jruby.runtime.MethodFactory#getAnnotatedMethod */ public DynamicMethod getAnnotatedMethod(RubyModule implementationClass, JavaMethodDescriptor desc, String name) { String javaMethodName = desc.name; try { Class c = getAnnotatedMethodClass(Collections.singletonList(desc)); JavaMethod ic = constructJavaMethod(implementationClass, desc, name, c); TypePopulator.populateMethod( ic, Arity.fromAnnotation(desc.anno, desc.actualRequired).getValue(), javaMethodName, desc.isStatic, desc.anno.notImplemented(), desc.declaringClass, desc.name, desc.returnClass, desc.parameters); return ic; } catch(Exception e) { LOG.error(e); throw implementationClass.getRuntime().newLoadError(e.getMessage()); } }
TypePopulator.populateMethod( ic, Arity.optional().getValue(),
TypePopulator.populateMethod( ic, Arity.optional().getValue(),