comparison graal/com.oracle.max.base/src/com/sun/max/Utils.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
162 * Foo<T> genericFoo = uncheckedCast(type, foo); 162 * Foo<T> genericFoo = uncheckedCast(type, foo);
163 * </pre> 163 * </pre>
164 * 164 *
165 */ 165 */
166 @SuppressWarnings("unchecked") 166 @SuppressWarnings("unchecked")
167 public static <T> T cast(Class<T> type, Object object) { 167 public static <T> T cast(@SuppressWarnings("unused") Class<T> type, Object object) {
168 return (T) object; 168 return (T) object;
169 } 169 }
170 170
171 /** 171 /**
172 * Statically cast an object to an arbitrary type. The cast is still dynamically checked. 172 * Statically cast an object to an arbitrary type. The cast is still dynamically checked.
182 * @param <T> the type of elements in the source arrays 182 * @param <T> the type of elements in the source arrays
183 * @param head the prefix of the result array 183 * @param head the prefix of the result array
184 * @param tail the elements to be concatenated to {@code head} 184 * @param tail the elements to be concatenated to {@code head}
185 * @return the result of concatenating {@code tail} to the end of {@code head} 185 * @return the result of concatenating {@code tail} to the end of {@code head}
186 */ 186 */
187 @SafeVarargs
187 public static <T> T[] concat(T[] head, T... tail) { 188 public static <T> T[] concat(T[] head, T... tail) {
188 T[] result = Arrays.copyOf(head, head.length + tail.length); 189 T[] result = Arrays.copyOf(head, head.length + tail.length);
189 System.arraycopy(tail, 0, result, head.length, tail.length); 190 System.arraycopy(tail, 0, result, head.length, tail.length);
190 return result; 191 return result;
191 } 192 }
196 * @param <T> the type of elements in the source arrays 197 * @param <T> the type of elements in the source arrays
197 * @param tail the elements to be concatenated to the end of {@code head} 198 * @param tail the elements to be concatenated to the end of {@code head}
198 * @param head the prefix of the result array 199 * @param head the prefix of the result array
199 * @return the result of concatenating {@code tail} to the end of {@code head} 200 * @return the result of concatenating {@code tail} to the end of {@code head}
200 */ 201 */
202 @SafeVarargs
201 public static <T> T[] prepend(T[] tail, T... head) { 203 public static <T> T[] prepend(T[] tail, T... head) {
202 return concat(head, tail); 204 return concat(head, tail);
203 } 205 }
204 206
205 /** 207 /**