本文整理了Java中org.jruby.RubyClass.checkInheritable
方法的一些代码示例,展示了RubyClass.checkInheritable
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyClass.checkInheritable
方法的具体详情如下:
包路径:org.jruby.RubyClass
类名称:RubyClass
方法名:checkInheritable
[英]rb_check_inheritable
[中]rb_检查_可继承
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static RubyClass prepareSuperClass(Ruby runtime, IRubyObject rubyClass) {
RubyClass.checkInheritable(rubyClass); // use the same logic as in EvaluationState
return (RubyClass)rubyClass;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static RubyClass prepareSuperClass(Ruby runtime, IRubyObject rubyClass) {
RubyClass.checkInheritable(rubyClass); // use the same logic as in EvaluationState
return (RubyClass)rubyClass;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "initialize", compat = RUBY1_9, visibility = PRIVATE)
public IRubyObject initialize19(ThreadContext context, IRubyObject superObject, Block block) {
checkNotInitialized();
checkInheritable(superObject);
return initializeCommon(context, (RubyClass)superObject, block, true);
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "initialize", visibility = PRIVATE)
public IRubyObject initialize19(ThreadContext context, IRubyObject superObject, Block block) {
checkNotInitialized();
checkInheritable(superObject);
return initializeCommon(context, (RubyClass) superObject, block);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(compat = RUBY1_8, visibility = PRIVATE)
public IRubyObject initialize(ThreadContext context, IRubyObject superObject, Block block) {
checkNotInitialized();
checkInheritable(superObject);
return initializeCommon(context, (RubyClass)superObject, block, false);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(name = "initialize", visibility = PRIVATE)
public IRubyObject initialize19(ThreadContext context, IRubyObject superObject, Block block) {
checkNotInitialized();
checkInheritable(superObject);
return initializeCommon(context, (RubyClass) superObject, block);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(compat = RUBY1_8, visibility = PRIVATE)
public IRubyObject initialize(ThreadContext context, IRubyObject superObject, Block block) {
checkNotInitialized();
checkInheritable(superObject);
return initializeCommon(context, (RubyClass)superObject, block, false);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "initialize", compat = RUBY1_9, visibility = PRIVATE)
public IRubyObject initialize19(ThreadContext context, IRubyObject superObject, Block block) {
checkNotInitialized();
checkInheritable(superObject);
return initializeCommon(context, (RubyClass)superObject, block, true);
}
代码示例来源:origin: org.jruby/jruby-complete
public static RubyModule newRubyClassFromIR(Ruby runtime, IRScope irClassBody, Object superClass, Object container) {
if (!(container instanceof RubyModule)) {
throw runtime.newTypeError("no outer class/module");
}
RubyModule newRubyClass;
if (irClassBody instanceof IRMetaClassBody) {
newRubyClass = ((RubyModule)container).getMetaClass();
} else {
RubyClass sc;
if (superClass == UndefinedValue.UNDEFINED) {
sc = null;
} else {
RubyClass.checkInheritable((IRubyObject) superClass);
sc = (RubyClass) superClass;
}
newRubyClass = ((RubyModule)container).defineOrGetClassUnder(irClassBody.getId(), sc);
}
irClassBody.getStaticScope().setModule(newRubyClass);
return newRubyClass;
}
代码示例来源:origin: org.jruby/jruby-core
public static RubyModule newRubyClassFromIR(Ruby runtime, IRScope irClassBody, Object superClass, Object container) {
if (!(container instanceof RubyModule)) {
throw runtime.newTypeError("no outer class/module");
}
RubyModule newRubyClass;
if (irClassBody instanceof IRMetaClassBody) {
newRubyClass = ((RubyModule)container).getMetaClass();
} else {
RubyClass sc;
if (superClass == UndefinedValue.UNDEFINED) {
sc = null;
} else {
RubyClass.checkInheritable((IRubyObject) superClass);
sc = (RubyClass) superClass;
}
newRubyClass = ((RubyModule)container).defineOrGetClassUnder(irClassBody.getId(), sc);
}
irClassBody.getStaticScope().setModule(newRubyClass);
return newRubyClass;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Override
public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
RubyModule enclosingClass = cpath.getEnclosingModule(runtime, context, self, aBlock);
// TODO: Figure out how this can happen and possibly remove
if (enclosingClass == null) throw runtime.newTypeError("no outer class/module");
RubyClass superClass = null;
if (superNode != null) {
IRubyObject superObj = superNode.interpret(runtime, context, self, aBlock);
RubyClass.checkInheritable(superObj);
superClass = (RubyClass)superObj;
}
RubyClass clazz = enclosingClass.defineOrGetClassUnder(cpath.getName(), superClass);
scope.setModule(clazz);
IRubyObject classBodyResult = ASTInterpreter.evalClassDefinitionBody(runtime, context, scope, bodyNode, clazz, self, aBlock);
return classBodyResult;
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
RubyModule enclosingClass = cpath.getEnclosingModule(runtime, context, self, aBlock);
// TODO: Figure out how this can happen and possibly remove
if (enclosingClass == null) throw runtime.newTypeError("no outer class/module");
RubyClass superClass = null;
if (superNode != null) {
IRubyObject superObj = superNode.interpret(runtime, context, self, aBlock);
RubyClass.checkInheritable(superObj);
superClass = (RubyClass)superObj;
}
RubyClass clazz = enclosingClass.defineOrGetClassUnder(cpath.getName(), superClass);
scope.setModule(clazz);
IRubyObject classBodyResult = ASTInterpreter.evalClassDefinitionBody(runtime, context, scope, bodyNode, clazz, self, aBlock);
return classBodyResult;
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private static RubyClass createProxyClass(Ruby runtime, RubyClass baseType,
JavaClass javaClass, boolean invokeInherited) {
// JRUBY-2938 the proxy class might already exist
RubyClass proxyClass = javaClass.getProxyClass();
if (proxyClass != null) return proxyClass;
// this needs to be split, since conditional calling #inherited doesn't fit standard ruby semantics
RubyClass.checkInheritable(baseType);
RubyClass superClass = (RubyClass) baseType;
proxyClass = RubyClass.newClass(runtime, superClass);
proxyClass.makeMetaClass(superClass.getMetaClass());
try {
javaClass.javaClass().asSubclass(java.util.Map.class);
proxyClass.setAllocator(runtime.getJavaSupport().getMapJavaProxyClass().getAllocator());
proxyClass.defineAnnotatedMethods(MapJavaProxy.class);
proxyClass.includeModule(runtime.getEnumerable());
} catch (ClassCastException e) {
proxyClass.setAllocator(superClass.getAllocator());
}
if (invokeInherited) {
proxyClass.inherit(superClass);
}
proxyClass.callMethod(runtime.getCurrentContext(), "java_class=", javaClass);
javaClass.setupProxy(proxyClass);
// add java_method for unbound use
proxyClass.defineAnnotatedMethods(JavaProxyClassMethods.class);
return proxyClass;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private static RubyClass createProxyClass(Ruby runtime, RubyClass baseType,
JavaClass javaClass, boolean invokeInherited) {
// JRUBY-2938 the proxy class might already exist
RubyClass proxyClass = javaClass.getProxyClass();
if (proxyClass != null) return proxyClass;
// this needs to be split, since conditional calling #inherited doesn't fit standard ruby semantics
RubyClass.checkInheritable(baseType);
RubyClass superClass = (RubyClass) baseType;
proxyClass = RubyClass.newClass(runtime, superClass);
proxyClass.makeMetaClass(superClass.getMetaClass());
try {
javaClass.javaClass().asSubclass(java.util.Map.class);
proxyClass.setAllocator(runtime.getJavaSupport().getMapJavaProxyClass().getAllocator());
proxyClass.defineAnnotatedMethods(MapJavaProxy.class);
proxyClass.includeModule(runtime.getEnumerable());
} catch (ClassCastException e) {
proxyClass.setAllocator(superClass.getAllocator());
}
if (invokeInherited) {
proxyClass.inherit(superClass);
}
proxyClass.callMethod(runtime.getCurrentContext(), "java_class=", javaClass);
javaClass.setupProxy(proxyClass);
// add java_method for unbound use
proxyClass.defineAnnotatedMethods(JavaProxyClassMethods.class);
return proxyClass;
}
内容来源于网络,如有侵权,请联系作者删除!