[FLINK-9292] [core] Remove TypeInfoParser (part 2)

This changes #5970


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/9ddb978b
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/9ddb978b
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/9ddb978b

Branch: refs/heads/master
Commit: 9ddb978b04fb602609675936df3d0c6ff9b8519b
Parents: c6fa05e
Author: yanghua <yanghua1...@gmail.com>
Authored: Wed May 9 17:13:06 2018 +0800
Committer: Stephan Ewen <se...@apache.org>
Committed: Thu May 17 15:12:50 2018 +0200

----------------------------------------------------------------------
 .../connectors/kafka/KafkaProducerTestBase.java |   4 +-
 flink-core/pom.xml                              |   1 +
 .../api/java/typeutils/TypeInfoParser.java      | 417 -------------------
 .../api/java/typeutils/TypeExtractorTest.java   | 105 +++--
 .../api/java/sca/UdfAnalyzerExamplesTest.java   |  80 ++--
 .../flink/api/java/sca/UdfAnalyzerTest.java     | 241 +++++------
 .../graph/asm/dataset/ChecksumHashCodeTest.java |   5 +-
 .../flink/graph/asm/dataset/CollectTest.java    |   5 +-
 .../flink/graph/asm/dataset/CountTest.java      |   5 +-
 9 files changed, 226 insertions(+), 637 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/9ddb978b/flink-connectors/flink-connector-kafka-base/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaProducerTestBase.java
----------------------------------------------------------------------
diff --git 
a/flink-connectors/flink-connector-kafka-base/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaProducerTestBase.java
 
b/flink-connectors/flink-connector-kafka-base/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaProducerTestBase.java
index 5023a7e..629497e 100644
--- 
a/flink-connectors/flink-connector-kafka-base/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaProducerTestBase.java
+++ 
b/flink-connectors/flink-connector-kafka-base/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaProducerTestBase.java
@@ -24,9 +24,9 @@ import 
org.apache.flink.api.common.restartstrategy.RestartStrategies;
 import org.apache.flink.api.common.serialization.SerializationSchema;
 import 
org.apache.flink.api.common.serialization.TypeInformationSerializationSchema;
 import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
+import org.apache.flink.api.common.typeinfo.TypeHint;
 import org.apache.flink.api.common.typeinfo.TypeInformation;
 import org.apache.flink.api.java.tuple.Tuple2;
-import org.apache.flink.api.java.typeutils.TypeInfoParser;
 import org.apache.flink.configuration.Configuration;
 import org.apache.flink.runtime.client.JobExecutionException;
 import org.apache.flink.runtime.state.CheckpointListener;
