Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Not A Bug
    • Affects Version/s: JRuby 1.6.6
    • Fix Version/s: None
    • Component/s: Ruby 1.9.3
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      Found when I was trying to get mperham/sidekiq up on Travis with JRuby 1.6.6.

      MRI 1.9.3 will output the attached script with the correct YAML representation of the array (var obj)

      ---
      - !ruby/class 'MyMailer'
      - :greetings
      - - 1
        - 2
      

      JRuby throws a TypeError

      TypeError: can't dump anonymous class Class
        visit_Class at /home/jesse/.rvm/rubies/jruby-1.6.6/lib/ruby/1.9/psych/visitors/yaml_tree.rb:211
           __send__ at org/jruby/RubyBasicObject.java:1700
               send at org/jruby/RubyKernel.java:2099
             accept at /home/jesse/.rvm/rubies/jruby-1.6.6/lib/ruby/1.9/psych/visitors/yaml_tree.rb:63
        visit_Array at /home/jesse/.rvm/rubies/jruby-1.6.6/lib/ruby/1.9/psych/visitors/yaml_tree.rb:246
               each at org/jruby/RubyArray.java:1614
        visit_Array at /home/jesse/.rvm/rubies/jruby-1.6.6/lib/ruby/1.9/psych/visitors/yaml_tree.rb:246
           __send__ at org/jruby/RubyBasicObject.java:1700
               send at org/jruby/RubyKernel.java:2099
             accept at /home/jesse/.rvm/rubies/jruby-1.6.6/lib/ruby/1.9/psych/visitors/yaml_tree.rb:63
                 << at /home/jesse/.rvm/rubies/jruby-1.6.6/lib/ruby/1.9/psych/visitors/yaml_tree.rb:36
               dump at /home/jesse/.rvm/rubies/jruby-1.6.6/lib/ruby/1.9/psych.rb:165
             (root) at scratch.rb:12
      

        Activity

        Hide
        Jesse Cooke added a comment -

        Thanks for reformatting. I'm unfamiliar with jira.

        Show
        Jesse Cooke added a comment - Thanks for reformatting. I'm unfamiliar with jira.
        Hide
        Charles Oliver Nutter added a comment -

        We behave correctly according to 1.9.2, which is the version of MRI that JRuby 1.6.x aims for. Master is 1.9.3 compatible, and does what you expect.

        In Syck:

        system ~/projects/jruby2 $ ruby1.9.2 ~/Downloads/scratch.rb 
        /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:6:in `to_yaml': can't dump anonymous class Class (TypeError)
        	from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:114:in `node_export'
        	from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:114:in `add'
        	from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:114:in `block (3 levels) in to_yaml'
        	from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:113:in `each'
        	from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:113:in `block (2 levels) in to_yaml'
        	from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:112:in `seq'
        	from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:112:in `block in to_yaml'
        	from /usr/local/lib/ruby/1.9.1/syck.rb:401:in `call'
        	from /usr/local/lib/ruby/1.9.1/syck.rb:401:in `emit'
        	from /usr/local/lib/ruby/1.9.1/syck.rb:401:in `quick_emit'
        	from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:111:in `to_yaml'
        	from /usr/local/lib/ruby/1.9.1/syck.rb:119:in `dump'
        	from /Users/headius/Downloads/scratch.rb:11:in `<main>'
        

        and Psych:

        system ~/projects/jruby2 $ rvm 1.9.2 do ruby ~/Downloads/scratch.rb 
        /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:211:in `visit_Class': can't dump anonymous class Class (TypeError)
        	from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:63:in `accept'
        	from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:246:in `block in visit_Array'
        	from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:246:in `each'
        	from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:246:in `visit_Array'
        	from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:63:in `accept'
        	from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:36:in `<<'
        	from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:165:in `dump'
        	from /Users/headius/Downloads/scratch.rb:11:in `<main>'
        
        Show
        Charles Oliver Nutter added a comment - We behave correctly according to 1.9.2, which is the version of MRI that JRuby 1.6.x aims for. Master is 1.9.3 compatible, and does what you expect. In Syck: system ~/projects/jruby2 $ ruby1.9.2 ~/Downloads/scratch.rb /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:6:in `to_yaml': can't dump anonymous class Class (TypeError) from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:114:in `node_export' from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:114:in `add' from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:114:in `block (3 levels) in to_yaml' from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:113:in `each' from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:113:in `block (2 levels) in to_yaml' from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:112:in `seq' from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:112:in `block in to_yaml' from /usr/local/lib/ruby/1.9.1/syck.rb:401:in `call' from /usr/local/lib/ruby/1.9.1/syck.rb:401:in `emit' from /usr/local/lib/ruby/1.9.1/syck.rb:401:in `quick_emit' from /usr/local/lib/ruby/1.9.1/syck/rubytypes.rb:111:in `to_yaml' from /usr/local/lib/ruby/1.9.1/syck.rb:119:in `dump' from /Users/headius/Downloads/scratch.rb:11:in `<main>' and Psych: system ~/projects/jruby2 $ rvm 1.9.2 do ruby ~/Downloads/scratch.rb /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:211:in `visit_Class': can't dump anonymous class Class (TypeError) from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:63:in `accept' from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:246:in `block in visit_Array' from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:246:in `each' from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:246:in `visit_Array' from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:63:in `accept' from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:36:in `<<' from /Users/headius/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:165:in `dump' from /Users/headius/Downloads/scratch.rb:11:in `<main>'
        Hide
        Jesse Cooke added a comment -

        I thought 1.6.6 was up to 1.9.3 but I was wrong. We'll wait until 1.7 to support JRuby. Thanks for the clarification!

        Show
        Jesse Cooke added a comment - I thought 1.6.6 was up to 1.9.3 but I was wrong. We'll wait until 1.7 to support JRuby. Thanks for the clarification!
        Hide
        Anil Wadghule added a comment -

        This issue persists on JRuby 1.6.7 1.9 mode

        anil.wadghule@Anil-Wadghule-Mac ~/Code/jruby &#955; rvm use ruby-1.9.3
        Using /Users/anil.wadghule/.rvm/gems/ruby-1.9.3-p125
        anil.wadghule@Anil-Wadghule-Mac ~/Code/jruby &#955; ruby dump_anonymous_class.rb 
        ---
        - !ruby/class 'MyMailer'
        - :greetings
        - - 1
          - 2
        anil.wadghule@Anil-Wadghule-Mac ~/Code/jruby &#955; rvm use jruby
        Using /Users/anil.wadghule/.rvm/gems/jruby-1.6.7
        anil.wadghule@Anil-Wadghule-Mac ~/Code/jruby &#955; export JRUBY_OPTS=--1.9
        anil.wadghule@Anil-Wadghule-Mac ~/Code/jruby &#955; ruby dump_anonymous_class.rb 
        TypeError: can't dump anonymous class Class
          visit_Class at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych/visitors/yaml_tree.rb:211
             __send__ at org/jruby/RubyBasicObject.java:1704
                 send at org/jruby/RubyKernel.java:2101
               accept at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych/visitors/yaml_tree.rb:63
          visit_Array at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych/visitors/yaml_tree.rb:246
                 each at org/jruby/RubyArray.java:1615
          visit_Array at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych/visitors/yaml_tree.rb:246
             __send__ at org/jruby/RubyBasicObject.java:1704
                 send at org/jruby/RubyKernel.java:2101
               accept at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych/visitors/yaml_tree.rb:63
                   << at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych/visitors/yaml_tree.rb:36
                 dump at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych.rb:165
               (root) at dump_anonymous_class.rb:11
        

        It should behave like Ruby 1.9.3 right?

        Show
        Anil Wadghule added a comment - This issue persists on JRuby 1.6.7 1.9 mode anil.wadghule@Anil-Wadghule-Mac ~/Code/jruby &#955; rvm use ruby-1.9.3 Using /Users/anil.wadghule/.rvm/gems/ruby-1.9.3-p125 anil.wadghule@Anil-Wadghule-Mac ~/Code/jruby &#955; ruby dump_anonymous_class.rb --- - !ruby/class 'MyMailer' - :greetings - - 1 - 2 anil.wadghule@Anil-Wadghule-Mac ~/Code/jruby &#955; rvm use jruby Using /Users/anil.wadghule/.rvm/gems/jruby-1.6.7 anil.wadghule@Anil-Wadghule-Mac ~/Code/jruby &#955; export JRUBY_OPTS=--1.9 anil.wadghule@Anil-Wadghule-Mac ~/Code/jruby &#955; ruby dump_anonymous_class.rb TypeError: can't dump anonymous class Class visit_Class at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych/visitors/yaml_tree.rb:211 __send__ at org/jruby/RubyBasicObject.java:1704 send at org/jruby/RubyKernel.java:2101 accept at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych/visitors/yaml_tree.rb:63 visit_Array at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych/visitors/yaml_tree.rb:246 each at org/jruby/RubyArray.java:1615 visit_Array at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych/visitors/yaml_tree.rb:246 __send__ at org/jruby/RubyBasicObject.java:1704 send at org/jruby/RubyKernel.java:2101 accept at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych/visitors/yaml_tree.rb:63 << at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych/visitors/yaml_tree.rb:36 dump at /Users/anil.wadghule/.rvm/rubies/jruby-1.6.7/lib/ruby/1.9/psych.rb:165 (root) at dump_anonymous_class.rb:11 It should behave like Ruby 1.9.3 right?
        Hide
        Anil Wadghule added a comment -

        I assumed JRuby 1.6.7 is upto 1.9.3. But came to know from RUBY_DESCRIPTION it is upto ruby-1.9.2-p312.

        Show
        Anil Wadghule added a comment - I assumed JRuby 1.6.7 is upto 1.9.3. But came to know from RUBY_DESCRIPTION it is upto ruby-1.9.2-p312.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Jesse Cooke
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: