-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Rescue clause yielding TypeError hits %undefined #2417
Comments
JRuby 1.7.18 fails with an error regarding rescue being used outside of a module or class. See jruby/jruby#2417.
Very weird. |
The same problem is on JRuby 9k too. I met with this issue in case of trying to pass tests of lotus-router on JRuby 9k.
|
Just stumbled on this one with jruby-9000-dev built yesterday. Inheriting from |
Ah yeah this is not an issue with 1.7.18 and is a problem with master/9k. #2267 is causing people to run specs against the wrong version of JRuby. I will update this issue and mark it against 9k. |
@ntl do you happen to have a reduces snippet for this? My repros of making an object inherited from BasicObject so far have not been blowing up. |
This will do it for me. I think you have to rescue an error within class ExposesJRuby2417 < BasicObject
def blow_up
begin
::Kernel.raise "error"
rescue
end
end
end
ExposesJRuby2417.new.blow_up |
@ntl Excellent! About as minimal as it probably gets... |
@enebo glad it's helpful. I strongly resisted the urge to golf it down further :) |
The problem is that 'StandardError' is not being found in the inheritance hierarchy when the class inherits BasicObject. So, maybe the bug is that in IR mode, we shouldn't be generating a lookup for StandardError but have it around. See the related FIXME in IRBuilder which talks of a different issue with having the class looked up. I think dealing with the FIXME will fix the issue. But, before I go ahead, it would be good to get some other eyes on it ( @enebo @headius ).
|
I think shortest near term fix would be to change module<0> to Class:Object right? I guess we should figure out it overriding this particular constant will change rescue behavior or not too since manipulating StandardErrror to something else at runtime seems like a horrible idea :) Having an operand for either behavior would probably be the thing to do once we figure out which way it is supposed to work.
|
Ok so I looked into @subbuss question: Object.const_set :StandardError, 1
class ExposesJRuby2417 < BasicObject
def blow_up
begin
::Kernel.raise "error"
rescue
puts "rescued"
end
end
end
ExposesJRuby2417.new.blow_up In MRI this prints "rescued" and in JRuby we complain about StandardError being '1'. |
[This may be a duplicate of Issue #2267, but it references jruby-head and I am able to give more detail about the failure mode.]
With the JRuby 1.7.18 release I started seeing the following error when running the Klam specs under Travis CI:
If I down-rev to JRuby 1.7.17, the tests pass. Here are examples of failing and passing builds differing only in the version of JRuby.
The code snippet that triggers the first of the failures is:
This string is generated by the Klam compiler and is being executed via
instance_eval
within an instance of a subclass ofBasicObject
.NOTE: I am not able to reproduce this failure locally under OS X with Java 1.7.0_67.
The text was updated successfully, but these errors were encountered: