Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

First pass (only pass?) at removing runtime dependency on annotations.

  • Loading branch information...
commit c857e3aa21b807b26ceec91ff014def99dfb3e03 1 parent eca0f14
Charles Nutter authored
14 nbproject/project.xml
View
@@ -72,6 +72,12 @@
<location>lib/ruby/site_ruby</location>
<encoding>UTF-8</encoding>
</source-folder>
+ <source-folder>
+ <label>src_gen</label>
+ <type>java</type>
+ <location>src_gen</location>
+ <encoding>UTF-8</encoding>
+ </source-folder>
</folders>
<ide-actions>
<action name="build">
@@ -160,6 +166,10 @@
<label>lib/ruby/site_ruby</label>
<location>lib/ruby/site_ruby</location>
</source-folder>
+ <source-folder style="packages">
+ <label>src_gen</label>
+ <location>src_gen</location>
+ </source-folder>
<source-file>
<location>build.xml</location>
</source-file>
@@ -222,6 +232,10 @@
<package-root>lib/ruby/site_ruby</package-root>
<source-level>1.5</source-level>
</compilation-unit>
+ <compilation-unit>
+ <package-root>src_gen</package-root>
+ <source-level>1.5</source-level>
+ </compilation-unit>
</java-data>
</configuration>
</project>
76 src/org/jruby/RubyBigDecimal.java
View
@@ -38,7 +38,6 @@
import java.util.regex.Pattern;
import org.jruby.anno.JRubyClass;
-import org.jruby.anno.JRubyConstant;
import org.jruby.anno.JRubyMethod;
import org.jruby.runtime.Arity;
import org.jruby.runtime.Block;
@@ -59,50 +58,27 @@ public IRubyObject allocate(Ruby runtime, RubyClass klass) {
}
};
- @JRubyConstant
public final static int ROUND_DOWN = BigDecimal.ROUND_DOWN;
- @JRubyConstant
public final static int ROUND_CEILING = BigDecimal.ROUND_CEILING;
- @JRubyConstant
public final static int ROUND_UP = BigDecimal.ROUND_UP;
- @JRubyConstant
public final static int ROUND_HALF_DOWN = BigDecimal.ROUND_HALF_DOWN;
- @JRubyConstant
public final static int ROUND_HALF_EVEN = BigDecimal.ROUND_HALF_EVEN;
- @JRubyConstant
public final static int ROUND_HALF_UP = BigDecimal.ROUND_HALF_UP;
- @JRubyConstant
public final static int ROUND_FLOOR = BigDecimal.ROUND_FLOOR;
-
- @JRubyConstant
- public final static int SIGN_POSITIVE_INFINITE=3;
- @JRubyConstant
- public final static int EXCEPTION_OVERFLOW=1;
- @JRubyConstant
- public final static int SIGN_POSITIVE_ZERO=1;
- @JRubyConstant
- public final static int EXCEPTION_ALL=255;
- @JRubyConstant
- public final static int SIGN_NEGATIVE_FINITE=-2;
- @JRubyConstant
- public final static int EXCEPTION_UNDERFLOW=4;
- @JRubyConstant
- public final static int SIGN_NaN=0;
- @JRubyConstant
- public final static int BASE=10000;
- @JRubyConstant
- public final static int ROUND_MODE=256;
- @JRubyConstant
- public final static int SIGN_POSITIVE_FINITE=2;
- @JRubyConstant
- public final static int EXCEPTION_INFINITY=1;
- @JRubyConstant
- public final static int SIGN_NEGATIVE_INFINITE=-3;
- @JRubyConstant
- public final static int EXCEPTION_ZERODIVIDE=1;
- @JRubyConstant
- public final static int SIGN_NEGATIVE_ZERO=-1;
- @JRubyConstant
+ public final static int SIGN_POSITIVE_INFINITE = 3;
+ public final static int EXCEPTION_OVERFLOW = 1;
+ public final static int SIGN_POSITIVE_ZERO = 1;
+ public final static int EXCEPTION_ALL = 255;
+ public final static int SIGN_NEGATIVE_FINITE = -2;
+ public final static int EXCEPTION_UNDERFLOW = 4;
+ public final static int SIGN_NaN = 0;
+ public final static int BASE = 10000;
+ public final static int ROUND_MODE = 256;
+ public final static int SIGN_POSITIVE_FINITE = 2;
+ public final static int EXCEPTION_INFINITY = 1;
+ public final static int SIGN_NEGATIVE_INFINITE = -3;
+ public final static int EXCEPTION_ZERODIVIDE = 1;
+ public final static int SIGN_NEGATIVE_ZERO = -1;
public final static int EXCEPTION_NaN=2;
// Static constants
@@ -121,7 +97,29 @@ public static RubyClass createBigDecimal(Ruby runtime) {
result.setInternalModuleVariable("vpRoundingMode", runtime.newFixnum(ROUND_HALF_UP));
result.defineAnnotatedMethods(RubyBigDecimal.class);
- result.defineAnnotatedConstants(RubyBigDecimal.class);
+
+ result.defineConstant("ROUND_DOWN", RubyFixnum.newFixnum(runtime, ROUND_DOWN));
+ result.defineConstant("ROUND_CEILING", RubyFixnum.newFixnum(runtime, ROUND_CEILING));
+ result.defineConstant("ROUND_UP", RubyFixnum.newFixnum(runtime, ROUND_UP));
+ result.defineConstant("ROUND_HALF_DOWN", RubyFixnum.newFixnum(runtime, ROUND_HALF_DOWN));
+ result.defineConstant("ROUND_HALF_EVEN", RubyFixnum.newFixnum(runtime, ROUND_HALF_EVEN));
+ result.defineConstant("ROUND_HALF_UP", RubyFixnum.newFixnum(runtime, ROUND_HALF_UP));
+ result.defineConstant("ROUND_FLOOR", RubyFixnum.newFixnum(runtime, ROUND_FLOOR));
+ result.defineConstant("SIGN_POSITIVE_INFINITE", RubyFixnum.newFixnum(runtime, SIGN_POSITIVE_INFINITE));
+ result.defineConstant("EXCEPTION_OVERFLOW", RubyFixnum.newFixnum(runtime, EXCEPTION_OVERFLOW));
+ result.defineConstant("SIGN_POSITIVE_ZERO", RubyFixnum.newFixnum(runtime, SIGN_POSITIVE_ZERO));
+ result.defineConstant("EXCEPTION_ALL", RubyFixnum.newFixnum(runtime, EXCEPTION_ALL));
+ result.defineConstant("SIGN_NEGATIVE_FINITE", RubyFixnum.newFixnum(runtime, SIGN_NEGATIVE_FINITE));
+ result.defineConstant("EXCEPTION_UNDERFLOW", RubyFixnum.newFixnum(runtime, EXCEPTION_UNDERFLOW));
+ result.defineConstant("SIGN_NaN", RubyFixnum.newFixnum(runtime, SIGN_NaN));
+ result.defineConstant("BASE", RubyFixnum.newFixnum(runtime, BASE));
+ result.defineConstant("ROUND_MODE", RubyFixnum.newFixnum(runtime, ROUND_MODE));
+ result.defineConstant("SIGN_POSITIVE_FINITE", RubyFixnum.newFixnum(runtime, SIGN_POSITIVE_FINITE));
+ result.defineConstant("EXCEPTION_INFINITY", RubyFixnum.newFixnum(runtime, EXCEPTION_INFINITY));
+ result.defineConstant("SIGN_NEGATIVE_INFINITE", RubyFixnum.newFixnum(runtime, SIGN_NEGATIVE_INFINITE));
+ result.defineConstant("EXCEPTION_ZERODIVIDE", RubyFixnum.newFixnum(runtime, EXCEPTION_ZERODIVIDE));
+ result.defineConstant("SIGN_NEGATIVE_ZERO", RubyFixnum.newFixnum(runtime, SIGN_NEGATIVE_ZERO));
+ result.defineConstant("EXCEPTION_NaN", RubyFixnum.newFixnum(runtime, EXCEPTION_NaN));
return result;
}
275 src/org/jruby/RubyModule.java
View
@@ -44,7 +44,6 @@
import static org.jruby.runtime.Visibility.PUBLIC;
import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
@@ -60,10 +59,8 @@
import org.jruby.anno.JRubyClass;
import org.jruby.anno.JRubyConstant;
import org.jruby.anno.JRubyMethod;
-import org.jruby.anno.JavaMethodDescriptor;
import org.jruby.anno.TypePopulator;
import org.jruby.common.IRubyWarnings.ID;
-import org.jruby.compiler.ASTInspector;
import org.jruby.exceptions.RaiseException;
import org.jruby.internal.runtime.methods.AliasMethod;
import org.jruby.internal.runtime.methods.CallConfiguration;
@@ -81,7 +78,6 @@
import org.jruby.runtime.Arity;
import org.jruby.runtime.Block;
import org.jruby.runtime.ClassIndex;
-import org.jruby.runtime.MethodFactory;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.Visibility;
@@ -517,284 +513,29 @@ public void defineMethod(String name, Callback method) {
PRIVATE : PUBLIC;
addMethod(name, new FullFunctionCallbackMethod(this, method, visibility));
}
-
- public void defineAnnotatedMethod(Class clazz, String name) {
- // FIXME: This is probably not very efficient, since it loads all methods for each call
- boolean foundMethod = false;
- for (Method method : clazz.getDeclaredMethods()) {
- if (method.getName().equals(name) && defineAnnotatedMethod(method, MethodFactory.createFactory(getRuntime().getJRubyClassLoader()))) {
- foundMethod = true;
- }
- }
-
- if (!foundMethod) {
- throw new RuntimeException("No JRubyMethod present for method " + name + "on class " + clazz.getName());
- }
- }
-
- public void defineAnnotatedConstants(Class clazz) {
- Field[] declaredFields = clazz.getDeclaredFields();
- for (Field field : declaredFields) {
- if (Modifier.isStatic(field.getModifiers())) {
- defineAnnotatedConstant(field);
- }
- }
- }
-
- public boolean defineAnnotatedConstant(Field field) {
- JRubyConstant jrubyConstant = field.getAnnotation(JRubyConstant.class);
-
- if (jrubyConstant == null) return false;
-
- String[] names = jrubyConstant.value();
- if(names.length == 0) {
- names = new String[]{field.getName()};
- }
-
- Class tp = field.getType();
- IRubyObject realVal;
-
- try {
- if(tp == Integer.class || tp == Integer.TYPE || tp == Short.class || tp == Short.TYPE || tp == Byte.class || tp == Byte.TYPE) {
- realVal = RubyNumeric.int2fix(getRuntime(), field.getInt(null));
- } else if(tp == Boolean.class || tp == Boolean.TYPE) {
- realVal = field.getBoolean(null) ? getRuntime().getTrue() : getRuntime().getFalse();
- } else {
- realVal = getRuntime().getNil();
- }
- } catch(Exception e) {
- realVal = getRuntime().getNil();
- }
-
-
- for(String name : names) {
- this.fastSetConstant(name, realVal);
- }
-
- return true;
- }
public void defineAnnotatedMethods(Class clazz) {
defineAnnotatedMethodsIndividually(clazz);
}
- public static class MethodClumper {
- Map<String, List<JavaMethodDescriptor>> annotatedMethods = new HashMap<String, List<JavaMethodDescriptor>>();
- Map<String, List<JavaMethodDescriptor>> staticAnnotatedMethods = new HashMap<String, List<JavaMethodDescriptor>>();
- Map<String, List<JavaMethodDescriptor>> annotatedMethods1_8 = new HashMap<String, List<JavaMethodDescriptor>>();
- Map<String, List<JavaMethodDescriptor>> staticAnnotatedMethods1_8 = new HashMap<String, List<JavaMethodDescriptor>>();
- Map<String, List<JavaMethodDescriptor>> annotatedMethods1_9 = new HashMap<String, List<JavaMethodDescriptor>>();
- Map<String, List<JavaMethodDescriptor>> staticAnnotatedMethods1_9 = new HashMap<String, List<JavaMethodDescriptor>>();
-
- public void clump(Class cls) {
- Method[] declaredMethods = cls.getDeclaredMethods();
- for (Method method: declaredMethods) {
- JRubyMethod anno = method.getAnnotation(JRubyMethod.class);
- if (anno == null) continue;
-
- JavaMethodDescriptor desc = new JavaMethodDescriptor(method);
-
- String name = anno.name().length == 0 ? method.getName() : anno.name()[0];
-
- List<JavaMethodDescriptor> methodDescs;
- Map<String, List<JavaMethodDescriptor>> methodsHash = null;
- if (desc.isStatic) {
- if (anno.compat() == CompatVersion.RUBY1_8) {
- methodsHash = staticAnnotatedMethods1_8;
- } else if (anno.compat() == CompatVersion.RUBY1_9) {
- methodsHash = staticAnnotatedMethods1_9;
- } else {
- methodsHash = staticAnnotatedMethods;
- }
- } else {
- if (anno.compat() == CompatVersion.RUBY1_8) {
- methodsHash = annotatedMethods1_8;
- } else if (anno.compat() == CompatVersion.RUBY1_9) {
- methodsHash = annotatedMethods1_9;
- } else {
- methodsHash = annotatedMethods;
- }
- }
-
- methodDescs = methodsHash.get(name);
- if (methodDescs == null) {
- methodDescs = new ArrayList<JavaMethodDescriptor>();
- methodsHash.put(name, methodDescs);
- }
-
- methodDescs.add(desc);
- }
- }
-
- public Map<String, List<JavaMethodDescriptor>> getAnnotatedMethods() {
- return annotatedMethods;
- }
-
- public Map<String, List<JavaMethodDescriptor>> getAnnotatedMethods1_8() {
- return annotatedMethods1_8;
- }
-
- public Map<String, List<JavaMethodDescriptor>> getAnnotatedMethods1_9() {
- return annotatedMethods1_9;
- }
-
- public Map<String, List<JavaMethodDescriptor>> getStaticAnnotatedMethods() {
- return staticAnnotatedMethods;
- }
-
- public Map<String, List<JavaMethodDescriptor>> getStaticAnnotatedMethods1_8() {
- return staticAnnotatedMethods1_8;
- }
-
- public Map<String, List<JavaMethodDescriptor>> getStaticAnnotatedMethods1_9() {
- return staticAnnotatedMethods1_9;
- }
- }
-
public void defineAnnotatedMethodsIndividually(Class clazz) {
String x = clazz.getSimpleName();
TypePopulator populator = null;
- if (RubyInstanceConfig.FULL_TRACE_ENABLED) {
- // we need full traces, use default (slow) populator
- if (DEBUG) System.out.println("trace mode, using default populator");
- populator = TypePopulator.DEFAULT;
- } else {
- try {
- String qualifiedName = "org.jruby.gen." + clazz.getCanonicalName().replace('.', '$');
+ try {
+ String qualifiedName = "org.jruby.gen." + clazz.getCanonicalName().replace('.', '$');
- if (DEBUG) System.out.println("looking for " + qualifiedName + "$Populator");
+ if (DEBUG) System.out.println("looking for " + qualifiedName + "$Populator");
- Class populatorClass = Class.forName(qualifiedName + "$Populator");
- populator = (TypePopulator)populatorClass.newInstance();
- } catch (Throwable t) {
- if (DEBUG) System.out.println("Could not find it, using default populator");
- populator = TypePopulator.DEFAULT;
- }
+ Class populatorClass = Class.forName(qualifiedName + "$Populator");
+ populator = (TypePopulator)populatorClass.newInstance();
+ } catch (Throwable t) {
+ if (DEBUG) System.out.println("Could not find it, using default populator");
+ throw new RuntimeException(t);
}
populator.populate(this, clazz);
}
-
- private static MethodFactory.MethodDefiningCallback methodDefiningCallback = new MethodFactory.MethodDefiningCallback() {
- public void define(RubyModule module, JavaMethodDescriptor desc, DynamicMethod dynamicMethod) {
- JRubyMethod jrubyMethod = desc.anno;
- if (jrubyMethod.frame()) {
- for (String name : jrubyMethod.name()) {
- ASTInspector.FRAME_AWARE_METHODS.add(name);
- }
- }
- if(jrubyMethod.compat() == CompatVersion.BOTH ||
- module.getRuntime().getInstanceConfig().getCompatVersion() == jrubyMethod.compat()) {
- RubyModule singletonClass;
-
- if (jrubyMethod.meta()) {
- singletonClass = module.getSingletonClass();
- dynamicMethod.setImplementationClass(singletonClass);
-
- String baseName;
- if (jrubyMethod.name().length == 0) {
- baseName = desc.name;
- singletonClass.addMethod(baseName, dynamicMethod);
- } else {
- baseName = jrubyMethod.name()[0];
- for (String name : jrubyMethod.name()) {
- singletonClass.addMethod(name, dynamicMethod);
- }
- }
-
- if (jrubyMethod.alias().length > 0) {
- for (String alias : jrubyMethod.alias()) {
- singletonClass.defineAlias(alias, baseName);
- }
- }
- } else {
- String baseName;
- if (jrubyMethod.name().length == 0) {
- baseName = desc.name;
- module.addMethod(baseName, dynamicMethod);
- } else {
- baseName = jrubyMethod.name()[0];
- for (String name : jrubyMethod.name()) {
- module.addMethod(name, dynamicMethod);
- }
- }
-
- if (jrubyMethod.alias().length > 0) {
- for (String alias : jrubyMethod.alias()) {
- module.defineAlias(alias, baseName);
- }
- }
-
- if (jrubyMethod.module()) {
- singletonClass = module.getSingletonClass();
- // module/singleton methods are all defined public
- DynamicMethod moduleMethod = dynamicMethod.dup();
- moduleMethod.setVisibility(PUBLIC);
-
- if (jrubyMethod.name().length == 0) {
- baseName = desc.name;
- singletonClass.addMethod(desc.name, moduleMethod);
- } else {
- baseName = jrubyMethod.name()[0];
- for (String name : jrubyMethod.name()) {
- singletonClass.addMethod(name, moduleMethod);
- }
- }
-
- if (jrubyMethod.alias().length > 0) {
- for (String alias : jrubyMethod.alias()) {
- singletonClass.defineAlias(alias, baseName);
- }
- }
- }
- }
- }
- }
- };
-
- public boolean defineAnnotatedMethod(String name, List<JavaMethodDescriptor> methods, MethodFactory methodFactory) {
- JavaMethodDescriptor desc = methods.get(0);
- if (methods.size() == 1) {
- return defineAnnotatedMethod(desc, methodFactory);
- } else {
- DynamicMethod dynamicMethod = methodFactory.getAnnotatedMethod(this, methods);
- methodDefiningCallback.define(this, desc, dynamicMethod);
-
- return true;
- }
- }
-
- public boolean defineAnnotatedMethod(Method method, MethodFactory methodFactory) {
- JRubyMethod jrubyMethod = method.getAnnotation(JRubyMethod.class);
-
- if (jrubyMethod == null) return false;
-
- if(jrubyMethod.compat() == CompatVersion.BOTH ||
- getRuntime().getInstanceConfig().getCompatVersion() == jrubyMethod.compat()) {
- JavaMethodDescriptor desc = new JavaMethodDescriptor(method);
- DynamicMethod dynamicMethod = methodFactory.getAnnotatedMethod(this, desc);
- methodDefiningCallback.define(this, desc, dynamicMethod);
-
- return true;
- }
- return false;
- }
-
- public boolean defineAnnotatedMethod(JavaMethodDescriptor desc, MethodFactory methodFactory) {
- JRubyMethod jrubyMethod = desc.anno;
-
- if (jrubyMethod == null) return false;
-
- if(jrubyMethod.compat() == CompatVersion.BOTH ||
- getRuntime().getInstanceConfig().getCompatVersion() == jrubyMethod.compat()) {
- DynamicMethod dynamicMethod = methodFactory.getAnnotatedMethod(this, desc);
- methodDefiningCallback.define(this, desc, dynamicMethod);
-
- return true;
- }
- return false;
- }
public void defineFastMethod(String name, Callback method) {
Visibility visibility = name.equals("initialize") ?
1  src/org/jruby/anno/InvokerGenerator.java
View
@@ -5,7 +5,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.jruby.RubyModule.MethodClumper;
import org.jruby.internal.runtime.methods.DumpingInvocationMethodFactory;
import org.jruby.util.JRubyClassLoader;
79 src/org/jruby/anno/MethodClumper.java
View
@@ -0,0 +1,79 @@
+package org.jruby.anno;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.jruby.CompatVersion;
+
+public class MethodClumper {
+
+ Map<String, List<JavaMethodDescriptor>> annotatedMethods = new HashMap<String, List<JavaMethodDescriptor>>();
+ Map<String, List<JavaMethodDescriptor>> staticAnnotatedMethods = new HashMap<String, List<JavaMethodDescriptor>>();
+ Map<String, List<JavaMethodDescriptor>> annotatedMethods1_8 = new HashMap<String, List<JavaMethodDescriptor>>();
+ Map<String, List<JavaMethodDescriptor>> staticAnnotatedMethods1_8 = new HashMap<String, List<JavaMethodDescriptor>>();
+ Map<String, List<JavaMethodDescriptor>> annotatedMethods1_9 = new HashMap<String, List<JavaMethodDescriptor>>();
+ Map<String, List<JavaMethodDescriptor>> staticAnnotatedMethods1_9 = new HashMap<String, List<JavaMethodDescriptor>>();
+
+ public void clump(Class cls) {
+ Method[] declaredMethods = cls.getDeclaredMethods();
+ for (Method method : declaredMethods) {
+ JRubyMethod anno = method.getAnnotation(JRubyMethod.class);
+ if (anno == null) {
+ continue;
+ }
+ JavaMethodDescriptor desc = new JavaMethodDescriptor(method);
+ String name = anno.name().length == 0 ? method.getName() : anno.name()[0];
+ List<JavaMethodDescriptor> methodDescs;
+ Map<String, List<JavaMethodDescriptor>> methodsHash = null;
+ if (desc.isStatic) {
+ if (anno.compat() == CompatVersion.RUBY1_8) {
+ methodsHash = staticAnnotatedMethods1_8;
+ } else if (anno.compat() == CompatVersion.RUBY1_9) {
+ methodsHash = staticAnnotatedMethods1_9;
+ } else {
+ methodsHash = staticAnnotatedMethods;
+ }
+ } else {
+ if (anno.compat() == CompatVersion.RUBY1_8) {
+ methodsHash = annotatedMethods1_8;
+ } else if (anno.compat() == CompatVersion.RUBY1_9) {
+ methodsHash = annotatedMethods1_9;
+ } else {
+ methodsHash = annotatedMethods;
+ }
+ }
+ methodDescs = methodsHash.get(name);
+ if (methodDescs == null) {
+ methodDescs = new ArrayList<JavaMethodDescriptor>();
+ methodsHash.put(name, methodDescs);
+ }
+ methodDescs.add(desc);
+ }
+ }
+
+ public Map<String, List<JavaMethodDescriptor>> getAnnotatedMethods() {
+ return annotatedMethods;
+ }
+
+ public Map<String, List<JavaMethodDescriptor>> getAnnotatedMethods1_8() {
+ return annotatedMethods1_8;
+ }
+
+ public Map<String, List<JavaMethodDescriptor>> getAnnotatedMethods1_9() {
+ return annotatedMethods1_9;
+ }
+
+ public Map<String, List<JavaMethodDescriptor>> getStaticAnnotatedMethods() {
+ return staticAnnotatedMethods;
+ }
+
+ public Map<String, List<JavaMethodDescriptor>> getStaticAnnotatedMethods1_8() {
+ return staticAnnotatedMethods1_8;
+ }
+
+ public Map<String, List<JavaMethodDescriptor>> getStaticAnnotatedMethods1_9() {
+ return staticAnnotatedMethods1_9;
+ }
+}
39 src/org/jruby/anno/TypePopulator.java
View
@@ -5,15 +5,11 @@
package org.jruby.anno;
-import java.util.List;
-import java.util.Map;
-import org.jruby.RubyClass;
import org.jruby.RubyModule;
import org.jruby.internal.runtime.methods.CallConfiguration;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.internal.runtime.methods.JavaMethod;
import org.jruby.runtime.Arity;
-import org.jruby.runtime.MethodFactory;
import org.jruby.runtime.Visibility;
/**
@@ -36,39 +32,4 @@ public DynamicMethod populateModuleMethod(RubyModule cls, JavaMethod javaMethod)
}
public abstract void populate(RubyModule clsmod, Class clazz);
-
- public static final TypePopulator DEFAULT = new DefaultTypePopulator();
- public static class DefaultTypePopulator extends TypePopulator {
- public void populate(RubyModule clsmod, Class clazz) {
- // fallback on non-pregenerated logic
- MethodFactory methodFactory = MethodFactory.createFactory(clsmod.getRuntime().getJRubyClassLoader());
-
- RubyModule.MethodClumper clumper = new RubyModule.MethodClumper();
- clumper.clump(clazz);
-
- for (Map.Entry<String, List<JavaMethodDescriptor>> entry : clumper.getStaticAnnotatedMethods().entrySet()) {
- clsmod.defineAnnotatedMethod(entry.getKey(), entry.getValue(), methodFactory);
- }
-
- for (Map.Entry<String, List<JavaMethodDescriptor>> entry : clumper.getAnnotatedMethods().entrySet()) {
- clsmod.defineAnnotatedMethod(entry.getKey(), entry.getValue(), methodFactory);
- }
-
- for (Map.Entry<String, List<JavaMethodDescriptor>> entry : clumper.getStaticAnnotatedMethods1_8().entrySet()) {
- clsmod.defineAnnotatedMethod(entry.getKey(), entry.getValue(), methodFactory);
- }
-
- for (Map.Entry<String, List<JavaMethodDescriptor>> entry : clumper.getAnnotatedMethods1_8().entrySet()) {
- clsmod.defineAnnotatedMethod(entry.getKey(), entry.getValue(), methodFactory);
- }
-
- for (Map.Entry<String, List<JavaMethodDescriptor>> entry : clumper.getStaticAnnotatedMethods1_9().entrySet()) {
- clsmod.defineAnnotatedMethod(entry.getKey(), entry.getValue(), methodFactory);
- }
-
- for (Map.Entry<String, List<JavaMethodDescriptor>> entry : clumper.getAnnotatedMethods1_9().entrySet()) {
- clsmod.defineAnnotatedMethod(entry.getKey(), entry.getValue(), methodFactory);
- }
- }
- }
}
Please sign in to comment.
Something went wrong with that request. Please try again.