Skip to content

Commit

Permalink
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions core/src/main/java/org/jruby/RubyClass.java
Original file line number Diff line number Diff line change
@@ -500,10 +500,6 @@ public IRubyObject invoke(ThreadContext context, IRubyObject self, int methodInd
return invoke(context, self, name, args, callType, block);
}

public boolean notVisibleAndNotMethodMissing(DynamicMethod method, String name, IRubyObject caller, CallType callType) {
return !method.isCallableFrom(caller, callType) && !name.equals("method_missing");
}

public IRubyObject invoke(ThreadContext context, IRubyObject self, String name,
CallType callType, Block block) {
DynamicMethod method = searchMethod(name);
@@ -850,14 +846,19 @@ private void generateMethodAnnotations(Map<Class, Map<String, Object>> methodAnn
}
}

private boolean shouldCallMethodMissing(DynamicMethod method) {
private static boolean shouldCallMethodMissing(DynamicMethod method) {
return method.isUndefined();
}
private boolean shouldCallMethodMissing(DynamicMethod method, String name, IRubyObject caller, CallType callType) {

private static boolean shouldCallMethodMissing(DynamicMethod method, String name, IRubyObject caller, CallType callType) {
return method.isUndefined() || notVisibleAndNotMethodMissing(method, name, caller, callType);
}

public IRubyObject invokeInherited(ThreadContext context, IRubyObject self, IRubyObject subclass) {
private static boolean notVisibleAndNotMethodMissing(DynamicMethod method, String name, IRubyObject caller, CallType callType) {
return !method.isCallableFrom(caller, callType) && !name.equals("method_missing");
}

public final IRubyObject invokeInherited(ThreadContext context, IRubyObject self, IRubyObject subclass) {
DynamicMethod method = getMetaClass().searchMethod("inherited");

if (method.isUndefined()) {
@@ -973,20 +974,18 @@ protected void setModuleSuperClass(RubyClass superClass) {
setSuperClass(superClass);
}

public Collection<RubyClass> subclasses(boolean includeDescendants) {
Set<RubyClass> mySubclasses = subclasses;
if (mySubclasses != null) {
Collection<RubyClass> mine = new ArrayList<RubyClass>(mySubclasses);
public final Collection<RubyClass> subclasses(boolean includeDescendants) {
final Set<RubyClass> subclasses = this.subclasses;
if (subclasses != null) {
Collection<RubyClass> classes = new ArrayList<RubyClass>(subclasses);
if (includeDescendants) {
for (RubyClass i: mySubclasses) {
mine.addAll(i.subclasses(includeDescendants));
for ( RubyClass klass: subclasses ) {
classes.addAll(klass.subclasses(includeDescendants));
}
}

return mine;
} else {
return Collections.EMPTY_LIST;
return classes;
}
return Collections.EMPTY_LIST;
}

/**
@@ -1037,7 +1036,7 @@ public synchronized void replaceSubclass(RubyClass subclass, RubyClass newSubcla
}

@Override
public void becomeSynchronized() {
public final void becomeSynchronized() {
// make this class and all subclasses sync
synchronized (getRuntime().getHierarchyLock()) {
super.becomeSynchronized();

0 comments on commit 0f2789d

Please sign in to comment.