@@ -116,7 +116,7 @@ public abstract class KafkaProducerTestBase extends 
KafkaTestBase {
                        expectedTopicsToNumPartitions.put(defaultTopic, 
defaultTopicPartitions);
                        expectedTopicsToNumPartitions.put(dynamicTopic, 
dynamicTopicPartitions);
 
-                       TypeInformation<Tuple2<Long, String>> longStringInfo = 
TypeInfoParser.parse("Tuple2<Long, String>");
+                       TypeInformation<Tuple2<Long, String>> longStringInfo = 
TypeInformation.of(new TypeHint<Tuple2<Long, String>>(){});
 
                        StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
                        env.setRestartStrategy(RestartStrategies.noRestart());

http://git-wip-us.apache.org/repos/asf/flink/blob/9ddb978b/flink-core/pom.xml
----------------------------------------------------------------------
diff --git a/flink-core/pom.xml b/flink-core/pom.xml
index efd7b12..9826be0 100644
--- a/flink-core/pom.xml
+++ b/flink-core/pom.xml
@@ -177,6 +177,7 @@ under the License.
 
                                                        <!-- leaked constructor 
in TypeHint -->
                                                        
<exclude>org.apache.flink.api.common.typeinfo.TypeHint</exclude>
+                                                       
<exclude>org.apache.flink.api.java.typeutils.TypeInfoParser</exclude>
                                                </excludes>
                                        </parameter>
                                </configuration>

http://git-wip-us.apache.org/repos/asf/flink/blob/9ddb978b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeInfoParser.java
----------------------------------------------------------------------
diff --git 
a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeInfoParser.java
 
b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeInfoParser.java
deleted file mode 100644
index bb74e70..0000000
--- 
a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeInfoParser.java
+++ /dev/null
@@ -1,417 +0,0 @@
- /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.api.java.typeutils;
-
- import org.apache.flink.annotation.Public;
- import org.apache.flink.api.common.typeinfo.BasicArrayTypeInfo;
- import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
- import org.apache.flink.api.common.typeinfo.PrimitiveArrayTypeInfo;
- import org.apache.flink.api.common.typeinfo.TypeInformation;
- import org.apache.flink.types.Value;
-
- import java.lang.reflect.Field;
- import java.util.ArrayList;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
-
-/**
- * @deprecated Use {@link org.apache.flink.api.common.typeinfo.Types} instead.
- */
-@Deprecated
-@Public
-public class TypeInfoParser {
-       private static final String TUPLE_PACKAGE = 
"org.apache.flink.api.java.tuple";
-       private static final String VALUE_PACKAGE = "org.apache.flink.types";
-       private static final String WRITABLE_PACKAGE = "org.apache.hadoop.io";
-
-       private static final Pattern tuplePattern = Pattern.compile("^(" + 
TUPLE_PACKAGE.replaceAll("\\.", "\\\\.") + 
"\\.)?((Tuple[1-9][0-9]?)<|(Tuple0))");
-       private static final Pattern writablePattern = Pattern.compile("^((" + 
WRITABLE_PACKAGE.replaceAll("\\.", "\\\\.") + 
"\\.)?Writable)<([^\\s,>]*)(,|>|$|\\[)");
-       private static final Pattern enumPattern = 
Pattern.compile("^((java\\.lang\\.)?Enum)<([^\\s,>]*)(,|>|$|\\[)");
-       private static final Pattern basicTypePattern = Pattern
-                       
.compile("^((java\\.lang\\.)?(String|Integer|Byte|Short|Character|Double|Float|Long|Boolean|Void))(,|>|$|\\[)");
-       private static final Pattern basicTypeDatePattern = 
Pattern.compile("^((java\\.util\\.)?Date)(,|>|$|\\[)");
-       private static final Pattern basicTypeBigIntPattern = 
Pattern.compile("^((java\\.math\\.)?BigInteger)(,|>|$|\\[)");
-       private static final Pattern basicTypeBigDecPattern = 
Pattern.compile("^((java\\.math\\.)?BigDecimal)(,|>|$|\\[)");
-       private static final Pattern primitiveTypePattern = 
Pattern.compile("^(int|byte|short|char|double|float|long|boolean|void)(,|>|$|\\[)");
-       private static final Pattern valueTypePattern = Pattern.compile("^((" + 
VALUE_PACKAGE.replaceAll("\\.", "\\\\.")
-                       + 
"\\.)?(String|Int|Byte|Short|Char|Double|Float|Long|Boolean|List|Map|Null))Value(,|>|$|\\[)");
-       private static final Pattern pojoGenericObjectPattern = 
Pattern.compile("^([^\\s,<>\\[]+)(<)?");
-       private static final Pattern fieldPattern = 
Pattern.compile("^([^\\s,<>\\[]+)=");
-
-       /**
-        * Generates an instance of <code>TypeInformation</code> by parsing a 
type
-        * information string. A type information string can contain the 
following
-        * types:
-        *
-        * <ul>
-        * <li>Basic types such as <code>Integer</code>, <code>String</code>, 
etc.
-        * <li>Basic type arrays such as <code>Integer[]</code>,
-        * <code>String[]</code>, etc.
-        * <li>Tuple types such as <code>Tuple1&lt;TYPE0&gt;</code>,
-        * <code>Tuple2&lt;TYPE0, TYPE1&gt;</code>, etc.</li>
-        * <li>Pojo types such as 
<code>org.my.MyPojo&lt;myFieldName=TYPE0,myFieldName2=TYPE1&gt;</code>, 
etc.</li>
-        * <li>Generic types such as <code>java.lang.Class</code>, etc.
-        * <li>Custom type arrays such as <code>org.my.CustomClass[]</code>,
-        * <code>org.my.CustomClass$StaticInnerClass[]</code>, etc.
-        * <li>Value types such as <code>DoubleValue</code>,
-        * <code>StringValue</code>, <code>IntegerValue</code>, etc.</li>
-        * <li>Tuple array types such as <code>Tuple2&lt;TYPE0,TYPE1&gt;[], 
etc.</code></li>
-        * <li>Writable types such as 
<code>Writable&lt;org.my.CustomWritable&gt;</code></li>
-        * <li>Enum types such as 
<code>Enum&lt;org.my.CustomEnum&gt;</code></li>
-        * </ul>
-        *
-        * Example:
-        * 
<code>"Tuple2&lt;String,Tuple2&lt;Integer,org.my.MyJob$Pojo&lt;word=String&gt;&gt;&gt;"</code>
-        *
-        * @param infoString
-        *            type information string to be parsed
-        * @return <code>TypeInformation</code> representation of the string
-        */
-       @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);
-               }
-       }
-
-       @SuppressWarnings({ "rawtypes", "unchecked" })
-       private static TypeInformation<?> parse(StringBuilder sb) throws 
ClassNotFoundException {
-               String infoString = sb.toString();
-               final Matcher tupleMatcher = tuplePattern.matcher(infoString);
-
-               final Matcher writableMatcher = 
writablePattern.matcher(infoString);
-               final Matcher enumMatcher = enumPattern.matcher(infoString);
-
-               final Matcher basicTypeMatcher = 
basicTypePattern.matcher(infoString);
-               final Matcher basicTypeDateMatcher = 
basicTypeDatePattern.matcher(infoString);
-               final Matcher basicTypeBigIntMatcher = 
basicTypeBigIntPattern.matcher(infoString);
-               final Matcher basicTypeBigDecMatcher = 
basicTypeBigDecPattern.matcher(infoString);
-
-               final Matcher primitiveTypeMatcher = 
primitiveTypePattern.matcher(infoString);
-
-               final Matcher valueTypeMatcher = 
valueTypePattern.matcher(infoString);
-
-               final Matcher pojoGenericMatcher = 
pojoGenericObjectPattern.matcher(infoString);
-
-               if (infoString.length() == 0) {
-                       return null;
-               }
-
-               TypeInformation<?> returnType = null;
-               boolean isPrimitiveType = false;
-
-               // tuples
-               if (tupleMatcher.find()) {
-                       boolean isGenericTuple = true;
-                       String className = tupleMatcher.group(3);
-                       if(className == null) { // matched Tuple0
-                               isGenericTuple = false;
-                               className = tupleMatcher.group(2);
-                               sb.delete(0, className.length());
-                       } else {
-                               sb.delete(0, className.length() + 1); // +1 for 
"<"
-                       }
-
-                       if (infoString.startsWith(TUPLE_PACKAGE)) {
-                               sb.delete(0, TUPLE_PACKAGE.length() + 1); // +1 
for trailing "."
-                       }
-
-                       int arity = 
Integer.parseInt(className.replaceAll("\\D", ""));
-                       Class<?> clazz = loadClass(TUPLE_PACKAGE + "." + 
className);
-
-                       TypeInformation<?>[] types = new 
TypeInformation<?>[arity];
-                       for (int i = 0; i < arity; i++) {
-                               types[i] = parse(sb);
-                               if (types[i] == null) {
-                                       throw new 
IllegalArgumentException("Tuple arity does not match given parameters.");
-                               }
-                       }
-                       if (isGenericTuple) {
-                               if(sb.charAt(0) != '>') {
-                                       throw new 
IllegalArgumentException("Tuple arity does not match given parameters.");
-                               }
-                               // remove '>'
-                               sb.deleteCharAt(0);
-                       }
-                       returnType = new TupleTypeInfo(clazz, types);
-               }
-               // writable types
-               else if (writableMatcher.find()) {
-                       String className = writableMatcher.group(1);
-                       String fullyQualifiedName = writableMatcher.group(3);
-                       sb.delete(0, className.length() + 1 + 
fullyQualifiedName.length() + 1);
-                       Class<?> clazz = loadClass(fullyQualifiedName);
-                       returnType = 
TypeExtractor.createHadoopWritableTypeInfo(clazz);
-               }
-               // enum types
-               else if (enumMatcher.find()) {
-                       String className = enumMatcher.group(1);
-                       String fullyQualifiedName = enumMatcher.group(3);
-                       sb.delete(0, className.length() + 1 + 
fullyQualifiedName.length() + 1);
-                       Class<?> clazz = loadClass(fullyQualifiedName);
-                       returnType = new EnumTypeInfo(clazz);
-               }
-               // basic types
-               else if (basicTypeMatcher.find()) {
-                       String className = basicTypeMatcher.group(1);
-                       sb.delete(0, className.length());
-                       Class<?> clazz;
-                       // check if fully qualified
-                       if (className.startsWith("java.lang")) {
-                               clazz = loadClass(className);
-                       } else {
-                               clazz = loadClass("java.lang." + className);
-                       }
-                       returnType = BasicTypeInfo.getInfoFor(clazz);
-               }
-               // special basic type "Date"
-               else if (basicTypeDateMatcher.find()) {
-                       String className = basicTypeDateMatcher.group(1);
-                       sb.delete(0, className.length());
-                       Class<?> clazz;
-                       // check if fully qualified
-                       if (className.startsWith("java.util")) {
-                               clazz = loadClass(className);
-                       } else {
-                               clazz = loadClass("java.util." + className);
-                       }
-                       returnType = BasicTypeInfo.getInfoFor(clazz);
-               }
-               // special basic type "BigInteger"
-               else if (basicTypeBigIntMatcher.find()) {
-                       String className = basicTypeBigIntMatcher.group(1);
-                       sb.delete(0, className.length());
-                       Class<?> clazz;
-                       // check if fully qualified
-                       if (className.startsWith("java.math")) {
-                               clazz = loadClass(className);
-                       } else {
-                               clazz = loadClass("java.math." + className);
-                       }
-                       returnType = BasicTypeInfo.getInfoFor(clazz);
-               }
-               // special basic type "BigDecimal"
-               else if (basicTypeBigDecMatcher.find()) {
-                       String className = basicTypeBigDecMatcher.group(1);
-                       sb.delete(0, className.length());
-                       Class<?> clazz;
-                       // check if fully qualified
-                       if (className.startsWith("java.math")) {
-                               clazz = loadClass(className);
-                       } else {
-                               clazz = loadClass("java.math." + className);
-                       }
-                       returnType = BasicTypeInfo.getInfoFor(clazz);
-               }
-               // primitive types
-               else if (primitiveTypeMatcher.find()) {
-                       String keyword = primitiveTypeMatcher.group(1);
-                       sb.delete(0, keyword.length());
-
-                       Class<?> clazz = null;
-                       if (keyword.equals("int")) {
-                               clazz = int.class;
-                       } else if (keyword.equals("byte")) {
-                               clazz = byte.class;
-                       } else if (keyword.equals("short")) {
-                               clazz = short.class;
-                       } else if (keyword.equals("char")) {
-                               clazz = char.class;
-                       } else if (keyword.equals("double")) {
-                               clazz = double.class;
-                       } else if (keyword.equals("float")) {
-                               clazz = float.class;
-                       } else if (keyword.equals("long")) {
-                               clazz = long.class;
-                       } else if (keyword.equals("boolean")) {
-                               clazz = boolean.class;
-                       } else if (keyword.equals("void")) {
-                               clazz = void.class;
-                       }
-                       returnType = BasicTypeInfo.getInfoFor(clazz);
-                       isPrimitiveType = true;
-               }
-               // values
-               else if (valueTypeMatcher.find()) {
-                       String className = valueTypeMatcher.group(1);
-                       sb.delete(0, className.length() + 5);
-
-                       Class<?> clazz;
-                       // check if fully qualified
-                       if (className.startsWith(VALUE_PACKAGE)) {
-                               clazz = loadClass(className + "Value");
-                       } else {
-                               clazz = loadClass(VALUE_PACKAGE + "." + 
className + "Value");
-                       }
-                       returnType = 
ValueTypeInfo.getValueTypeInfo((Class<Value>) clazz);
-               }
-               // pojo objects or generic types
-               else if (pojoGenericMatcher.find()) {
-                       String fullyQualifiedName = pojoGenericMatcher.group(1);
-                       sb.delete(0, fullyQualifiedName.length());
-
-                       boolean isPojo = pojoGenericMatcher.group(2) != null;
-
-                       // pojo
-                       if (isPojo) {
-                               sb.deleteCharAt(0);
-                               Class<?> clazz = loadClass(fullyQualifiedName);
-
-                               ArrayList<PojoField> fields = new 
ArrayList<PojoField>();
-                               while (sb.charAt(0) != '>') {
-                                       final Matcher fieldMatcher = 
fieldPattern.matcher(sb);
-                                       if (!fieldMatcher.find()) {
-                                               throw new 
IllegalArgumentException("Field name missing.");
-                                       }
-                                       String fieldName = 
fieldMatcher.group(1);
-                                       sb.delete(0, fieldName.length() + 1);
-
-                                       Field field = 
TypeExtractor.getDeclaredField(clazz, fieldName);
-                                       if (field == null) {
-                                               throw new 
IllegalArgumentException("Field '" + fieldName + "'could not be accessed.");
-                                       }
-                                       fields.add(new PojoField(field, 
parse(sb)));
-                               }
-                               sb.deleteCharAt(0); // remove '>'
-                               returnType = new PojoTypeInfo(clazz, fields);
-                       }
-                       // generic type
-                       else {
-                               returnType = new 
GenericTypeInfo(loadClass(fullyQualifiedName));
-                       }
-               }
-
-               if (returnType == null) {
-                       throw new IllegalArgumentException("Error at '" + 
infoString + "'");
-               }
-
-               // arrays
-               int arrayDimensionCount = 0;
-               while (sb.length() > 1 && sb.charAt(0) == '[' && sb.charAt(1) 
== ']') {
-                       arrayDimensionCount++;
-                       sb.delete(0, 2);
-               }
-
-               if (sb.length() > 0 && sb.charAt(0) == '[') {
-                       throw new IllegalArgumentException("Closing square 
bracket missing.");
-               }
-               
-               // construct multidimension array
-               if (arrayDimensionCount > 0) {
-                       TypeInformation<?> arrayInfo = null;
-                       
-                       // first dimension
-                       // primitive array
-                       if (isPrimitiveType) {
-                               if (returnType == BasicTypeInfo.INT_TYPE_INFO) {
-                                       arrayInfo = 
PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.BYTE_TYPE_INFO) {
-                                       arrayInfo = 
PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.SHORT_TYPE_INFO) {
-                                       arrayInfo = 
PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.CHAR_TYPE_INFO) {
-                                       arrayInfo = 
PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.DOUBLE_TYPE_INFO) {
-                                       arrayInfo = 
PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.FLOAT_TYPE_INFO) {
-                                       arrayInfo = 
PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.LONG_TYPE_INFO) {
-                                       arrayInfo = 
PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.BOOLEAN_TYPE_INFO) {
-                                       arrayInfo = 
PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.VOID_TYPE_INFO) {
-                                       throw new IllegalArgumentException("Can 
not create an array of void.");
-                               }
-                       }
-                       // basic array
-                       else if (returnType instanceof BasicTypeInfo
-                                       && returnType != 
BasicTypeInfo.DATE_TYPE_INFO) {
-                               if (returnType == BasicTypeInfo.INT_TYPE_INFO) {
-                                       arrayInfo = 
BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.BYTE_TYPE_INFO) {
-                                       arrayInfo = 
BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.SHORT_TYPE_INFO) {
-                                       arrayInfo = 
BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.CHAR_TYPE_INFO) {
-                                       arrayInfo = 
BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.DOUBLE_TYPE_INFO) {
-                                       arrayInfo = 
BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.FLOAT_TYPE_INFO) {
-                                       arrayInfo = 
BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.LONG_TYPE_INFO) {
-                                       arrayInfo = 
BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.BOOLEAN_TYPE_INFO) {
-                                       arrayInfo = 
BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.STRING_TYPE_INFO) {
-                                       arrayInfo = 
BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO;
-                               } else if (returnType == 
BasicTypeInfo.VOID_TYPE_INFO) {
-                                       throw new IllegalArgumentException("Can 
not create an array of void.");
-                               }
-                       }
-                       // object array
-                       else {
-                               arrayInfo = 
ObjectArrayTypeInfo.getInfoFor(loadClass("[L" + 
returnType.getTypeClass().getName() + ";"),
-                                               returnType);
-                       }
-
-                       // further dimensions
-                       if (arrayDimensionCount > 1) {
-                               String arrayPrefix = "[";
-                               for (int i = 1; i < arrayDimensionCount; i++) {
-                                       arrayPrefix += "[";
-                                       arrayInfo =  
ObjectArrayTypeInfo.getInfoFor(loadClass(arrayPrefix + "L" +
-                                                       
returnType.getTypeClass().getName() + ";"), arrayInfo);
-                               }
-                       }
-                       returnType = arrayInfo;
-               }
-
-               // remove possible ','
-               if (sb.length() > 0 && sb.charAt(0) == ',') {
-                       sb.deleteCharAt(0);
-               }
-
-               // check if end 
-               return returnType;
-       }
-
-       private static Class<?> loadClass(String fullyQualifiedName) {
-               try {
-                       return Class.forName(fullyQualifiedName);
-               } catch (ClassNotFoundException e) {
-                       throw new IllegalArgumentException("Class '" + 
fullyQualifiedName
-                                       + "' could not be found. Please note 
that inner classes must be declared static.");
-               }
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/flink/blob/9ddb978b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/TypeExtractorTest.java
----------------------------------------------------------------------
diff --git 
a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/TypeExtractorTest.java
 
b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/TypeExtractorTest.java
index 804cf88..b763f54 100644
--- 
a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/TypeExtractorTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/TypeExtractorTest.java
@@ -46,6 +46,7 @@ import 
org.apache.flink.api.common.typeinfo.PrimitiveArrayTypeInfo;
 import org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo;
 import org.apache.flink.api.common.typeinfo.TypeHint;
 import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.api.common.typeinfo.Types;
 import org.apache.flink.api.common.typeutils.CompositeType.FlatFieldDescriptor;
 import org.apache.flink.api.common.typeutils.TypeSerializer;
 import org.apache.flink.api.java.functions.KeySelector;
@@ -84,7 +85,7 @@ public class TypeExtractorTest {
                        }
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getGroupReduceReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Boolean"));
+               TypeInformation<?> ti = 
TypeExtractor.getGroupReduceReturnTypes(function, (TypeInformation) 
Types.BOOLEAN);
 
                Assert.assertTrue(ti.isBasicType());
                Assert.assertEquals(BasicTypeInfo.BOOLEAN_TYPE_INFO, ti);
@@ -113,7 +114,7 @@ public class TypeExtractorTest {
 
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple9<Integer, Long, Double, Float, Boolean, String, 
Character, Short, Byte>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple9<Integer, Long, Double, Float, Boolean, 
String, Character, Short, Byte>>(){}));
 
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(9, ti.getArity());
@@ -180,7 +181,7 @@ public class TypeExtractorTest {
                        }
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getFlatMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple3<Tuple1<String>, Tuple1<Integer>, Tuple2<Long, 
Long>>"));
+               TypeInformation<?> ti = 
TypeExtractor.getFlatMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple3<Tuple1<String>, Tuple1<Integer>, 
Tuple2<Long, Long>>>(){}));
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(3, ti.getArity());
                Assert.assertTrue(ti instanceof TupleTypeInfo);
@@ -249,7 +250,7 @@ public class TypeExtractorTest {
                };
 
                TypeInformation<?> ti = 
TypeExtractor.getFlatMapReturnTypes(function,
-                               (TypeInformation) 
TypeInfoParser.parse("Tuple0"));
+                               (TypeInformation) TypeInformation.of(new 
TypeHint<Tuple0>(){}));
 
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(0, ti.getArity());
@@ -269,7 +270,7 @@ public class TypeExtractorTest {
                        }                       
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getFlatJoinReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple2<String, Integer>"), (TypeInformation) 
TypeInfoParser.parse("String"));
+               TypeInformation<?> ti = 
TypeExtractor.getFlatJoinReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple2<String, Integer>>(){}), 
(TypeInformation) Types.STRING);
 
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(2, ti.getArity());
@@ -323,8 +324,8 @@ public class TypeExtractorTest {
                };
 
                TypeInformation<?> ti = 
