Fix java_implements for multiple interfaces #3329

Merged
merged 1 commit into from Sep 16, 2015

Conversation

Projects
None yet
2 participants
@eliaslevy
Contributor

eliaslevy commented Sep 15, 2015

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.

E.g.

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

Merge pull request #3329 from eliaslevy/fix_interface_string_join
Fix java_implements for multiple interfaces

@kares kares merged commit ffdf530 into jruby:jruby-1_7 Sep 16, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@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