test_class.file: server-core/src/test/java/io/onedev/server/util/ReflectionUtilsTest.java
test_class.identifier: ReflectionUtilsTest
test_case.body: @Test
  	public void shouldResolveTypeArg() {
  		List<?> typeArguments = ReflectionUtils.getTypeArguments(SuperClass.class, SubClass1.class);
  		assertSame(String.class, typeArguments.get(0));
  		assertSame(Integer.class, typeArguments.get(1));
  
  		typeArguments = ReflectionUtils.getTypeArguments(SuperClass.class, SubClass2.class);
  		assertSame(String.class, typeArguments.get(0));
  
  		typeArguments = ReflectionUtils.getTypeArguments(SuperClass.class, SubClass3.class);
  		assertSame(String.class, typeArguments.get(0));
  		assertSame(Integer.class, typeArguments.get(1));
  
  		typeArguments = ReflectionUtils.getTypeArguments(SubClass2.class, SubClass3.class);
  		assertSame(Integer.class, typeArguments.get(0));
  	}
test_case.class_method_signature: ReflectionUtilsTest.shouldResolveTypeArg()
test_case.full_signature: @Test public void shouldResolveTypeArg()
test_case.identifier: shouldResolveTypeArg
test_case.invocations: getTypeArguments assertSame get assertSame get getTypeArguments assertSame get getTypeArguments assertSame get assertSame get getTypeArguments assertSame get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldResolveTypeArg()
focal_class.file: server-core/src/main/java/io/onedev/server/util/ReflectionUtils.java
focal_class.identifier: ReflectionUtils
focal_class.class_method_signature: ReflectionUtils.getTypeArguments(Class<T> baseClass, Class<? extends T> childClass)
focal_class.full_signature: public static List<Class<?>> getTypeArguments(Class<T> baseClass, Class<? extends T> childClass)
focal_class.identifier: getTypeArguments
focal_class.modifiers: public static
focal_class.parameters: (Class<T> baseClass, Class<? extends T> childClass)
focal_class.return: List<Class<?>>
focal_class.signature: List<Class<?>> getTypeArguments(Class<T> baseClass, Class<? extends T> childClass)
focal_class.class_method_signature: ReflectionUtils.getClass(Type type)
focal_class.full_signature: private static Class<?> getClass(Type type)
focal_class.identifier: getClass
focal_class.modifiers: private static
focal_class.parameters: (Type type)
focal_class.return: Class<?>
focal_class.signature: Class<?> getClass(Type type)
focal_class.class_method_signature: ReflectionUtils.findMethod(Class<?> clazz, String methodName, Class<?>... paramTypes)
focal_class.full_signature: public static Method findMethod(Class<?> clazz, String methodName, Class<?>... paramTypes)
focal_class.identifier: findMethod
focal_class.modifiers: public static
focal_class.parameters: (Class<?> clazz, String methodName, Class<?>... paramTypes)
focal_class.return: Method
focal_class.signature: Method findMethod(Class<?> clazz, String methodName, Class<?>... paramTypes)
focal_class.class_method_signature: ReflectionUtils.findField(Class<?> clazz, String fieldName)
focal_class.full_signature: public static Field findField(Class<?> clazz, String fieldName)
focal_class.identifier: findField
focal_class.modifiers: public static
focal_class.parameters: (Class<?> clazz, String fieldName)
focal_class.return: Field
focal_class.signature: Field findField(Class<?> clazz, String fieldName)
focal_class.class_method_signature: ReflectionUtils.findFields(Class<?> clazz)
focal_class.full_signature: public static List<Field> findFields(Class<?> clazz)
focal_class.identifier: findFields
focal_class.modifiers: public static
focal_class.parameters: (Class<?> clazz)
focal_class.return: List<Field>
focal_class.signature: List<Field> findFields(Class<?> clazz)
focal_class.class_method_signature: ReflectionUtils.getMethod(Class<?> clazz, String methodName, Class<?>...paramTypes)
focal_class.full_signature: public static Method getMethod(Class<?> clazz, String methodName, Class<?>...paramTypes)
focal_class.identifier: getMethod
focal_class.modifiers: public static
focal_class.parameters: (Class<?> clazz, String methodName, Class<?>...paramTypes)
focal_class.return: Method
focal_class.signature: Method getMethod(Class<?> clazz, String methodName, Class<?>...paramTypes)
focal_class.class_method_signature: ReflectionUtils.invokeStaticMethod(Class<?> clazz, String methodName, Object...params)
focal_class.full_signature: public static Object invokeStaticMethod(Class<?> clazz, String methodName, Object...params)
focal_class.identifier: invokeStaticMethod
focal_class.modifiers: public static
focal_class.parameters: (Class<?> clazz, String methodName, Object...params)
focal_class.return: Object
focal_class.signature: Object invokeStaticMethod(Class<?> clazz, String methodName, Object...params)
focal_class.class_method_signature: ReflectionUtils.invokeMethod(Object object, String methodName, Object...params)
focal_class.full_signature: public static Object invokeMethod(Object object, String methodName, Object...params)
focal_class.identifier: invokeMethod
focal_class.modifiers: public static
focal_class.parameters: (Object object, String methodName, Object...params)
focal_class.return: Object
focal_class.signature: Object invokeMethod(Object object, String methodName, Object...params)
focal_class.class_method_signature: ReflectionUtils.instantiateClass(Class<T> clazz, Object... params)
focal_class.full_signature: public static T instantiateClass(Class<T> clazz, Object... params)
focal_class.identifier: instantiateClass
focal_class.modifiers: public static
focal_class.parameters: (Class<T> clazz, Object... params)
focal_class.return: T
focal_class.signature: T instantiateClass(Class<T> clazz, Object... params)
focal_class.class_method_signature: ReflectionUtils.findConstructor(Class<T> clazz, Class<?>... expectedParamTypes)
focal_class.full_signature: @SuppressWarnings("unchecked") public static Constructor<T> findConstructor(Class<T> clazz, Class<?>... expectedParamTypes)
focal_class.identifier: findConstructor
focal_class.modifiers: @SuppressWarnings("unchecked") public static
focal_class.parameters: (Class<T> clazz, Class<?>... expectedParamTypes)
focal_class.return: Constructor<T>
focal_class.signature: Constructor<T> findConstructor(Class<T> clazz, Class<?>... expectedParamTypes)
focal_class.class_method_signature: ReflectionUtils.getCollectionElementType(Type type)
focal_class.full_signature: public static Class<?> getCollectionElementType(Type type)
focal_class.identifier: getCollectionElementType
focal_class.modifiers: public static
focal_class.parameters: (Type type)
focal_class.return: Class<?>
focal_class.signature: Class<?> getCollectionElementType(Type type)
focal_class.class_method_signature: ReflectionUtils.getMapKeyType(Type type)
focal_class.full_signature: public static Class<?> getMapKeyType(Type type)
focal_class.identifier: getMapKeyType
focal_class.modifiers: public static
focal_class.parameters: (Type type)
focal_class.return: Class<?>
focal_class.signature: Class<?> getMapKeyType(Type type)
focal_class.class_method_signature: ReflectionUtils.getMapValueType(Type type)
focal_class.full_signature: public static Class<?> getMapValueType(Type type)
focal_class.identifier: getMapValueType
focal_class.modifiers: public static
focal_class.parameters: (Type type)
focal_class.return: Class<?>
focal_class.signature: Class<?> getMapValueType(Type type)
focal_method.body: public static <T> List<Class<?>> getTypeArguments(Class<T> baseClass, Class<? extends T> childClass) {
  		Preconditions.checkArgument(!baseClass.isInterface(), "baseClass should not be an interface");
  		Preconditions.checkArgument(baseClass.isAssignableFrom(childClass), "childClass should be a sub class of baseClass");
  		
  		Map<Type, Type> resolvedTypes = new HashMap<Type, Type>();
  		Type type = childClass;
  		// start walking up the inheritance hierarchy until we hit baseClass
  		while (!getClass(type).equals(baseClass)) {
  			if (type instanceof Class) {
  				// there is no useful information for us in raw types, so just
  				// keep going.
  				type = ((Class<?>) type).getGenericSuperclass();
  			} else {
  				ParameterizedType parameterizedType = (ParameterizedType) type;
  				Class<?> rawType = (Class<?>) parameterizedType.getRawType();
  
  				Type[] actualTypeArguments = parameterizedType
  						.getActualTypeArguments();
  				TypeVariable<?>[] typeParameters = rawType.getTypeParameters();
  				for (int i = 0; i < actualTypeArguments.length; i++) {
  					resolvedTypes
  							.put(typeParameters[i], actualTypeArguments[i]);
  				}
  
  				if (!rawType.equals(baseClass)) {
  					type = rawType.getGenericSuperclass();
  				}
  			}
  		}
  
  		// finally, for each actual type argument provided to baseClass,
  		// determine (if possible)
  		// the raw class for that type argument.
  		Type[] actualTypeArguments;
  		if (type instanceof Class) {
  			actualTypeArguments = ((Class<?>) type).getTypeParameters();
  		} else {
  			actualTypeArguments = ((ParameterizedType) type)
  					.getActualTypeArguments();
  		}
  		List<Class<?>> typeArgumentsAsClasses = new ArrayList<Class<?>>();
  		// resolve types by chasing down type variables.
  		for (Type baseType : actualTypeArguments) {
  			while (resolvedTypes.containsKey(baseType)) {
  				baseType = resolvedTypes.get(baseType);
  			}
  			typeArgumentsAsClasses.add(getClass(baseType));
  		}
  		return typeArgumentsAsClasses;
  	}
focal_method.class_method_signature: ReflectionUtils.getTypeArguments(Class<T> baseClass, Class<? extends T> childClass)
focal_method.full_signature: public static List<Class<?>> getTypeArguments(Class<T> baseClass, Class<? extends T> childClass)
focal_method.identifier: getTypeArguments
focal_method.invocations: checkArgument isInterface checkArgument isAssignableFrom equals getClass getGenericSuperclass getRawType getActualTypeArguments getTypeParameters put equals getGenericSuperclass getTypeParameters getActualTypeArguments containsKey get add getClass
focal_method.modifiers: public static
focal_method.parameters: (Class<T> baseClass, Class<? extends T> childClass)
focal_method.return: List<Class<?>>
focal_method.signature: List<Class<?>> getTypeArguments(Class<T> baseClass, Class<? extends T> childClass)