TypeExtractor.getCrossReturnTypes(function, 
-                               (TypeInformation) 
TypeInfoParser.parse("org.apache.flink.api.java.typeutils.TypeExtractorTest$CustomType"),
-                               (TypeInformation) 
TypeInfoParser.parse("Integer"));
+                               (TypeInformation) TypeInformation.of(new 
TypeHint<CustomType>(){}),
+                               (TypeInformation) Types.INT);
 
                Assert.assertFalse(ti.isBasicType());
                Assert.assertFalse(ti.isTupleType());
@@ -394,7 +395,7 @@ public class TypeExtractorTest {
                };
 
                TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, 
-                               (TypeInformation) 
TypeInfoParser.parse("Tuple2<Long,org.apache.flink.api.java.typeutils.TypeExtractorTest$CustomType>"));
+                               (TypeInformation) TypeInformation.of(new 
TypeHint<Tuple2<Long, CustomType>>(){}));
 
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(2, ti.getArity());
@@ -451,7 +452,7 @@ public class TypeExtractorTest {
                        }
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getKeySelectorTypes(function, (TypeInformation) 
TypeInfoParser.parse("StringValue"));
+               TypeInformation<?> ti = 
TypeExtractor.getKeySelectorTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<StringValue>(){}));
 
                Assert.assertFalse(ti.isBasicType());
                Assert.assertFalse(ti.isTupleType());
@@ -481,7 +482,7 @@ public class TypeExtractorTest {
                        }
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple2<StringValue, IntValue>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple2<StringValue, IntValue>>(){}));
 
                Assert.assertFalse(ti.isBasicType());
                Assert.assertTrue(ti.isTupleType());
@@ -520,7 +521,7 @@ public class TypeExtractorTest {
                        }
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple2<Long, String>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple2<Long, String>>(){}));
 
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(2, ti.getArity());
@@ -563,7 +564,7 @@ public class TypeExtractorTest {
                        }                       
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple3<String, Long, Integer>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple3<String, Long, Integer>>(){}));
 
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(3, ti.getArity());
@@ -605,7 +606,7 @@ public class TypeExtractorTest {
                        }                       
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple3<String, Long, String>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple3<String, Long, String>>(){}));
 
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(3, ti.getArity());
@@ -631,7 +632,7 @@ public class TypeExtractorTest {
                        }                       
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple3<String, Long, String>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple3<String, Long, String>>(){}));
 
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(3, ti.getArity());
@@ -656,11 +657,11 @@ public class TypeExtractorTest {
                        }
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("String"), "name", true);
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) Types.STRING, 
"name", true);
                Assert.assertTrue(ti instanceof MissingTypeInfo);
                
                try {
-                       TypeExtractor.getMapReturnTypes(function, 
(TypeInformation) TypeInfoParser.parse("String"));
+                       TypeExtractor.getMapReturnTypes(function, 
(TypeInformation) Types.STRING);
                        Assert.fail("Expected an exception");
                }
                catch (InvalidTypesException e) {
@@ -680,11 +681,11 @@ public class TypeExtractorTest {
                        }
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("String"), "name", true);
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) Types.STRING, 
"name", true);
                Assert.assertTrue(ti instanceof MissingTypeInfo);
                
                try {
-                       TypeExtractor.getMapReturnTypes(function, 
(TypeInformation) TypeInfoParser.parse("String"));
+                       TypeExtractor.getMapReturnTypes(function, 
(TypeInformation) Types.STRING);
                        Assert.fail("Expected an exception");
                }
                catch (InvalidTypesException e) {
@@ -712,7 +713,7 @@ public class TypeExtractorTest {
                        }
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple2<String, String>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple2<String, String>>(){}));
 
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(2, ti.getArity());
@@ -744,7 +745,7 @@ public class TypeExtractorTest {
                        }
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple2<String, Tuple2<Integer, Integer>>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple2<String, Tuple2<Integer, Integer>>>(){}));
 
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(2, ti.getArity());
@@ -783,7 +784,7 @@ public class TypeExtractorTest {
                        }
                };
                
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple2<Boolean, Tuple2<Tuple2<Integer, Tuple2<Boolean, 
Boolean>>, Tuple2<Integer, Tuple2<Boolean, Boolean>>>>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple2<Boolean, Tuple2<Tuple2<Integer, 
Tuple2<Boolean, Boolean>>, Tuple2<Integer, Tuple2<Boolean, Boolean>>>>>(){}));
 
                // Should be 
                // Tuple2<Boolean, Tuple2<Tuple2<Integer, Tuple2<Boolean, 
Boolean>>, Tuple2<Integer, Tuple2<Boolean, Boolean>>>>
@@ -823,11 +824,11 @@ public class TypeExtractorTest {
                        }
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, TypeInfoParser.parse("String"), 
"name", true);
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, Types.STRING, "name", true);
                Assert.assertTrue(ti instanceof MissingTypeInfo);
                
                try {
-                       TypeExtractor.getMapReturnTypes(function, 
TypeInfoParser.parse("String"));
+                       TypeExtractor.getMapReturnTypes(function, Types.STRING);
                        Assert.fail("Expected an exception");
                }
                catch (InvalidTypesException e) {
@@ -842,7 +843,7 @@ public class TypeExtractorTest {
                        private static final long serialVersionUID = 1L;
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Boolean"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) Types.BOOLEAN);
 
                Assert.assertTrue(ti.isBasicType());
                Assert.assertEquals(BasicTypeInfo.BOOLEAN_TYPE_INFO, ti);
@@ -906,7 +907,7 @@ public class TypeExtractorTest {
        public void testFunctionDependingOnInputWithCustomTupleInput() {
                IdentityMapper<SameTypeVariable<String>> function = new 
IdentityMapper<SameTypeVariable<String>>();
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple2<String, String>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple2<String, String>>(){}));
 
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(2, ti.getArity());
@@ -994,7 +995,7 @@ public class TypeExtractorTest {
        public void testFunctionWithNoGenericSuperclass() {
                RichMapFunction<?, ?> function = new Mapper2();
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("String"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) Types.STRING);
 
                Assert.assertTrue(ti.isBasicType());
                Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, ti);
@@ -1015,7 +1016,7 @@ public class TypeExtractorTest {
                        private static final long serialVersionUID = 1L;
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("DoubleValue"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<DoubleValue>(){}));
 
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(2, ti.getArity());
@@ -1156,11 +1157,11 @@ public class TypeExtractorTest {
                        }
                };
 
-               TypeInformation<?> ti 
=TypeExtractor.getMapReturnTypes(function, 
(TypeInformation)TypeInfoParser.parse("StringValue"), "name", true);
+               TypeInformation<?> ti 
=TypeExtractor.getMapReturnTypes(function, 
(TypeInformation)TypeInformation.of(new TypeHint<StringValue>(){}), "name", 
true);
                Assert.assertTrue(ti instanceof MissingTypeInfo);
                
                try {
-                       TypeExtractor.getMapReturnTypes(function, 
(TypeInformation)TypeInfoParser.parse("StringValue"));
+                       TypeExtractor.getMapReturnTypes(function, 
(TypeInformation)TypeInformation.of(new TypeHint<StringValue>(){}));
                        Assert.fail("Expected an exception");
                }
                catch (InvalidTypesException e) {
@@ -1181,7 +1182,7 @@ public class TypeExtractorTest {
                        }
                };
 
-               TypeInformation<?> ti = 
TypeExtractor.getCoGroupReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("String[]"), (TypeInformation) 
TypeInfoParser.parse("String[]"));
+               TypeInformation<?> ti = 
TypeExtractor.getCoGroupReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<String[]>(){}), (TypeInformation) 
TypeInformation.of(new TypeHint<String[]>(){}));
 
                Assert.assertFalse(ti.isBasicType());
                Assert.assertFalse(ti.isTupleType());
@@ -1224,7 +1225,7 @@ public class TypeExtractorTest {
                };
 
                TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function,
-                               (TypeInformation) 
TypeInfoParser.parse("org.apache.flink.api.java.typeutils.TypeExtractorTest$CustomArrayObject[]"));
+                               (TypeInformation) TypeInformation.of(new 
TypeHint<CustomArrayObject[]>(){}));
 
                Assert.assertTrue(ti instanceof ObjectArrayTypeInfo<?, ?>);
                Assert.assertEquals(CustomArrayObject.class, 
((ObjectArrayTypeInfo<?, ?>) ti).getComponentInfo().getTypeClass());
@@ -1242,7 +1243,7 @@ public class TypeExtractorTest {
                        }
                };
                
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple2<String, String>[]"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple2<String, String>[]>(){}));
 
                Assert.assertTrue(ti instanceof ObjectArrayTypeInfo<?, ?>);
                ObjectArrayTypeInfo<?, ?> oati = (ObjectArrayTypeInfo<?, ?>) ti;
