Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.0.0RC2
-
Fix Version/s: JRuby 1.1b1
-
Component/s: Java Integration
-
Labels:None
-
Number of attachments :
Description
This patch will allow plain Ruby objects to be passed to Java method arguments that are interface types, and the Ruby object will automatically be wrapped in an interface proxy, as originally proposed here.
Another example:
include Java filter = Object.new def filter.accept(file, str) !!(str =~ /jar/) end file = java.io.File.new("lib") file.list(filter).each {|f| puts f}
I still think this approach has a place alongside the rest of the recently revamped java integration. It's somewhat of an edge case in that the code will only be activated when you pass a vanilla Ruby object to Java; I think the chance for unexpected surprises is low.
Patch generated based on 3727.