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 #3330

Closed

Conversation

eliaslevy
Copy link
Contributor

Matching fix for ##3329 for the 9.x master branch.

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
Copy link
Member

kares commented Sep 16, 2015

I believe #3329 should get over just fine with the jruby-1_7 merge ... keeping it open till than

@kares
Copy link
Member

kares commented Sep 16, 2015

on master 27e46d8 ... with a little merge cheating :)

@kares kares closed this Sep 16, 2015
@kares kares added this to the JRuby 9.0.2.0 milestone Sep 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants