super inside def behaves incorrect when called via alias #927

mbj opened this Issue Jul 29, 2013 · 3 comments


None yet

2 participants

mbj commented Jul 29, 2013

When defining new on a class singleton that gets aliased to another name, super inside the class dispatches to the aliased, not the original name. MRI and RBX both behave different here and dispatch to superclasses original named method.


class Foo


  class << self
    alias_method :bar, :new




jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on OpenJDK 64-Bit Server VM 1.7.0_40-b31 +indy [linux-am

mbj@mbj ~/devel/crash (master*) % jruby crash.rb
NoMethodError: super: no superclass method `bar'
     new at crash.rb:4
  (root) at crash.rb:13


ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]

mbj@mbj ~/devel/crash (master*) % ruby crash.rb

I reduced this bug from around 20kloc, and hope you can fix it in the next minor release. I can trigger this very easily from my production code. Using 1.7.2 now where this bug does not exist.

mbj commented Jul 30, 2013

Update, turns out that using interpreted mode -X-C makes this bug disappear.

mbj commented Jul 30, 2013

Here is my full java -version

java version "1.7.0_40"
OpenJDK Runtime Environment (IcedTea 2.4.1) (ArchLinux build 7.u40_2.4.1-1-x86_64)
OpenJDK 64-Bit Server VM (build 24.0-b50, mixed mod

I believe this is fixed on master.

$ jruby -v crash.rb 
jruby (1.9.3p392) 2013-08-19 362730c on Java HotSpot(TM) 64-Bit Server VM 1.7.0_25-b15 [darwin-x86_64]

You can trying a package from or building it yourself.

I'm closing this now, but let me know if it's still a problem for you.

@BanzaiMan BanzaiMan closed this Aug 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment