Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: JRuby 1.6.7
    • Fix Version/s: None
    • Component/s: Compiler
    • Labels:
      None
    • Number of attachments :
      0

      Description

      I'm trying to compile a Ruby script to Java source using jrubyc.
      The compilation fails and i'd like to be able to identify the piece of script code that causes the compiler to fail.
      The compiler error message doesn't currently provide enough information for identifying the erroneous line from the compiler
      error output.

      jrubyc --verbose --java ruby

      Failure during compilation of file src/main/ruby/foo.rb:
      org.jruby.parser.ParserSyntaxException: syntax error, unexpected QUESTION
      org/jruby/parser/JavaSignatureParser.java:324:in `yyerror'
      org/jruby/parser/JavaSignatureParser.java:431:in `yyparse'
      org/jruby/parser/JavaSignatureParser.java:28:in `parse'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:142:in `build_signature'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:219:in `ClassNodeWalker'
      org/jruby/RubyKernel.java:2045:in `instance_eval'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:35:in `visit_args_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:179:in `with_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:34:in `visit_args_node'
      org/jruby/RubyProc.java:270:in `call'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:231:in `ClassNodeWalker'
      org/jruby/RubyKernel.java:2045:in `instance_eval'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:35:in `visit_defn_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:179:in `with_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:34:in `visit_defn_node'
      org/jruby/RubyProc.java:270:in `call'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:263:in `ClassNodeWalker'
      org/jruby/RubyKernel.java:2045:in `instance_eval'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:35:in `visit_newline_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:179:in `with_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:34:in `visit_newline_node'
      org/jruby/RubyProc.java:270:in `call'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:259:in `ClassNodeWalker'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/builtin/java/java.util.rb:7:in `each'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:259:in `ClassNodeWalker'
      org/jruby/RubyKernel.java:2045:in `instance_eval'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:35:in `visit_block_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:179:in `with_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:34:in `visit_block_node'
      org/jruby/RubyProc.java:270:in `call'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:225:in `ClassNodeWalker'
      org/jruby/RubyKernel.java:2045:in `instance_eval'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:35:in `visit_class_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:179:in `with_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:34:in `visit_class_node'
      org/jruby/RubyProc.java:270:in `call'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:263:in `ClassNodeWalker'
      org/jruby/RubyKernel.java:2045:in `instance_eval'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:35:in `visit_newline_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:179:in `with_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:34:in `visit_newline_node'
      org/jruby/RubyProc.java:270:in `call'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:259:in `ClassNodeWalker'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/builtin/java/java.util.rb:7:in `each'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:259:in `ClassNodeWalker'
      org/jruby/RubyKernel.java:2045:in `instance_eval'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:35:in `visit_block_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:179:in `with_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:34:in `visit_block_node'
      org/jruby/RubyProc.java:270:in `call'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:270:in `ClassNodeWalker'
      org/jruby/RubyKernel.java:2045:in `instance_eval'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:35:in `visit_root_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:179:in `with_node'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:34:in `visit_root_node'
      org/jruby/RubyProc.java:270:in `call'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb:8:in `generate_java'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler.rb:138:in `compile_files_with_options'
      org/jruby/RubyProc.java:270:in `call'
      org/jruby/RubyProc.java:220:in `call'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler.rb:208:in `compile_files_with_options'
      org/jruby/RubyArray.java:1615:in `each'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler.rb:207:in `compile_files_with_options'
      org/jruby/RubyArray.java:1615:in `each'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler.rb:198:in `compile_files_with_options'
      /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler.rb:90:in `compile_argv'
      /opt/jruby-1.6.7/bin/jrubyc:5:in `(root)'
      Compilation FAILED: 1 error(s) encountered

        Activity

        Hide
        Thomas E Enebo added a comment -

        Marko, Can you provide the signature which is causing this problem? You can put a print in /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb right before line 142. The last signature to print will be the signature we cannot compile. As a bonus of providing this information, I will try and make a better error message.

        Show
        Thomas E Enebo added a comment - Marko, Can you provide the signature which is causing this problem? You can put a print in /opt/jruby-1.6.7/lib/ruby/site_ruby/shared/jruby/compiler/java_class.rb right before line 142. The last signature to print will be the signature we cannot compile. As a bonus of providing this information, I will try and make a better error message.
        Hide
        marko asplund added a comment -

        here's the output from ClassNodeWalker.build_signature:

        **SIG: Object receive_push()
        **SIG: Object deliver_message(Object to,Object cc,Object subject,Object content)
        **SIG: Object configure_delivery(Object config)
        **SIG: Object configure_mail_defaults()
        **SIG: Object mail_configured?()

        so i take it that mail_configured is the offending method.
        the method is declared like this:

        def mail_configured?

        Show
        marko asplund added a comment - here's the output from ClassNodeWalker.build_signature: **SIG: Object receive_push() **SIG: Object deliver_message(Object to,Object cc,Object subject,Object content) **SIG: Object configure_delivery(Object config) **SIG: Object configure_mail_defaults() **SIG: Object mail_configured?() so i take it that mail_configured is the offending method. the method is declared like this: def mail_configured?
        Hide
        Charles Oliver Nutter added a comment -

        Reproduced with a trivial case:

        class Foo
          def blah?; end
        end
        

        I would imagine we're allowing the ? to get through and that's confounding the Java signature parser. A workaround:

        class Foo
          java_signature 'boolean isBlah()'
          def blah?; end
        end
        

        The JavaSignatureParser should provide a better error, though.

        Show
        Charles Oliver Nutter added a comment - Reproduced with a trivial case: class Foo def blah?; end end I would imagine we're allowing the ? to get through and that's confounding the Java signature parser. A workaround: class Foo java_signature 'boolean isBlah()' def blah?; end end The JavaSignatureParser should provide a better error, though.

          People

          • Assignee:
            Unassigned
            Reporter:
            marko asplund
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: