Skip to content

Commit

Permalink
Showing 2 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions lib/ruby/stdlib/jruby/compiler.rb
Original file line number Diff line number Diff line change
@@ -54,8 +54,8 @@ def compile_argv(argv)
options[:target] = target
end

opts.on("-J OPTION", "Pass OPTION to javac for javac compiles") do |options|
options[:javac_options] << options
opts.on("-J OPTION", "Pass OPTION to javac for javac compiles") do |o|
o[:javac_options] << o
end

opts.on("--java", "Generate Java classes (.java) for a script containing Ruby class definitions") do
43 changes: 22 additions & 21 deletions lib/ruby/stdlib/jruby/compiler/java_class.rb
Original file line number Diff line number Diff line change
@@ -413,17 +413,17 @@ def method_visibility=(visibility); @method_visibility = visibility end

def private_method(name)
return if name.to_s.eql?('initialize')
method = methods.find { |method| method.name.to_s == name.to_s } || raise(NoMethodError.new("could not find method :#{name}"))
method = methods.find { |m| m.name.to_s == name.to_s } || raise(NoMethodError.new("could not find method :#{name}"))
method.visibility = :private
end

def protected_method(name)
method = methods.find { |method| method.name.to_s == name.to_s } || raise(NoMethodError.new("could not find method :#{name}"))
method = methods.find { |m| m.name.to_s == name.to_s } || raise(NoMethodError.new("could not find method :#{name}"))
method.visibility = :protected
end

def public_method(name)
method = methods.find { |method| method.name.to_s == name.to_s } || raise(NoMethodError.new("could not find method :#{name}"))
method = methods.find { |m| m.name.to_s == name.to_s } || raise(NoMethodError.new("could not find method :#{name}"))
method.visibility = :public
end

@@ -651,18 +651,18 @@ def modifier_string
end

def typed_args
return @typed_args if @typed_args

i = 0
@typed_args = java_signature.parameters.map do |a|
type = a.type.name.to_s
if a.variable_name
var_name = a.variable_name
else
var_name = args[i]; i += 1
@typed_args ||= begin
i = 0
java_signature.parameters.map do |a|
type = a.type.name.to_s
if a.variable_name
var_name = a.variable_name
else
var_name = args[i]; i += 1
end

{ :name => var_name, :type => type }
end

{ :name => var_name, :type => type }
end
end

@@ -683,13 +683,14 @@ def var_names
end

def passed_args
return @passed_args if @passed_args

if arity <= MAX_UNBOXED_ARITY_LENGTH
@passed_args = var_names.map { |var| "ruby_arg_#{var}" }.join(', ')
@passed_args = ', ' + @passed_args if args.size > 0
else
@passed_args = ', ruby_args'
@passed_args ||= begin
if arity <= MAX_UNBOXED_ARITY_LENGTH
passed_args = var_names.map { |var| "ruby_arg_#{var}" }.join(', ')
passed_args = ', ' + passed_args if args.size > 0
passed_args
else
', ruby_args'
end
end
end

0 comments on commit 4eee05e

Please sign in to comment.