if (!Modifier.isPublic(descs.get(0).getDeclaringClass().getModifiers())) { LOG.warn("warning: binding non-public class {}; reflected handles won't work", descs.get(0).declaringClassName); methods.add(desc.getDeclaringClass().getDeclaredMethod(desc.name, desc.getParameterClasses())); annotations.add(desc.anno);
if (!Modifier.isPublic(descs.get(0).getDeclaringClass().getModifiers())) { LOG.warn("warning: binding non-public class {}; reflected handles won't work", descs.get(0).declaringClassName); methods.add(desc.getDeclaringClass().getDeclaredMethod(desc.name, desc.getParameterClasses())); annotations.add(desc.anno);
/** * 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); } }
/** * 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); } }
JavaMethodDescriptor desc1 = descs.get(0); if (!Modifier.isPublic(desc1.getDeclaringClass().getModifiers())) { LOG.warn("warning: binding non-public class {}; reflected handles won't work", desc1.declaringClassName); Class c = tryClass(generatedClassName, desc1.getDeclaringClass(), superclass); if (c == null) { synchronized (syncObject) { c = tryClass(generatedClassName, desc1.getDeclaringClass(), superclass); if (c == null) { if (DEBUG) out.println("Generating " + generatedClassName + ", min: " + info.getMin() + ", max: " + info.getMax() + ", hasBlock: " + info.isBlock() + ", rest: " + info.isRest());
JavaMethodDescriptor desc1 = descs.get(0); if (!Modifier.isPublic(desc1.getDeclaringClass().getModifiers())) { LOG.warn("warning: binding non-public class {}; reflected handles won't work", desc1.declaringClassName); Class c = tryClass(generatedClassName, desc1.getDeclaringClass(), superclass); if (c == null) { synchronized (syncObject) { c = tryClass(generatedClassName, desc1.getDeclaringClass(), superclass); if (c == null) { if (DEBUG) out.println("Generating " + generatedClassName + ", min: " + info.getMin() + ", max: " + info.getMax() + ", hasBlock: " + info.isBlock() + ", rest: " + info.isRest());
/** * 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()); } }
CallConfiguration.getCallConfig(info.isFrame(), info.isScope()), desc1.anno.notImplemented(), desc1.getDeclaringClass(), desc1.name, desc1.getReturnClass(),
CallConfiguration.getCallConfig(info.isFrame(), info.isScope()), desc1.anno.notImplemented(), desc1.getDeclaringClass(), desc1.name, desc1.getReturnClass(),
@Override public DynamicMethod getAnnotatedMethod(RubyModule implementationClass, List<JavaMethodDescriptor> descs) { JavaMethodDescriptor desc1 = descs.get(0); if (desc1.anno.frame()) { // super logic does not work yet because we need to take impl class // and method name from the DynamicMethod#call call, so punt to // generated class for now return super.getAnnotatedMethod(implementationClass, descs); } if (!Modifier.isPublic(desc1.getDeclaringClass().getModifiers())) { LOG.warn("warning: binding non-public class {}; reflected handles won't work", desc1.declaringClassName); } DescriptorInfo info = new DescriptorInfo(descs); MethodHandle[] targets = buildAnnotatedMethodHandles(implementationClass.getRuntime(), descs, implementationClass); return new HandleMethod(implementationClass, desc1.anno.visibility(), CallConfiguration.getCallConfig(info.isFrame(), info.isScope()), targets, null); }
@Override public DynamicMethod getAnnotatedMethod(RubyModule implementationClass, List<JavaMethodDescriptor> descs) { JavaMethodDescriptor desc1 = descs.get(0); if (desc1.anno.frame()) { // super logic does not work yet because we need to take impl class // and method name from the DynamicMethod#call call, so punt to // generated class for now return super.getAnnotatedMethod(implementationClass, descs); } if (!Modifier.isPublic(desc1.getDeclaringClass().getModifiers())) { LOG.warn("warning: binding non-public class {}; reflected handles won't work", desc1.declaringClassName); } DescriptorInfo info = new DescriptorInfo(descs); MethodHandle[] targets = buildAnnotatedMethodHandles(implementationClass.getRuntime(), descs, implementationClass); return new HandleMethod(implementationClass, desc1.anno.visibility(), CallConfiguration.getCallConfig(info.isFrame(), info.isScope()), targets, null); }
.castArg("self", desc.getDeclaringClass()); .invokeStaticQuiet(LOOKUP, desc.getDeclaringClass(), javaMethodName); } else { target = targetBinder
.castArg("self", desc.getDeclaringClass()); .invokeStaticQuiet(LOOKUP, desc.getDeclaringClass(), javaMethodName); } else { target = targetBinder