1
2
3
4
5
6
7
8
9
10
11
12 package com.puppycrawl.tools.checkstyle.grammar;
13 import java.lang.reflect.ParameterizedType;
14 import java.lang.reflect.WildcardType;
15 import java.util.List;
16
17 public class InputMultiDimensionalArraysInGenerics {
18
19 @SuppressWarnings("unused")
20 void withUpperBound(List<? extends int[][]> list) {}
21
22 @SuppressWarnings("unused")
23 void withLowerBound(List<? super String[][]> list) {}
24
25 @SuppressWarnings("unused")
26 void withLowerBound2(List<? super String[][][]> list) {}
27
28 static WildcardType getWildcardType(String methodName) throws Exception {
29 ParameterizedType parameterType = (ParameterizedType)
30 WildcardType.class
31 .getDeclaredMethod(methodName, List.class)
32 .getGenericParameterTypes()[0];
33 return (WildcardType) parameterType.getActualTypeArguments()[0];
34 }
35
36 }