Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
Expand Up @@ -5362,6 +5362,8 @@ public interface RecursiveFunctionEx<T> extends ThreadContext.RecursiveFunctionE
private JavaSupport javaSupport;
private final JRubyClassLoader jrubyClassLoader;

public static final Module JRUBY_MODULE = Ruby.class.getModule();

// Object Specializer
private final RubyObjectSpecializer objectSpecializer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ static Map<String, List<Method>> getMethods(final Class<?> javaClass) {
}

public static void eachAccessibleMethod(final Class<?> javaClass, Predicate<Method[]> classProcessor, Predicate<Method[]> interfaceProcessor) {
boolean isPublic = Modifier.isPublic(javaClass.getModifiers());
boolean isPublic = Ruby.JRUBY_MODULE.canRead(javaClass.getModule()) && Modifier.isPublic(javaClass.getModifiers());

// we scan all superclasses, but avoid adding superclass methods with
// same name+signature as subclass methods (see JRUBY-3130)
for ( Class<?> klass = javaClass; klass != null; klass = klass.getSuperclass() ) {
// only add if target class is public or source class is public, and package is exported
if ((isPublic || Modifier.isPublic(klass.getModifiers())) && Modules.isExported(klass, Java.class)) {
if ((isPublic || (Ruby.JRUBY_MODULE.canRead(klass.getModule()) && Modifier.isPublic(klass.getModifiers()))) && Modules.isExported(klass, Java.class)) {
// for each class, scan declared methods for new signatures
try {
// add methods, including static if this is the actual class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public static RubyClass pollAndGetClass(ThreadContext context, IRubyObject self)

public static MethodHandle findStatic(Class target, String name, MethodType type) {
try {
JRUBY_MODULE.addReads(target.getModule());
return LOOKUP.findStatic(target, name, type);
} catch (NoSuchMethodException|IllegalAccessException ex) {
throw new RuntimeException(ex);
Expand All @@ -84,7 +83,6 @@ public static MethodHandle findStatic(Class target, String name, MethodType type

public static MethodHandle findVirtual(Class target, String name, MethodType type) {
try {
JRUBY_MODULE.addReads(target.getModule());
return LOOKUP.findVirtual(target, name, type);
} catch (NoSuchMethodException|IllegalAccessException ex) {
throw new RuntimeException(ex);
Expand Down