Skip to content

Commit

Permalink
Clean up some deprecation in exception logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Feb 27, 2018
1 parent 91278e7 commit 6a0bb07
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
3 changes: 0 additions & 3 deletions core/src/main/java/org/jruby/RubyException.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ public void initBacktrace() {
}

@Override
@SuppressWarnings("deprecated")
public void copySpecialInstanceVariables(IRubyObject clone) {
RubyException exception = (RubyException)clone;
exception.backtraceData = backtraceData;
Expand Down Expand Up @@ -389,7 +388,6 @@ public static IRubyObject newException(ThreadContext context, RubyClass exceptio
/**
* @return error message if provided or nil
*/
@SuppressWarnings("deprecated")
public IRubyObject getMessage() {
return message == null ? getRuntime().getNil() : message;
}
Expand All @@ -398,7 +396,6 @@ public IRubyObject getMessage() {
* Set the message for this NameError.
* @param message the message
*/
@SuppressWarnings("deprecated")
public void setMessage(IRubyObject message) {
this.message = message;
}
Expand Down
43 changes: 21 additions & 22 deletions core/src/main/java/org/jruby/exceptions/RaiseException.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,28 +128,6 @@ public RaiseException(RubyException exception, boolean nativeException) {
preRaise(exception.getRuntime().getCurrentContext());
}

public RaiseException(Throwable cause, NativeException nativeException) {
super(nativeException.getMessageAsJavaString(), cause);
providedMessage = super.getMessage(); // cause.getClass().getName() + ": " + message
setException(nativeException, true);
preRaise(nativeException.getRuntime().getCurrentContext(), nativeException.getCause().getStackTrace());
setStackTrace(RaiseException.javaTraceFromRubyTrace(exception.getBacktraceElements()));
}

@Deprecated
public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause) {
return createNativeRaiseException(runtime, cause, null);
}

@Deprecated
public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause, Member target) {
NativeException nativeException = new NativeException(runtime, runtime.getNativeException(), cause);

// FIXME: someday, add back filtering of reflection/handle methods between JRuby and target

return new RaiseException(cause, nativeException);
}

@Override
public String getMessage() {
if (providedMessage == null) {
Expand Down Expand Up @@ -243,4 +221,25 @@ public static StackTraceElement[] javaTraceFromRubyTrace(RubyStackTraceElement[]
}
return newTrace;
}

@Deprecated
public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause) {
return createNativeRaiseException(runtime, cause, null);
}

@Deprecated
public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause, Member target) {
NativeException nativeException = new NativeException(runtime, runtime.getNativeException(), cause);

return new RaiseException(cause, nativeException);
}

@Deprecated
public RaiseException(Throwable cause, NativeException nativeException) {
super(nativeException.getMessageAsJavaString(), cause);
providedMessage = super.getMessage(); // cause.getClass().getName() + ": " + message
setException(nativeException, true);
preRaise(nativeException.getRuntime().getCurrentContext(), nativeException.getCause().getStackTrace());
setStackTrace(RaiseException.javaTraceFromRubyTrace(exception.getBacktraceElements()));
}
}

0 comments on commit 6a0bb07

Please sign in to comment.