@@ -1262,7 +1263,7 @@ public class TypeExtractorTest {
        public void testCustomArrayWithTypeVariable() {
                RichMapFunction<CustomArrayObject2<Boolean>[], ?> function = 
new IdentityMapper<CustomArrayObject2<Boolean>[]>();
 
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Tuple1<Boolean>[]"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple1<Boolean>[]>(){}));
 
                Assert.assertTrue(ti instanceof ObjectArrayTypeInfo<?, ?>);
                ObjectArrayTypeInfo<?, ?> oati = (ObjectArrayTypeInfo<?, ?>) ti;
@@ -1287,7 +1288,7 @@ public class TypeExtractorTest {
                        private static final long serialVersionUID = 1L;        
                
                };
                
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInfoParser.parse("Boolean[]"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes(function, (TypeInformation) 
TypeInformation.of(new TypeHint<Boolean[]>(){}));
                Assert.assertTrue(ti instanceof ObjectArrayTypeInfo<?,?>);
                ObjectArrayTypeInfo<?, ?> oati = (ObjectArrayTypeInfo<?, ?>) ti;
                Assert.assertEquals(BasicTypeInfo.BOOLEAN_TYPE_INFO, 
oati.getComponentInfo());
@@ -1346,14 +1347,14 @@ public class TypeExtractorTest {
                };
                
                try {
-                       TypeExtractor.getMapReturnTypes(function, 
(TypeInformation) TypeInfoParser.parse("Tuple2<Integer, String>"));
+                       TypeExtractor.getMapReturnTypes(function, 
(TypeInformation) TypeInformation.of(new TypeHint<Tuple2<Integer, 
String>>(){}));
                        Assert.fail("exception expected");
                } catch (InvalidTypesException e) {
                        // right
                }
                
                try {
-                       TypeExtractor.getMapReturnTypes(function, 
(TypeInformation) TypeInfoParser.parse("Tuple3<String, String, String>"));
+                       TypeExtractor.getMapReturnTypes(function, 
(TypeInformation) TypeInformation.of(new TypeHint<Tuple3<String, String, 
String>>(){}));
                        Assert.fail("exception expected");
                } catch (InvalidTypesException e) {
                        // right
@@ -1369,7 +1370,7 @@ public class TypeExtractorTest {
                };
                
                try {
-                       TypeExtractor.getMapReturnTypes(function2, 
(TypeInformation) TypeInfoParser.parse("IntValue"));
+                       TypeExtractor.getMapReturnTypes(function2, 
(TypeInformation) TypeInformation.of(new TypeHint<IntValue>(){}));
                        Assert.fail("exception expected");
                } catch (InvalidTypesException e) {
                        // right
@@ -1385,7 +1386,7 @@ public class TypeExtractorTest {
                };
                
                try {
-                       TypeExtractor.getMapReturnTypes(function3, 
(TypeInformation) TypeInfoParser.parse("Integer[]"));
+                       TypeExtractor.getMapReturnTypes(function3, 
(TypeInformation) TypeInformation.of(new TypeHint<Integer[]>(){}));
                        Assert.fail("exception expected");
                } catch (InvalidTypesException e) {
                        // right
@@ -1405,12 +1406,12 @@ public class TypeExtractorTest {
        @Test
        public void testTypeErasure() {
                TypeInformation<?> ti = TypeExtractor.getFlatMapReturnTypes(new 
DummyFlatMapFunction<String, Integer, String, Boolean>(), 
-                                       (TypeInformation) 
TypeInfoParser.parse("Tuple2<String, Integer>"), "name", true);
+                                       (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple2<String, Integer>>(){}), "name", true);
                Assert.assertTrue(ti instanceof MissingTypeInfo);
                
                try {
                        TypeExtractor.getFlatMapReturnTypes(new 
DummyFlatMapFunction<String, Integer, String, Boolean>(), 
-                                       (TypeInformation) 
TypeInfoParser.parse("Tuple2<String, Integer>"));
+                                       (TypeInformation) 
TypeInformation.of(new TypeHint<Tuple2<String, Integer>>(){}));
                        
                        Assert.fail("Expected an exception");
                }
@@ -1571,7 +1572,7 @@ public class TypeExtractorTest {
        @SuppressWarnings({ "unchecked", "rawtypes" })
        @Test
        public void testDuplicateValue() {
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction) new DuplicateValue<String>(), 
TypeInfoParser.parse("Tuple1<String>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction) new DuplicateValue<String>(), 
TypeInformation.of(new TypeHint<Tuple1<String>>(){}));
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(2, ti.getArity());
                TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
@@ -1591,7 +1592,7 @@ public class TypeExtractorTest {
        @SuppressWarnings({ "unchecked", "rawtypes" })
        @Test
        public void testDuplicateValueNested() {
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction) new 
DuplicateValueNested<String>(), TypeInfoParser.parse("Tuple1<Tuple1<String>>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction) new 
DuplicateValueNested<String>(), TypeInformation.of(new 
TypeHint<Tuple1<Tuple1<String>>>(){}));
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(2, ti.getArity());
                TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
@@ -1618,7 +1619,7 @@ public class TypeExtractorTest {
        @Test
        public void testInputInference1() {
                EdgeMapper<String, Double> em = new EdgeMapper<String, 
Double>();
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction) em, 
TypeInfoParser.parse("Tuple3<String, String, Double>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction) em, TypeInformation.of(new 
TypeHint<Tuple3<String, String, Double>>(){}));
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(3, ti.getArity());
                TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
@@ -1641,7 +1642,7 @@ public class TypeExtractorTest {
        @Test
        public void testInputInference2() {
                EdgeMapper2<Boolean> em = new EdgeMapper2<Boolean>();
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction) em, 
TypeInfoParser.parse("Boolean"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction) em, Types.BOOLEAN);
                Assert.assertTrue(ti.isTupleType());
                Assert.assertEquals(3, ti.getArity());
                TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
@@ -1663,7 +1664,7 @@ public class TypeExtractorTest {
        @Test
        public void testInputInference3() {
                EdgeMapper3<Boolean, String> em = new EdgeMapper3<Boolean, 
String>();
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction) em, 
TypeInfoParser.parse("Tuple3<Boolean,Boolean,String>"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction) em, TypeInformation.of(new 
TypeHint<Tuple3<Boolean,Boolean,String>>(){}));
                Assert.assertTrue(ti.isBasicType());
                Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, ti);
        }
@@ -1681,7 +1682,7 @@ public class TypeExtractorTest {
        @Test
        public void testInputInference4() {
                EdgeMapper4<Boolean, String> em = new EdgeMapper4<Boolean, 
String>();
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction) em, 
TypeInfoParser.parse("Tuple3<Boolean,Boolean,String>[]"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction) em, TypeInformation.of(new 
TypeHint<Tuple3<Boolean,Boolean,String>[]>(){}));
                Assert.assertTrue(ti.isBasicType());
                Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, ti);
        }
@@ -1762,7 +1763,7 @@ public class TypeExtractorTest {
                                return null;
                        }
                };
-               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction)function, 
TypeInfoParser.parse("Tuple2<Integer, Double>[][]"));
+               TypeInformation<?> ti = 
TypeExtractor.getMapReturnTypes((MapFunction)function, TypeInformation.of(new 
TypeHint<Tuple2<Integer, Double>[][]>(){}));
                
Assert.assertEquals("ObjectArrayTypeInfo<ObjectArrayTypeInfo<Java 
Tuple2<Integer, Double>>>", ti.toString());
 
                // primitive array
@@ -1775,7 +1776,7 @@ public class TypeExtractorTest {
                                return null;
                        }
                };
-               ti = TypeExtractor.getMapReturnTypes((MapFunction)function, 
TypeInfoParser.parse("int[][][]"));
+               ti = TypeExtractor.getMapReturnTypes((MapFunction)function, 
TypeInformation.of(new TypeHint<int[][][]>(){}));
                
Assert.assertEquals("ObjectArrayTypeInfo<ObjectArrayTypeInfo<int[]>>", 
ti.toString());
 
                // basic array
@@ -1788,7 +1789,7 @@ public class TypeExtractorTest {
                                return null;
                        }
                };
-               ti = TypeExtractor.getMapReturnTypes((MapFunction)function, 
TypeInfoParser.parse("Integer[][][]"));
+               ti = TypeExtractor.getMapReturnTypes((MapFunction)function, 
TypeInformation.of(new TypeHint<Integer[][][]>(){}));
                
Assert.assertEquals("ObjectArrayTypeInfo<ObjectArrayTypeInfo<BasicArrayTypeInfo<Integer>>>",
 ti.toString());
 
                // pojo array
@@ -1802,16 +1803,14 @@ public class TypeExtractorTest {
                        }
                };
                ti = TypeExtractor.getMapReturnTypes((MapFunction)function, 
-                               
TypeInfoParser.parse("org.apache.flink.api.java.typeutils.TypeExtractorTest$CustomType<"
-                                       + "myField1=String,myField2=int"
-                                       + ">[][][]"));
+                               TypeInformation.of(new 
TypeHint<CustomType[][][]>(){}));
                
                
Assert.assertEquals("ObjectArrayTypeInfo<ObjectArrayTypeInfo<ObjectArrayTypeInfo<"
                                + 
"PojoType<org.apache.flink.api.java.typeutils.TypeExtractorTest$CustomType, 
fields = [myField1: String, myField2: Integer]>"
                                + ">>>", ti.toString());
                
                // generic array
-               ti = TypeExtractor.getMapReturnTypes((MapFunction) new 
MapperWithMultiDimGenericArray<String>(), TypeInfoParser.parse("String[][][]"));
+               ti = TypeExtractor.getMapReturnTypes((MapFunction) new 
MapperWithMultiDimGenericArray<String>(), TypeInformation.of(new 
TypeHint<String[][][]>(){}));
                
Assert.assertEquals("ObjectArrayTypeInfo<ObjectArrayTypeInfo<ObjectArrayTypeInfo<Java
 Tuple1<String>>>>", ti.toString());
        }
 

http://git-wip-us.apache.org/repos/asf/flink/blob/9ddb978b/flink-java/src/test/java/org/apache/flink/api/java/sca/UdfAnalyzerExamplesTest.java
----------------------------------------------------------------------
diff --git 
a/flink-java/src/test/java/org/apache/flink/api/java/sca/UdfAnalyzerExamplesTest.java
 
b/flink-java/src/test/java/org/apache/flink/api/java/sca/UdfAnalyzerExamplesTest.java
index 1b0cbec..e7b87a9 100644
--- 
a/flink-java/src/test/java/org/apache/flink/api/java/sca/UdfAnalyzerExamplesTest.java
+++ 
b/flink-java/src/test/java/org/apache/flink/api/java/sca/UdfAnalyzerExamplesTest.java
@@ -25,6 +25,9 @@ import 
org.apache.flink.api.common.functions.GroupReduceFunction;
 import org.apache.flink.api.common.functions.JoinFunction;
 import org.apache.flink.api.common.functions.MapFunction;
 import org.apache.flink.api.common.functions.ReduceFunction;
+import org.apache.flink.api.common.typeinfo.TypeHint;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.api.common.typeinfo.Types;
 import org.apache.flink.api.java.functions.FunctionAnnotation.ForwardedFields;
 import 
org.apache.flink.api.java.functions.FunctionAnnotation.ForwardedFieldsFirst;
 import 
org.apache.flink.api.java.functions.FunctionAnnotation.ForwardedFieldsSecond;
@@ -161,8 +164,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testEnumTrianglesBasicExamplesTriadBuilder() {
                
compareAnalyzerResultWithAnnotationsSingleInputWithKeys(GroupReduceFunction.class,
 TriadBuilder.class,
-                               "Tuple2<Integer, Integer>",
-                               "Tuple3<Integer, Integer, Integer>",
+                               TypeInformation.of(new TypeHint<Tuple2<Integer, 
Integer>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple3<Integer, 
Integer, Integer>>(){}),
                                new String[] { "0" });
        }
 
@@ -180,8 +183,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testEnumTrianglesBasicExamplesTupleEdgeConverter() {
                
compareAnalyzerResultWithAnnotationsSingleInput(MapFunction.class, 
TupleEdgeConverter.class,
-                               "Tuple2<Integer, Integer>",
-                               "Tuple2<Integer, Integer>");
+                               TypeInformation.of(new TypeHint<Tuple2<Integer, 
Integer>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple2<Integer, 
Integer>>(){}));
        }
 
        private static class EdgeDuplicator implements FlatMapFunction<Edge, 
Edge> {
@@ -196,8 +199,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testEnumTrianglesOptExamplesEdgeDuplicator() {
                
compareAnalyzerResultWithAnnotationsSingleInput(FlatMapFunction.class, 
EdgeDuplicator.class,
-                               "Tuple2<Integer, Integer>",
-                               "Tuple2<Integer, Integer>");
+                               TypeInformation.of(new TypeHint<Tuple2<Integer, 
Integer>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple2<Integer, 
Integer>>(){}));
        }
 
        private static class DegreeCounter implements GroupReduceFunction<Edge, 
Edge> {
@@ -242,8 +245,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testEnumTrianglesOptExamplesDegreeCounter() {
                
compareAnalyzerResultWithAnnotationsSingleInputWithKeys(GroupReduceFunction.class,
 DegreeCounter.class,
-                               "Tuple2<Integer, Integer>",
-                               "Tuple2<Integer, Integer>",
+                               TypeInformation.of(new TypeHint<Tuple2<Integer, 
Integer>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple2<Integer, 
Integer>>(){}),
                                new String[] { "0" });
        }
 
@@ -321,8 +324,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testKMeansExamplesCentroidAccumulator() {
                
compareAnalyzerResultWithAnnotationsSingleInputWithKeys(ReduceFunction.class, 
CentroidAccumulator.class,
-                               "Tuple3<Integer, 
org.apache.flink.api.java.sca.UdfAnalyzerExamplesTest$Point<x=double,y=double>, 
Long>",
-                               "Tuple3<Integer, 
org.apache.flink.api.java.sca.UdfAnalyzerExamplesTest$Point<x=double,y=double>, 
Long>",
+                               TypeInformation.of(new TypeHint<Tuple3<Integer, 
Point, Long>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple3<Integer, 
Point, Long>>(){}),
                                new String[] { "0" });
        }
 
@@ -337,8 +340,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testKMeansExamplesCentroidAverager() {
                
compareAnalyzerResultWithAnnotationsSingleInput(MapFunction.class, 
CentroidAverager.class,
-                               "Tuple3<Integer, 
org.apache.flink.api.java.sca.UdfAnalyzerExamplesTest$Point<x=double,y=double>, 
Long>",
-                               
"org.apache.flink.api.java.sca.UdfAnalyzerExamplesTest$Centroid<x=double,y=double,id=int>");
+                               TypeInformation.of(new TypeHint<Tuple3<Integer, 
Point, Long>>(){}),
+                               TypeInformation.of(new TypeHint<Centroid>(){}));
        }
 
        // 
