Mercurial > hg > truffle
comparison graal/com.oracle.max.base/src/com/sun/max/program/option/OptionTypes.java @ 4142:bc8527f3071c
Adjust code base to new level of warnings.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 18 Dec 2011 05:24:06 +0100 |
parents | e233f5660da4 |
children |
comparison
equal
deleted
inserted
replaced
4141:04d21be7a24f | 4142:bc8527f3071c |
---|---|
121 | 121 |
122 public static class ListType<T> extends Option.Type<List<T>> { | 122 public static class ListType<T> extends Option.Type<List<T>> { |
123 protected final char separator; | 123 protected final char separator; |
124 public final Option.Type<T> elementOptionType; | 124 public final Option.Type<T> elementOptionType; |
125 | 125 |
126 private static <T> Class<List<T>> listClass(Class<T> valueClass) { | 126 private static <T> Class<List<T>> listClass(@SuppressWarnings("unused") Class<T> valueClass) { |
127 final Class<Class<List<T>>> type = null; | 127 final Class<Class<List<T>>> type = null; |
128 return Utils.cast(type, List.class); | 128 return Utils.cast(type, List.class); |
129 } | 129 } |
130 | 130 |
131 public ListType(char separator, Option.Type<T> elementOptionType) { | 131 public ListType(char separator, Option.Type<T> elementOptionType) { |
148 return buffer.toString(); | 148 return buffer.toString(); |
149 } | 149 } |
150 | 150 |
151 @Override | 151 @Override |
152 public List<T> parseValue(String val) { | 152 public List<T> parseValue(String val) { |
153 final List<T> list = new LinkedList<T>(); | 153 final List<T> list = new LinkedList<>(); |
154 if (val.isEmpty()) { | 154 if (val.isEmpty()) { |
155 return list; | 155 return list; |
156 } | 156 } |
157 | 157 |
158 final CharacterIterator i = new StringCharacterIterator(val); | 158 final CharacterIterator i = new StringCharacterIterator(val); |
254 * | 254 * |
255 * @return An option type that takes a list of class names as its value. Then it reflectively creates instances | 255 * @return An option type that takes a list of class names as its value. Then it reflectively creates instances |
256 * of these classes and returns them as a list. | 256 * of these classes and returns them as a list. |
257 */ | 257 */ |
258 public static final <T> ListType<T> createInstanceListOptionType(final Class<T> klass, char separator) { | 258 public static final <T> ListType<T> createInstanceListOptionType(final Class<T> klass, char separator) { |
259 return new ListType<T>(separator, createInstanceOptionType(klass)); | 259 return new ListType<>(separator, createInstanceOptionType(klass)); |
260 } | 260 } |
261 | 261 |
262 public static final Option.Type<Double> DOUBLE_TYPE = new Option.Type<Double>(Double.class, "double") { | 262 public static final Option.Type<Double> DOUBLE_TYPE = new Option.Type<Double>(Double.class, "double") { |
263 @Override | 263 @Override |
264 public Double parseValue(String string) { | 264 public Double parseValue(String string) { |
385 } | 385 } |
386 } | 386 } |
387 | 387 |
388 public static class EnumListType<T extends Enum<T>> extends ListType<T> { | 388 public static class EnumListType<T extends Enum<T>> extends ListType<T> { |
389 public EnumListType(Class<T> enumClass, char separator) { | 389 public EnumListType(Class<T> enumClass, char separator) { |
390 super(separator, new EnumType<T>(enumClass)); | 390 super(separator, new EnumType<>(enumClass)); |
391 } | 391 } |
392 } | 392 } |
393 | 393 |
394 public static final StringListType COMMA_SEPARATED_STRING_LIST_TYPE = new StringListType(','); | 394 public static final StringListType COMMA_SEPARATED_STRING_LIST_TYPE = new StringListType(','); |
395 | 395 |