< prev index next >
src/jdk.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/JVMCIError.java
Print this page
*** 29,39 ****
* Indicates a condition in JVMCI related code that should never occur during normal operation.
*/
public class JVMCIError extends Error {
private static final long serialVersionUID = 531632331813456233L;
- private final ArrayList<String> context = new ArrayList<>();
public static RuntimeException unimplemented() {
throw new JVMCIError("unimplemented");
}
--- 29,38 ----
*** 99,129 ****
*/
public JVMCIError(Throwable cause) {
super(cause);
}
- /**
- * This constructor creates a {@link JVMCIError} and adds all the
- * {@linkplain #addContext(String) context} of another {@link JVMCIError}.
- *
- * @param e the original {@link JVMCIError}
- */
- public JVMCIError(JVMCIError e) {
- super(e);
- context.addAll(e.context);
- }
-
- @Override
- public String toString() {
- StringBuilder str = new StringBuilder();
- str.append(super.toString());
- for (String s : context) {
- str.append("\n\tat ").append(s);
- }
- return str.toString();
- }
-
private static String format(String msg, Object... args) {
if (args != null) {
// expand Iterable parameters into a list representation
for (int i = 0; i < args.length; i++) {
if (args[i] instanceof Iterable<?>) {
--- 98,107 ----
*** 135,149 ****
}
}
}
return String.format(Locale.ENGLISH, msg, args);
}
-
- public JVMCIError addContext(String newContext) {
- this.context.add(newContext);
- return this;
- }
-
- public JVMCIError addContext(String name, Object obj) {
- return addContext(format("%s: %s", name, obj));
- }
}
--- 113,118 ----
< prev index next >