Implement SignalException class #4126

Merged
merged 3 commits into from Sep 15, 2016

Projects

None yet

4 participants

@etehtsea
Contributor
etehtsea commented Sep 1, 2016 edited

Fixes #3954

@kares kares and 2 others commented on an outdated diff Sep 1, 2016
core/src/main/java/org/jruby/RubySignalException.java
+ protected RubySignalException(Ruby runtime, RubyClass exceptionClass) {
+ super(runtime, exceptionClass);
+ }
+
+ static RubyClass createSignalExceptionClass(Ruby runtime, RubyClass exceptionClass) {
+ RubyClass signalExceptionClass = runtime.defineClass("SignalException", exceptionClass, SIGNAL_EXCEPTION_ALLOCATOR);
+ signalExceptionClass.defineAnnotatedMethods(RubySignalException.class);
+
+ return signalExceptionClass;
+ }
+
+ @JRubyMethod(optional = 2, visibility = PRIVATE)
+ public IRubyObject initialize(IRubyObject[] args, Block block) {
+ final Ruby runtime = getRuntime();
+ int argnum = 1;
+ IRubyObject sig = runtime.getCurrentContext().nil;
@kares
kares Sep 1, 2016 Member

its probably better to receive ThreadContext context instead or simply do a runtime.getNil() if the context is not needed anywhere else.

@etehtsea
etehtsea Sep 1, 2016 Contributor

done. thanks for review!

@enebo
enebo Sep 1, 2016 Member

@etehtsea @kares whether context is used or not we should always provide it as first argument to @JRubyMethod annotations so it will be future-proofed. We want to make sure these method signatures never need to change for native extension authors.

@etehtsea a second tidbit of info is getRuntime().getCurrentContext() is not super quick which lead to us adding the ability to pass ThreadContext to method bindings. We probably should have made it mandatory in 9k but we didn't :|

@etehtsea
etehtsea Sep 1, 2016 Contributor

done

@kares kares added this to the JRuby 9.1.5.0 milestone Sep 2, 2016
@kares
Member
kares commented Sep 2, 2016

should be 🍏 to go.

@headius
Member
headius commented Sep 6, 2016

@etehtsea There seems to be a number of whitespace changes in your commits. Would it be possible to strip those out? Otherwise I'll need to merge manually and omit them myself.

@etehtsea
Contributor
etehtsea commented Sep 7, 2016

@headius done

etehtsea added some commits Sep 7, 2016
@etehtsea etehtsea Extract operations with signal name to fns 08d64dc
@etehtsea etehtsea Also fix Interrupt class
6b793be
@kares kares modified the milestone: JRuby 9.1.6.0, JRuby 9.1.5.0 Sep 7, 2016
@kares kares merged commit 2aabd98 into jruby:master Sep 15, 2016

1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@etehtsea etehtsea deleted the etehtsea:gh-3954-signal-exception branch Sep 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment