Skip to content

Commit 1330f22

Browse files
committed
Use a respond_to site for path check
1 parent 1c7dd96 commit 1330f22

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ext/java/org/jruby/ext/psych/PsychParser.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import org.jruby.javasupport.JavaUtil;
5050
import org.jruby.runtime.Block;
5151
import org.jruby.runtime.Helpers;
52+
import org.jruby.runtime.JavaSites;
5253
import org.jruby.runtime.ThreadContext;
5354
import org.jruby.runtime.builtin.IRubyObject;
5455
import org.jruby.runtime.callsite.CachingCallSite;
@@ -248,8 +249,9 @@ public IRubyObject parse(ThreadContext context, IRubyObject handler, IRubyObject
248249
LoadSettings loadSettings = loadSettingsBuilder.build();
249250
parser = new ParserImpl(loadSettings, new ScannerImpl(loadSettings, readerFor(context, yaml, loadSettings)));
250251

251-
if (path.isNil() && yaml.respondsTo("path")) {
252-
path = sites.path.call(context, this, yaml);
252+
JavaSites.CheckedSites pathSites = sites.path;
253+
if (path.isNil() && pathSites.respond_to_X.respondsTo(context, yaml, yaml)) {
254+
path = pathSites.site.call(context, this, yaml);
253255
}
254256

255257
while (parser.hasNext()) {
@@ -651,7 +653,7 @@ private LoadSettings buildSettings() {
651653
private final CallSites sites;
652654

653655
private static class CallSites {
654-
private final CachingCallSite path = new FunctionalCachingCallSite("path");
656+
private final JavaSites.CheckedSites path = new JavaSites.CheckedSites("path");
655657
private final CachingCallSite event_location = new FunctionalCachingCallSite("event_location");
656658
private final CachingCallSite start_stream = new FunctionalCachingCallSite("start_stream");
657659
private final CachingCallSite start_document = new FunctionalCachingCallSite("start_document");

0 commit comments

Comments
 (0)