Skip to content

private and private :foo have different semantics when compiling to Java #4469

@alyssais

Description

@alyssais

Environment

jruby -v
jruby 9.1.7.0 (2.3.1) 2017-01-11 68056ae Java HotSpot(TM) 64-Bit Server VM 25.112-b16 on 1.8.0_112-b16 +jit [darwin-x86_64]
uname -a
Darwin zoroark 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64

Expected Behavior

class Foo
  private
  def foo?
    true
  end
end

should be compiled with jrubyc --java to the same Java as

class Foo
  def foo?
    true
  end
  private :foo?
end

(The foo? method should not be generated in Java.)

Actual Behavior

JRuby tries to compile the first example's foo? method to Java, which fails because -? methods aren't supported in Java.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions