Skip to content

Commit

Permalink
Showing 3 changed files with 11 additions and 16 deletions.
11 changes: 0 additions & 11 deletions core/src/main/java/org/jruby/javasupport/DummyForJavaUtil.java

This file was deleted.

5 changes: 5 additions & 0 deletions core/src/main/java/org/jruby/javasupport/Java.java
Original file line number Diff line number Diff line change
@@ -1647,4 +1647,9 @@ static boolean isDefaultMethod(final Method method) {
return false;
}

/**
* @see JavaUtil#CAN_SET_ACCESSIBLE
*/
@SuppressWarnings("unused") private static final byte _ = 72;

}
11 changes: 6 additions & 5 deletions core/src/main/java/org/jruby/javasupport/JavaUtil.java
Original file line number Diff line number Diff line change
@@ -98,12 +98,13 @@ public class JavaUtil {

if (RubyInstanceConfig.CAN_SET_ACCESSIBLE) {
try {
// We want to check if we can access a commonly-existing private field through reflection. If so,
// we're probably able to access some other fields too later on.
Field f = DummyForJavaUtil.class.getDeclaredField("PRIVATE");
// We want to check if we can access a commonly-existing private field through reflection.
// If so, we're probably able to access some other fields too later on.
Field f = Java.class.getDeclaredField("_");
f.setAccessible(true);
canSetAccessible = f.get(null).equals(DummyForJavaUtil.PUBLIC);
} catch (Exception t) {
canSetAccessible = f.getByte(null) == 72;
}
catch (Exception t) {
// added this so if things are weird in the future we can debug without
// spinning a new binary
if (Options.JI_LOGCANSETACCESSIBLE.load()) {

1 comment on commit f17102c

@headius
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.