Skip to content

Commit 4690596

Browse files
committed
[Issue 142] Test failures with Java 7.
http://codereview.appspot.com/6446056/
1 parent c92e2dc commit 4690596

File tree

1 file changed

+12
-7
lines changed
  • google-http-client/src/test/java/com/google/api/client/util

1 file changed

+12
-7
lines changed

google-http-client/src/test/java/com/google/api/client/util/TypesTest.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ public class A<T> {
156156
public ArrayList aNoType;
157157
public Stack<? extends Number> wild;
158158
public Vector<Integer[]> arr;
159+
public Vector<T[]> tarr;
159160
public LinkedList<ArrayList<Boolean>> list;
160161
public Iterable<T> tv;
161162
public ArrayList<T> atv;
@@ -176,9 +177,11 @@ public void testGetIterableParameter() throws Exception {
176177
assertEquals("E",
177178
((TypeVariable<?>) Types.getIterableParameter(A.class.getField("aNoType").getGenericType()))
178179
.getName());
179-
assertEquals(Integer.class,
180-
((GenericArrayType) Types.getIterableParameter(A.class.getField("arr").getGenericType()))
181-
.getGenericComponentType());
180+
assertEquals(Integer.class, Types.getArrayComponentType(
181+
Types.getIterableParameter(A.class.getField("arr").getGenericType())));
182+
assertEquals("T",
183+
((GenericArrayType) Types.getIterableParameter(A.class.getField("tarr").getGenericType()))
184+
.getGenericComponentType().toString());
182185
assertEquals(ArrayList.class,
183186
((ParameterizedType) Types.getIterableParameter(A.class.getField("list").getGenericType()))
184187
.getRawType());
@@ -193,7 +196,8 @@ public class C<T> {
193196
@SuppressWarnings({"unchecked", "rawtypes"})
194197
public ArrayMap aNoType;
195198
public TreeMap<String, ? extends Number> wild;
196-
public HashMap<String, Integer[]> arr;
199+
public Vector<Integer[]> arr;
200+
public HashMap<String, T[]> tarr;
197201
public ImmutableMap<String, ArrayList<Boolean>> list;
198202
public Map<String, T> tv;
199203
public ArrayMap<String, T> atv;
@@ -214,9 +218,10 @@ public void testGetMapParameter() throws Exception {
214218
assertEquals("V",
215219
((TypeVariable<?>) Types.getMapValueParameter(C.class.getField("aNoType").getGenericType()))
216220
.getName());
217-
assertEquals(Integer.class,
218-
((GenericArrayType) Types.getMapValueParameter(C.class.getField("arr").getGenericType()))
219-
.getGenericComponentType());
221+
assertEquals(Integer.class, Types.getArrayComponentType(
222+
Types.getIterableParameter(A.class.getField("arr").getGenericType())));
223+
assertEquals("T", ((GenericArrayType) Types.getMapValueParameter(
224+
C.class.getField("tarr").getGenericType())).getGenericComponentType().toString());
220225
assertEquals(ArrayList.class,
221226
((ParameterizedType) Types.getMapValueParameter(C.class.getField("list").getGenericType()))
222227
.getRawType());

0 commit comments

Comments
 (0)