Repository: orika-mapper/orika (java)

Issue:
ParameterizedType convert bug when use collection
demo code:
```
package roman;

import lombok.Data;
import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.impl.DefaultMapperFactory;

import java.util.Arrays;
import java.util.List;

/**
 *
 * @Auther: romanluo
 * @Date: 2018/12/4
 */
public class Test {

	public static void main(String[] args) {
		MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
		B b = new B();
		b.setId(1);
		A a = new A();
		a.setE(Arrays.asList(b));
		a.setE1(b);
		D d = mapperFactory.getMapperFacade().map(a, D.class);
		System.out.println("d.e type: " + d.e.get(0).getClass().getName());
		System.out.println("d.e1 type: " + d.e1.getClass().getName());
	}

	@Data
	static class A<E extends B> {
		List<E> e;

		E e1;
	}

	@Data
	static class B {

		int id;

	}

	@Data
	static class C extends B {

		String name;

	}

	@Data
	static class D extends A<C> {

	}
}
```
result:
d.e type: roman.Test$B
d.e1 type: roman.Test$C

d.e type should be roman.Test$C, the same as d.e1 type, but now is Test$B


Pull request description:
fix #296 issues
fix #296 issues

Patch:
diff --git a/core/src/main/java/ma/glasnost/orika/metadata/TypeUtil.java b/core/src/main/java/ma/glasnost/orika/metadata/TypeUtil.java
index bfcc60d6..2e605aa9 100644
--- a/core/src/main/java/ma/glasnost/orika/metadata/TypeUtil.java
+++ b/core/src/main/java/ma/glasnost/orika/metadata/TypeUtil.java
@@ -1,4 +1,4 @@
-/*
+ /*
  * Orika - simpler, better and faster Java bean mapping
  *
  * Copyright (C) 2011-2013 Orika authors
@@ -82,8 +82,14 @@ abstract class TypeUtil {
                     if (typeArg instanceof TypeVariable) {
                         var = (TypeVariable<?>) typeArg;
                     }
-                    Type<?> typeFromReference = (Type<?>) currentReference.getTypeByVariable(var);
-                    
+					Type<?> typeFromReference = null;
+					Type<?> targetReference = currentReference;
+					while (!TypeFactory.TYPE_OF_OBJECT.equals(targetReference)) {
+						typeFromReference = (Type<?>) targetReference.getTypeByVariable(var);
+						if(typeFromReference != null)
+							break;
+						targetReference = TypeFactory.valueOf(targetReference.getRawType().getGenericSuperclass());
+					}
                     if (typeFromReference != null && typeArg.equals(var)) {
                         if (actualTypeArguments[i] == null
                                 || (actualTypeArguments[i] instanceof Type && ((Type<?>) actualTypeArguments[i]).isAssignableFrom(typeFromReference))) {


Test patch:
diff --git a/tests/src/main/java/ma/glasnost/orika/test/metadata/Issues296Test.java b/tests/src/main/java/ma/glasnost/orika/test/metadata/Issues296Test.java
new file mode 100644
index 00000000..d57503ba
--- /dev/null
+++ b/tests/src/main/java/ma/glasnost/orika/test/metadata/Issues296Test.java
@@ -0,0 +1,71 @@
+package ma.glasnost.orika.test.metadata;
+
+import ma.glasnost.orika.MapperFacade;
+import ma.glasnost.orika.MapperFactory;
+import ma.glasnost.orika.impl.DefaultMapperFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @Auther: 530827804@qq.com
+ * @Date: 2018/12/6
+ */
+public class Issues296Test {
+
+	@Test
+	public void testIssues296() {
+		MapperFactory factory = new DefaultMapperFactory.Builder().build();
+		final MapperFacade mapperFacade = factory.getMapperFacade();
+		A a = new A();
+		B b = new B();
+		F<B> f = new F();
+		f.setG(b);
+		a.setF(f);
+		final D d = mapperFacade.map(a, D.class);
+		final H g = mapperFacade.map(a, H.class);
+		Assert.assertEquals(d.getF().getG().getClass(), C.class);
+		Assert.assertEquals(g.getF().getG().getClass(), C.class);
+	}
+
+	public static class A<E extends B> {
+
+		F<E> f;
+
+		public F<E> getF() {
+			return f;
+		}
+
+		public void setF(F<E> f) {
+			this.f = f;
+		}
+	}
+
+	public static class B {
+
+	}
+
+	public static class C extends B {
+
+	}
+
+	public static class D extends A<C> {
+
+	}
+
+	public static class F<G> {
+		G g;
+
+		public G getG() {
+			return g;
+		}
+
+		public void setG(G g) {
+			this.g = g;
+		}
+	}
+
+	public static class H extends D {
+
+	}
+}