--------------------------------------------------------------------------------------------
@@ -360,8 +363,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testConnectedComponentsExamplesUndirectEdge() {
                
compareAnalyzerResultWithAnnotationsSingleInput(FlatMapFunction.class, 
UndirectEdge.class,
-                               "Tuple2<Long, Long>",
-                               "Tuple2<Long, Long>");
+                               TypeInformation.of(new TypeHint<Tuple2<Long, 
Long>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple2<Long, 
Long>>(){}));
        }
 
        @ForwardedFieldsFirst("*")
@@ -377,9 +380,9 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testConnectedComponentsExamplesComponentIdFilter() {
                
compareAnalyzerResultWithAnnotationsDualInput(FlatJoinFunction.class, 
ComponentIdFilter.class,
-                               "Tuple2<Long, Long>",
-                               "Tuple2<Long, Long>",
-                               "Tuple2<Long, Long>");
+                               TypeInformation.of(new TypeHint<Tuple2<Long, 
Long>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple2<Long, 
Long>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple2<Long, 
Long>>(){}));
        }
 
        @ForwardedFields("*->f0;*->f1")
@@ -393,8 +396,7 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testConnectedComponentsExamplesDuplicateValue() {
                
compareAnalyzerResultWithAnnotationsSingleInput(MapFunction.class, 
DuplicateValue.class,
-                               "Long",
-                               "Tuple2<Long, Long>");
+                       Types.LONG, TypeInformation.of(new 
TypeHint<Tuple2<Long, Long>>(){}));
        }
 
        @ForwardedFieldsFirst("f1->f1")
@@ -409,9 +411,9 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void 
testConnectedComponentsExamplesNeighborWithComponentIDJoin() {
                
compareAnalyzerResultWithAnnotationsDualInput(JoinFunction.class, 
NeighborWithComponentIDJoin.class,
-                               "Tuple2<Long, Long>",
-                               "Tuple2<Long, Long>",
-                               "Tuple2<Long, Long>");
+                               TypeInformation.of(new TypeHint<Tuple2<Long, 
Long>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple2<Long, 
Long>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple2<Long, 
Long>>(){}));
        }
 
        // 
--------------------------------------------------------------------------------------------
@@ -435,9 +437,9 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testWebLogAnalysisExamplesAntiJoinVisits() {
                
compareAnalyzerResultWithAnnotationsDualInputWithKeys(CoGroupFunction.class, 
AntiJoinVisits.class,
-                               "Tuple3<Integer, String, Integer>",
-                               "Tuple1<String>",
-                               "Tuple3<Integer, String, Integer>",
+                               TypeInformation.of(new TypeHint<Tuple3<Integer, 
String, Integer>>(){}),
+                               TypeInformation.of(new 
TypeHint<Tuple1<String>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple3<Integer, 
String, Integer>>(){}),
                                new String[] { "1" }, new String[] { "0" });
        }
 
@@ -465,8 +467,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testPageRankBasicExamplesBuildOutgoingEdgeList() {
                
compareAnalyzerResultWithAnnotationsSingleInputWithKeys(GroupReduceFunction.class,
 BuildOutgoingEdgeList.class,
-                               "Tuple2<Long, Long>",
-                               "Tuple2<Long, Long[]>",
+                               TypeInformation.of(new TypeHint<Tuple2<Long, 
Long>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple2<Long, 
Long[]>>(){}),
                                new String[] { "0" });
        }
 
@@ -551,8 +553,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testLogisticRegressionExamplesSumGradient() {
                
compareAnalyzerResultWithAnnotationsSingleInputWithKeys(ReduceFunction.class, 
SumGradient.class,
-                               "Tuple1<double>",
-                               "Tuple1<double>",
+                               TypeInformation.of(new 
TypeHint<Tuple1<Double>>(){}),
+                               TypeInformation.of(new 
TypeHint<Tuple1<Double>>(){}),
                                new String[] { "0" });
        }
 
@@ -584,8 +586,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testLogisticRegressionExamplesPointParser() {
                
compareAnalyzerResultWithAnnotationsSingleInput(MapFunction.class, 
PointParser.class,
-                               "String",
-                               "Tuple2<Integer, double[]>");
+                               Types.STRING,
+                               TypeInformation.of(new TypeHint<Tuple2<Integer, 
double[]>>(){}));
        }
 
        // 
--------------------------------------------------------------------------------------------
@@ -620,8 +622,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testCanopyExamplesMassageBOW() {
                
compareAnalyzerResultWithAnnotationsSingleInput(MapFunction.class, 
PointParser.class,
-                               "String",
-                               "Tuple2<Integer, String>");
+                               Types.STRING,
+                               TypeInformation.of(new TypeHint<Tuple2<Integer, 
String>>(){}));
        }
 
        @ForwardedFields("0")
@@ -642,8 +644,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testCanopyExamplesDocumentReducer() {
                
compareAnalyzerResultWithAnnotationsSingleInputWithKeys(GroupReduceFunction.class,
 DocumentReducer.class,
-                               "Tuple2<Integer, String>",
-                               "Tuple5<Integer, Boolean, Boolean, String, 
String>",
+                               TypeInformation.of(new TypeHint<Tuple2<Integer, 
String>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple5<Integer, 
Boolean, Boolean, String, String>>(){}),
                                new String[] { "0" });
        }
 
@@ -669,8 +671,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testCanopyExamplesMapToCenter() {
                
compareAnalyzerResultWithAnnotationsSingleInput(MapFunction.class, 
MapToCenter.class,
-                               "Tuple5<Integer, Boolean, Boolean, String, 
String>",
-                               "Tuple5<Integer, Boolean, Boolean, String, 
String>");
+                               TypeInformation.of(new TypeHint<Tuple5<Integer, 
Boolean, Boolean, String, String>>(){}),
+                               TypeInformation.of(new TypeHint<Tuple5<Integer, 
Boolean, Boolean, String, String>>(){}));
        }
 
        // 
--------------------------------------------------------------------------------------------
@@ -725,8 +727,8 @@ public class UdfAnalyzerExamplesTest {
        @Test
        public void testKMeansppExamplesRecordToDocConverter() {
                
compareAnalyzerResultWithAnnotationsSingleInputWithKeys(GroupReduceFunction.class,
 RecordToDocConverter.class,
-                               "Tuple3<Integer, Integer, Double>",
-                               
"org.apache.flink.api.java.sca.UdfAnalyzerExamplesTest$DocumentWithFreq<id=Integer,wordFreq=java.util.HashMap>",
+                               TypeInformation.of(new TypeHint<Tuple3<Integer, 
Integer, Double>>(){}),
+                               TypeInformation.of(new 
TypeHint<DocumentWithFreq>(){}),
                                new String[] { "0" });
        }
 }

Reply via email to