ReflectionHelper { public static Class<?> getConcreteTypeOfGenericInterfaceImplementation( Object instanceToExamine, Class<?> implementedInterfaceClass, int parameterIndex) { Type genericInterfaceType = Arrays.stream(instanceToExamine.getClass().getGenericInterfaces()) .filter(t -> t.getTypeName().contains(implementedInterfaceClass.getName())) .findFirst() .orElse(null); if (genericInterfaceType instanceof ParameterizedType) { Type[] actualTypes = ((ParameterizedType) genericInterfaceType).getActualTypeArguments(); if (actualTypes.length >= parameterIndex) { return (Class) actualTypes[parameterIndex]; } } return null; } private  ReflectionHelper(); static Class<?> getConcreteTypeOfGenericInterfaceImplementation(
            Object instanceToExamine,
            Class<?> implementedInterfaceClass,
            int parameterIndex); static Class<?> getConcreteTypeOfGenericClassExtension(
            Class<?> classToExamine,
            int parameterIndex); static Object instanceFromClassName(String className);  }
@Test void genericInterfaceImplementation() { assertThat( getConcreteTypeOfGenericInterfaceImplementation(new Interface<Double>() { @Override public void someMethod(Double t) { } }, Interface.class, 0), is(Double.class)); assertThat( getConcreteTypeOfGenericInterfaceImplementation(new InterfaceImpl(), Interface.class, 0), is(Double.class)); Interface<String> implementingLambda = s -> {}; assertNull( getConcreteTypeOfGenericInterfaceImplementation(implementingLambda, Interface.class, 0)); }