Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing throw statements on ffi callback #4661

Closed
wants to merge 2 commits into from

Conversation

kares
Copy link
Member

@kares kares commented Jun 9, 2017

not sure about this one spec:ffi fails when the error is actually thrown

someone more familiar with the piece should look at it ...

HEREs the failed job: https://travis-ci.org/kares/jruby/jobs/241153466

@headius
Copy link
Member

headius commented Jun 9, 2017

Reproduced locally. I suspect there's some logic for unwrapping the Mapped type that did not get into our FFI.

@headius
Copy link
Member

headius commented Jun 9, 2017

This fixes it for me. Similar code seems to be in other type-wrangling logic.

diff --git a/core/src/main/java/org/jruby/ext/ffi/CallbackInfo.java b/core/src/main/java/org/jruby/ext/ffi/CallbackInfo.java
index 34d68a3cf4..79799dd89d 100644
--- a/core/src/main/java/org/jruby/ext/ffi/CallbackInfo.java
+++ b/core/src/main/java/org/jruby/ext/ffi/CallbackInfo.java
@@ -110,6 +110,10 @@ public class CallbackInfo extends Type {
                     + returnType.getMetaClass().getName() + " (expected FFI::Type)");
         }
 
+        if (returnType instanceof MappedType) {
+            returnType = ((MappedType) returnType).getRealType();
+        }
+
         if (!(paramTypes instanceof RubyArray)) {
             throw context.runtime.newTypeError("wrong argument type "
                     + paramTypes.getMetaClass().getName() + " (expected Array)");

@kares kares changed the title adding a missing throw statements on ffi callback fails spec missing throw statements on ffi callback Jun 10, 2017
@kares kares added this to the JRuby 9.1.11.0 milestone Jun 10, 2017
@kares
Copy link
Member Author

kares commented Jun 10, 2017

now on master (6d924dc), thanks

@kares kares closed this Jun 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants