Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix java_implements for multiple interfaces #3329

merged 1 commit into from Sep 16, 2015


Copy link

Using multiple interfaces with java_implements is broken, and the specs that tests for this are also broken. This fixes it.

It also appears that many of the jrubyc specs are broken enough though they pass. Those are not fixed here. In general, it appears the specs attempt to do a regexp match against the generated Java code, but the tests pass not because the generated code is correct, but because the generated code includes a copy of the spec source code in the source variable. Thus, the regexp is matching itself and not the generated Java code.

It would appear that the call to JRuby::Compiler::JavaGenerator.generate_java results in the whole spec being included in the source variable rather than just the source for the Ruby code being compiled to Java.


public class Foo extends RubyObject implements Runnable {
    private static final Ruby __ruby__ = Ruby.getGlobalRuntime();
    private static final RubyClass __metaclass__;

    static {
        String source = new StringBuilder("require File.dirname(__FILE__) + \"/../../spec_helper\"\n" +
            "require 'jruby'\n" +
            "require 'jruby/compiler'\n" +
            "\n" +

kares added a commit that referenced this pull request Sep 16, 2015
Fix java_implements for multiple interfaces
@kares kares merged commit ffdf530 into jruby:jruby-1_7 Sep 16, 2015
@kares kares added this to the JRuby 1.7.23 milestone Sep 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants