langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DirectExecutionControl.java
equal
deleted
inserted
replaced
22 * or visit www.oracle.com if you need additional information or have any |
22 * or visit www.oracle.com if you need additional information or have any |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 package jdk.jshell.execution; |
25 package jdk.jshell.execution; |
26 |
26 |
|
27 import java.lang.reflect.Array; |
27 import java.lang.reflect.Field; |
28 import java.lang.reflect.Field; |
28 import java.lang.reflect.InvocationTargetException; |
29 import java.lang.reflect.InvocationTargetException; |
29 import java.lang.reflect.Method; |
30 import java.lang.reflect.Method; |
30 import jdk.jshell.spi.ExecutionControl; |
31 import jdk.jshell.spi.ExecutionControl; |
31 import jdk.jshell.spi.SPIResolutionException; |
32 import jdk.jshell.spi.SPIResolutionException; |
198 return "null"; |
199 return "null"; |
199 } else if (value instanceof String) { |
200 } else if (value instanceof String) { |
200 return "\"" + (String) value + "\""; |
201 return "\"" + (String) value + "\""; |
201 } else if (value instanceof Character) { |
202 } else if (value instanceof Character) { |
202 return "'" + value + "'"; |
203 return "'" + value + "'"; |
|
204 } else if (value.getClass().isArray()) { |
|
205 String tn = value.getClass().getTypeName(); |
|
206 int len = Array.getLength(value); |
|
207 StringBuilder sb = new StringBuilder(); |
|
208 sb.append(tn.substring(tn.lastIndexOf('.') + 1, tn.length() - 1)); |
|
209 sb.append(len); |
|
210 sb.append("] { "); |
|
211 for (int i = 0; i < len; ++i) { |
|
212 sb.append(valueString(Array.get(value, i))); |
|
213 if (i < len - 1) { |
|
214 sb.append(", "); |
|
215 } |
|
216 } |
|
217 sb.append(" }"); |
|
218 return sb.toString(); |
203 } else { |
219 } else { |
204 return value.toString(); |
220 return value.toString(); |
205 } |
221 } |
206 } |
222 } |
207 |
223 |