class TypeInfoParser {

	@SuppressWarnings("unchecked")
	public static <X> TypeInformation<X> parse(String infoString) {
		try {
			if (infoString == null) {
				throw new IllegalArgumentException("String is null.");
			}
			String clearedString = infoString.replaceAll("\\s", "");
			if (clearedString.length() == 0) {
				throw new IllegalArgumentException("String must not be empty.");
			}
			StringBuilder sb = new StringBuilder(clearedString);
			TypeInformation<X> ti = (TypeInformation<X>) parse(sb);
			if (sb.length() > 0) {
				throw new IllegalArgumentException("String could not be parsed completely.");
			}
			return ti;
		} catch (Exception e) {
			throw new IllegalArgumentException("String could not be parsed: " + e.getMessage(), e);
		}
	}

}

class TypeInfoParserTest {

	@Test
	public void testLargeMixedTuple() {

		TypeInformation<?> ti = TypeInfoParser.parse("org.apache.flink.api.java.tuple.Tuple4<Double,java.lang.Class[],StringValue,Tuple1<int>>[]");
		Assert.assertEquals("ObjectArrayTypeInfo<Java Tuple4<Double, ObjectArrayTypeInfo<GenericType<java.lang.Class>>, ValueType<StringValue>, Java Tuple1<Integer>>>", ti.toString());
	}

}