Hi developers,

I'm trying version 1.7 preview, which works great and fast btw.,  and
becoming a lot of warning concerning singleton on non-persistent Java
type.

The pattern, I'm using:

require 'java'
java_import java.util.ArrayList

class ArrayList
  def psize
    puts size
  end
end

list = ArrayList.new

list.instance_exec do
  psize
  add 10
  psize
end

While, currently it works, it generates warning:
jruby ss.rb
ss.rb:1 warning: singleton on non-persistent Java type
Java::JavaUtil::ArrayList (http://wiki.jruby.org/Persistence)
0
1

I understand, that singleton class will be generated, if I change
class definition with instance_exec, but executing methods should not
create singleton ? Or should it ?

While, of course, I could use:

list.psize
list.add 10
list.psize

i wanted to avoid it, because I have a lot of code which should be
executed like this.

I would really appreciate suggestions on how to achieve above
mentioned pattern, or maybe fix warning or generation of singleton.

Thanks in advance,
Maksym.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to