Class: Duby::JVM::Types::JavaStaticMethod

Inherits:
JavaMethod show all
Defined in:
lib/duby/jvm/types/methods.rb

Instance Attribute Summary

Attributes inherited from JavaCallable

#member

Instance Method Summary collapse

Methods inherited from JavaMethod

#abstract?, #actual_return_type, #call_special, #constructor?, #return_type, #static?, #void?

Methods inherited from JavaConstructor

#actual_return_type, #argument_types, #constructor?, #declaring_class, #exceptions, #return_type

Methods inherited from JavaCallable

#field?, #initialize, #name, #parameter_types

Methods included from ArgumentConversion

#convert_args

Constructor Details

This class inherits a constructor from Duby::JVM::Types::JavaCallable

Instance Method Details

#call(compiler, ast, expression) ⇒ Object



240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/duby/jvm/types/methods.rb', line 240

def call(compiler, ast, expression)
  target = ast.target.inferred_type
  convert_args(compiler, ast.parameters)
  compiler.method.invokestatic(
    target,
    name,
    [@member.return_type, *@member.argument_types])
  # if expression, void static methods return null, for consistency
  # TODO: inference phase needs to track that signature is void
  # but actual type is null object
  compiler.method.aconst_null if expression && void?
  compiler.method.pop unless expression || void?
end