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

enhanced the java_class compiler so it can handle multiple constructors #1762

Merged
merged 1 commit into from Jul 3, 2014

Conversation

@jkutner
Copy link
Member

@jkutner jkutner commented Jun 25, 2014

This change would allow you to create multiple Java constructors for a Ruby class like so:

class Foo
  def initialize(a=nil)
    # ...
  end

  java_signature 'Foo()'
  def default_cnstr()
    # ...
  end
end

Such a capability is required for Java frameworks that require a no-arg constructor, even if your application code doesn't use it.

The call to java_signature.is_a?(Java::OrgJrubyAstJava_signature::ConstructorSignatureNode) in the java_class compiler is a little unfortunate. I'd prefer to add an isConstructor method to SignatureNode and override it to return true in ConstructorSignatureNode. I will update this PR with that change if it's desired.

Also, I can reopen this PR against master if needed.

@enebo enebo added this to the JRuby 1.7.14 milestone Jul 3, 2014
enebo added a commit that referenced this pull request Jul 3, 2014
enhanced the java_class compiler so it can handle multiple constructors
@enebo enebo merged commit e900dde into jruby:jruby-1_7 Jul 3, 2014
1 check failed
1 check failed
@enebo
continuous-integration/travis-ci The Travis CI build failed
Details
@enebo enebo modified the milestones: JRuby 1.7.14, JRuby 1.7.15 Aug 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants