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