Skip to content

Commit af9ea6e

Browse files
andrykonchineregon
authored andcommitted
Refactor RubyException - remove incorrect assert in a constructor that ensures a message has a proper type
1 parent c951dec commit af9ea6e

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/main/java/org/truffleruby/core/exception/RubyException.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
import org.truffleruby.core.array.RubyArray;
2727
import org.truffleruby.core.klass.RubyClass;
2828
import org.truffleruby.core.proc.RubyProc;
29-
import org.truffleruby.core.string.RubyString;
30-
import org.truffleruby.core.string.ImmutableRubyString;
31-
import org.truffleruby.language.Nil;
3229
import org.truffleruby.language.RubyDynamicObject;
3330
import org.truffleruby.language.backtrace.Backtrace;
3431
import org.truffleruby.language.objects.ObjectGraph;
@@ -42,6 +39,7 @@
4239
@ExportLibrary(InteropLibrary.class)
4340
public class RubyException extends RubyDynamicObject implements ObjectGraphNode {
4441

42+
/** message may be an instance of any class */
4543
public Object message;
4644
public Backtrace backtrace;
4745
public Object cause;
@@ -55,9 +53,6 @@ public class RubyException extends RubyDynamicObject implements ObjectGraphNode
5553

5654
public RubyException(RubyClass rubyClass, Shape shape, Object message, Backtrace backtrace, Object cause) {
5755
super(rubyClass, shape);
58-
// TODO (eregon, 9 Aug 2020): it should probably be null or RubyString, not nil, and the field can then be typed
59-
assert message == null || message == Nil.INSTANCE || message instanceof RubyString ||
60-
message instanceof ImmutableRubyString;
6156
assert cause != null;
6257
this.message = message;
6358
this.backtrace = backtrace;

0 commit comments

Comments
 (0)