Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fda488bdd891
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ec220c63fbc0
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Feb 28, 2018

  1. Copy the full SHA
    c6eaf26 View commit details
  2. Gratuitous.

    headius committed Feb 28, 2018
    Copy the full SHA
    e2a31ec View commit details
  3. Fix missing assignment. #4781

    headius committed Feb 28, 2018
    Copy the full SHA
    ec220c6 View commit details
Showing with 46 additions and 47 deletions.
  1. +36 −37 core/src/main/java/org/jruby/Ruby.java
  2. +7 −7 core/src/main/java/org/jruby/RubyNameError.java
  3. +3 −3 core/src/test/java/org/jruby/test/TestLoadService.java
73 changes: 36 additions & 37 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -1564,53 +1564,52 @@ public IRubyObject[] getNilPrefilledArray() {
}

private void initExceptions() {
ifAllowed("StandardError", (ruby) -> standardError = RubyStandardError.define(ruby, exceptionClass));
ifAllowed("RubyError", (ruby) -> runtimeError = RubyRuntimeError.define(ruby, standardError));
ifAllowed("IOError", (ruby) -> ioError = RubyIOError.define(ruby, standardError));
ifAllowed("ScriptError", (ruby) -> scriptError = RubyScriptError.define(ruby, exceptionClass));
ifAllowed("RangeError", (ruby) -> rangeError = RubyRangeError.define(ruby, standardError));
ifAllowed("SignalException", (ruby) -> signalException = RubySignalException.define(ruby, exceptionClass));
ifAllowed("NameError", (ruby) -> {
ifAllowed("StandardError", (ruby) -> standardError = RubyStandardError.define(ruby, exceptionClass));
ifAllowed("RubyError", (ruby) -> runtimeError = RubyRuntimeError.define(ruby, standardError));
ifAllowed("IOError", (ruby) -> ioError = RubyIOError.define(ruby, standardError));
ifAllowed("ScriptError", (ruby) -> scriptError = RubyScriptError.define(ruby, exceptionClass));
ifAllowed("RangeError", (ruby) -> rangeError = RubyRangeError.define(ruby, standardError));
ifAllowed("SignalException", (ruby) -> signalException = RubySignalException.define(ruby, exceptionClass));
ifAllowed("NameError", (ruby) -> {
nameError = RubyNameError.define(ruby, standardError);
nameErrorMessage = RubyNameError.defineMessage(ruby, nameError);
nameErrorMessage = RubyNameError.RubyNameErrorMessage.define(ruby, nameError);
});
ifAllowed("NoMethodError", (ruby) -> noMethodError = RubyNoMethodError.define(ruby, nameError));
ifAllowed("SystemExit", (ruby) -> systemExit = RubySystemExit.define(ruby, exceptionClass));
ifAllowed("LocalJumpError", (ruby) -> localJumpError = RubyLocalJumpError.define(ruby, standardError));
ifAllowed("SystemCallError", (ruby) -> systemCallError = RubySystemCallError.define(ruby, standardError));

ifAllowed("Fatal", (ruby) -> fatal = RubyFatal.define(ruby, exceptionClass));
ifAllowed("Interrupt", (ruby) -> interrupt = RubyInterrupt.define(ruby, signalException));
ifAllowed("TypeError", (ruby) -> typeError = RubyTypeError.define(ruby, standardError));
ifAllowed("ArgumentError", (ruby) -> argumentError = RubyArgumentError.define(ruby, standardError));
ifAllowed("UncaughtThrowError", (ruby) -> uncaughtThrowError = RubyUncaughtThrowError.define(ruby, argumentError));
ifAllowed("IndexError", (ruby) -> indexError = RubyIndexError.define(ruby, standardError));
ifAllowed("StopIteration", (ruby) -> stopIteration = RubyStopIteration.define(ruby, indexError));
ifAllowed("SyntaxError", (ruby) -> syntaxError = RubySyntaxError.define(ruby, scriptError));
ifAllowed("LoadError", (ruby) -> loadError = RubyLoadError.define(ruby, scriptError));
ifAllowed("NotImplementedError", (ruby) -> notImplementedError = RubyNotImplementedError.define(ruby, scriptError));
ifAllowed("SecurityError", (ruby) -> securityError = RubySecurityError.define(ruby, exceptionClass));
ifAllowed("NoMemoryError", (ruby) -> noMemoryError = RubyNoMemoryError.define(ruby, exceptionClass));
ifAllowed("RegexpError", (ruby) -> regexpError = RubyRegexpError.define(ruby, standardError));
ifAllowed("NoMethodError", (ruby) -> noMethodError = RubyNoMethodError.define(ruby, nameError));
ifAllowed("SystemExit", (ruby) -> systemExit = RubySystemExit.define(ruby, exceptionClass));
ifAllowed("LocalJumpError", (ruby) -> localJumpError = RubyLocalJumpError.define(ruby, standardError));
ifAllowed("SystemCallError", (ruby) -> systemCallError = RubySystemCallError.define(ruby, standardError));
ifAllowed("Fatal", (ruby) -> fatal = RubyFatal.define(ruby, exceptionClass));
ifAllowed("Interrupt", (ruby) -> interrupt = RubyInterrupt.define(ruby, signalException));
ifAllowed("TypeError", (ruby) -> typeError = RubyTypeError.define(ruby, standardError));
ifAllowed("ArgumentError", (ruby) -> argumentError = RubyArgumentError.define(ruby, standardError));
ifAllowed("UncaughtThrowError", (ruby) -> uncaughtThrowError = RubyUncaughtThrowError.define(ruby, argumentError));
ifAllowed("IndexError", (ruby) -> indexError = RubyIndexError.define(ruby, standardError));
ifAllowed("StopIteration", (ruby) -> stopIteration = RubyStopIteration.define(ruby, indexError));
ifAllowed("SyntaxError", (ruby) -> syntaxError = RubySyntaxError.define(ruby, scriptError));
ifAllowed("LoadError", (ruby) -> loadError = RubyLoadError.define(ruby, scriptError));
ifAllowed("NotImplementedError", (ruby) -> notImplementedError = RubyNotImplementedError.define(ruby, scriptError));
ifAllowed("SecurityError", (ruby) -> securityError = RubySecurityError.define(ruby, exceptionClass));
ifAllowed("NoMemoryError", (ruby) -> noMemoryError = RubyNoMemoryError.define(ruby, exceptionClass));
ifAllowed("RegexpError", (ruby) -> regexpError = RubyRegexpError.define(ruby, standardError));
// Proposal to RubyCommons for interrupting Regexps
ifAllowed("InterruptedRegexpError", (ruby) -> interruptedRegexpError = RubyInterruptedRegexpError.define(ruby, regexpError));
ifAllowed("EOFError", (ruby) -> eofError = RubyEOFError.define(ruby, ioError));
ifAllowed("ThreadError", (ruby) -> threadError = RubyThreadError.define(ruby, standardError));
ifAllowed("ConcurrencyError", (ruby) -> concurrencyError = RubyConcurrencyError.define(ruby, threadError));
ifAllowed("SystemStackError", (ruby) -> systemStackError = RubySystemStackError.define(ruby, exceptionClass));
ifAllowed("ZeroDivisionError", (ruby) -> zeroDivisionError = RubyZeroDivisionError.define(ruby, standardError));
ifAllowed("FloatDomainError", (ruby) -> RubyFloatDomainError.define(ruby, rangeError));
ifAllowed("EncodingError", (ruby) -> {
ifAllowed("EOFError", (ruby) -> eofError = RubyEOFError.define(ruby, ioError));
ifAllowed("ThreadError", (ruby) -> threadError = RubyThreadError.define(ruby, standardError));
ifAllowed("ConcurrencyError", (ruby) -> concurrencyError = RubyConcurrencyError.define(ruby, threadError));
ifAllowed("SystemStackError", (ruby) -> systemStackError = RubySystemStackError.define(ruby, exceptionClass));
ifAllowed("ZeroDivisionError", (ruby) -> zeroDivisionError = RubyZeroDivisionError.define(ruby, standardError));
ifAllowed("FloatDomainError", (ruby) -> floatDomainError = RubyFloatDomainError.define(ruby, rangeError));
ifAllowed("EncodingError", (ruby) -> {
encodingError = RubyEncodingError.define(ruby, standardError);
encodingCompatibilityError = RubyEncodingError.RubyCompatibilityError.define(ruby, encodingError, encodingClass);
invalidByteSequenceError = RubyEncodingError.RubyInvalidByteSequenceError.define(ruby, encodingError, encodingClass);
undefinedConversionError = RubyEncodingError.RubyUndefinedConversionError.define(ruby, encodingError, encodingClass);
converterNotFoundError = RubyEncodingError.RubyConverterNotFoundError.define(ruby, encodingError, encodingClass);
});
ifAllowed("Fiber", (ruby) -> fiberError = RubyFiberError.define(ruby, standardError));
ifAllowed("ConcurrencyError", (ruby) -> concurrencyError = RubyConcurrencyError.define(ruby, threadError));
ifAllowed("KeyError", (ruby) -> keyError = RubyKeyError.define(ruby, indexError));
ifAllowed("DomainError", (ruby) -> mathDomainError = RubyDomainError.define(ruby, argumentError, mathModule));
ifAllowed("Fiber", (ruby) -> fiberError = RubyFiberError.define(ruby, standardError));
ifAllowed("ConcurrencyError", (ruby) -> concurrencyError = RubyConcurrencyError.define(ruby, threadError));
ifAllowed("KeyError", (ruby) -> keyError = RubyKeyError.define(ruby, indexError));
ifAllowed("DomainError", (ruby) -> mathDomainError = RubyDomainError.define(ruby, argumentError, mathModule));

initErrno();

14 changes: 7 additions & 7 deletions core/src/main/java/org/jruby/RubyNameError.java
Original file line number Diff line number Diff line change
@@ -89,6 +89,13 @@ public static IRubyObject load(IRubyObject recv, IRubyObject arg) {
return arg;
}

static RubyClass define(Ruby runtime, RubyClass NameError) {
RubyClass Message = NameError.defineClassUnder("Message", runtime.getClass("Data"), ALLOCATOR);
NameError.setConstantVisibility(runtime, "Message", true);
Message.defineAnnotatedMethods(RubyNameErrorMessage.class);
return Message;
}

@JRubyMethod(name = "_dump")
public IRubyObject dump(ThreadContext context, IRubyObject arg) {
return to_str(context);
@@ -155,13 +162,6 @@ static RubyClass define(Ruby runtime, RubyClass StandardError) {
return NameError;
}

static RubyClass defineMessage(Ruby runtime, RubyClass NameError) {
RubyClass Message = NameError.defineClassUnder("Message", runtime.getClass("Data"), RubyNameErrorMessage.ALLOCATOR);
NameError.setConstantVisibility(runtime, "Message", true);
Message.defineAnnotatedMethods(RubyNameErrorMessage.class);
return Message;
}

protected RubyNameError(Ruby runtime, RubyClass exceptionClass) {
this(runtime, exceptionClass, exceptionClass.getName());
}
6 changes: 3 additions & 3 deletions core/src/test/java/org/jruby/test/TestLoadService.java
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ public void testRequireEmpty(){
try{
runtime.evalScriptlet("require ''");
} catch (RaiseException e){
assertEquals("Empty library is not valid, exception should have been raised", RaiseException.class, e.getClass());
assertTrue("Empty library is not valid, exception should have been raised", RaiseException.class.isAssignableFrom(e.getClass()));
assertNull("Empty library is not valid, exception should only be RaiseException with no root cause", e.getCause());
}
}
@@ -67,7 +67,7 @@ public void testNonExistentRequire() {
// presumably this require should fail
runtime.evalScriptlet("require 'somethingthatdoesnotexist'");
} catch (RaiseException e){
assertEquals("Require of non-existent library should fail", RaiseException.class, e.getClass());
assertTrue("Require of non-existent library should fail", RaiseException.class.isAssignableFrom(e.getClass()));
assertNull("Require of non-existent library should , exception should only be RaiseException with no root cause", e.getCause());
}
}
@@ -78,7 +78,7 @@ public void testNonExistentRequireAfterRubyGems() {
// presumably this require should fail
runtime.evalScriptlet("require 'rubygems'; require 'somethingthatdoesnotexist'");
} catch (RaiseException e){
assertEquals("Require of non-existent library should fail", RaiseException.class, e.getClass());
assertTrue("Require of non-existent library should fail", RaiseException.class.isAssignableFrom(e.getClass()));
assertNull("Require of non-existent library should , exception should only be RaiseException with no root cause", e.getCause());
}
}