| Index: editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| diff --git a/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart b/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| index 0c40a7e867d9c80e0a0325b580ca5fff8e470570..063c7d59ce7d3b6097c90dce01cdee14305f1f7f 100644
|
| --- a/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| +++ b/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| @@ -130,7 +130,18 @@ class CharBuffer extends CharSequence {
|
|
|
| class JavaString {
|
| static String format(String fmt, List args) {
|
| - return fmt;
|
| + var index = 0;
|
| + return fmt.replaceAllMapped(new RegExp(r'%(.)'), (match) {
|
| + switch (match.group(1)) {
|
| + case '%': return '%';
|
| + case 's':
|
| + if (index >= args.length) {
|
| + throw new MissingFormatArgumentException(match.group(0));
|
| + }
|
| + return args[index++].toString();
|
| + default: return match.group(1);
|
| + }
|
| + });
|
| }
|
| }
|
|
|
| @@ -263,6 +274,14 @@ class IOException implements Exception {
|
| String toString() => "IOException";
|
| }
|
|
|
| +class MissingFormatArgumentException implements Exception {
|
| + final String s;
|
| +
|
| + String toString() => "MissingFormatArgumentException: $s";
|
| +
|
| + MissingFormatArgumentException(this.s);
|
| +}
|
| +
|
| class ListWrapper<E> extends ListBase<E> implements List<E> {
|
| List<E> elements = new List<E>();
|
|
|
|
|