Bug passing ruby objects through java objects


I've found that passing ruby objects to java classes that hold them

and return them causes the returned object to not respond to methods
that are not present in the java interface.

See the code below for an example. Note that the java class only

stores the RubyTableModel instance, but still object_id changes. This
looks like a bug.


require ‘java’

class RubyTableModel < javax.swing.table.DefaultTableModel
def additionalmethod

tablemodel = RubyTableModel.new
table = javax.swing.JTable.new(tablemodel)
tablemodel2 = table.model

puts tablemodel == tablemodel2
puts tablemodel.object_id
puts tablemodel2.object_id

puts tablemodel.additionalmethod
puts tablemodel2.additionalmethod

To unsubscribe from this list please visit:


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs