Method call into java is choosing the wrong method by argument type.
--------------------------------------------------------------------
Key: JRUBY-4631
URL: http://jira.codehaus.org/browse/JRUBY-4631
Project: JRuby
Issue Type: Bug
Components: Java Integration
Affects Versions: JRuby 1.5
Environment: tested on snow leopard, java: Java HotSpot(TM) 64-Bit
Server VM (build 14.3-b01-101, mixed mode)
Reporter: Daniel Lucraft
This code:
require 'java'
class MyTask
include java.util.concurrent.Callable
def call
sleep 2
puts "done"
101
end
end
executor = java.util.concurrent.Executors.newSingleThreadExecutor
future = executor.submit(MyTask.new)
p future.get
executor.shutdown
Gives this error:
$ jruby pool.rb
# pool.rb:16: for method AbstractExecutorService.submit expected [class
java.lang.Runnable]; got: [MyTask_795305215]; error: argument type mismatch
(TypeError)
On JRuby 1.4, and the correct behaviour, it outputs:
$ jruby pool.rb
done
101
It seems that JRuby is selecting submit(Runnable) instead of submit(Callable).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email