File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed
src/main/java/org/truffleruby Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -20,17 +20,22 @@ public abstract class ArrayUtils {
20
20
21
21
public static final Object [] EMPTY_ARRAY = new Object [0 ];
22
22
23
+ public static boolean assertNoNullElement (Object [] array ) {
24
+ return assertNoNullElement (array , array .length );
25
+ }
26
+
23
27
public static boolean assertNoNullElement (Object [] array , int size ) {
24
28
assert size <= array .length ;
25
29
for (int i = 0 ; i < size ; i ++) {
26
30
final Object element = array [i ];
27
- assert element != null : element ;
31
+ assert element != null : nullElementAt ( array , i ) ;
28
32
}
29
33
return true ;
30
34
}
31
35
32
- public static boolean assertNoNullElement (Object [] array ) {
33
- return assertNoNullElement (array , array .length );
36
+ @ TruffleBoundary
37
+ private static String nullElementAt (Object [] array , int index ) {
38
+ return "null element in Object[] at index " + index + ": " + Arrays .toString (array );
34
39
}
35
40
36
41
/** Extracts part of an array into a newly allocated byte[] array. Does not perform safety checks on parameters.
Original file line number Diff line number Diff line change 12
12
import java .util .Set ;
13
13
14
14
import org .truffleruby .core .klass .RubyClass ;
15
+ import org .truffleruby .core .string .StringUtils ;
15
16
import org .truffleruby .interop .ForeignToRubyArgumentsNode ;
16
17
import org .truffleruby .language .Nil ;
17
18
import org .truffleruby .language .RubyDynamicObject ;
@@ -61,7 +62,7 @@ public RubyProc(
61
62
FrameOnStackMarker frameOnStackMarker ,
62
63
DeclarationContext declarationContext ) {
63
64
super (rubyClass , shape );
64
- assert block instanceof Nil || block instanceof RubyProc : block ;
65
+ assert block instanceof Nil || block instanceof RubyProc : StringUtils . toString ( block ) ;
65
66
this .type = type ;
66
67
this .sharedMethodInfo = sharedMethodInfo ;
67
68
this .callTargets = callTargets ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public abstract class StringUtils {
21
21
22
22
@ TruffleBoundary
23
23
public static String toString (Object value ) {
24
- return value . toString ( );
24
+ return String . valueOf ( value );
25
25
}
26
26
27
27
@ TruffleBoundary
Original file line number Diff line number Diff line change 11
11
12
12
import org .truffleruby .core .array .ArrayUtils ;
13
13
import org .truffleruby .core .proc .RubyProc ;
14
+ import org .truffleruby .core .string .StringUtils ;
14
15
import org .truffleruby .language .FrameAndVariables ;
15
16
import org .truffleruby .language .Nil ;
16
17
import org .truffleruby .language .control .FrameOnStackMarker ;
@@ -161,7 +162,7 @@ public static Object getSelf(Frame frame) {
161
162
public static Object getBlock (Frame frame ) {
162
163
final Object block = frame .getArguments ()[ArgumentIndicies .BLOCK .ordinal ()];
163
164
/* We put into the arguments array either a Nil or RubyProc, so that's all we'll get out at this point. */
164
- assert block instanceof Nil || block instanceof RubyProc : block ;
165
+ assert block instanceof Nil || block instanceof RubyProc : StringUtils . toString ( block ) ;
165
166
return block ;
166
167
}
167
168
You can’t perform that action at this time.
0 commit comments