static void validateIfWritable(TypeInformation<?> typeInfo, Type type) {
		try {
			// try to load the writable type info

			Class<?> writableTypeInfoClass = Class
					.forName(HADOOP_WRITABLE_TYPEINFO_CLASS, false, typeInfo.getClass().getClassLoader());

			if (writableTypeInfoClass.isAssignableFrom(typeInfo.getClass())) {
				// this is actually a writable type info
				// check if the type is a writable
				if (!(type instanceof Class && isHadoopWritable((Class<?>) type))) {
					throw new InvalidTypesException(HADOOP_WRITABLE_CLASS + " type expected.");
				}

				// check writable type contents
				Class<?> clazz = (Class<?>) type;
				if (typeInfo.getTypeClass() != clazz) {
					throw new InvalidTypesException("Writable type '"
							+ typeInfo.getTypeClass().getCanonicalName() + "' expected but was '"
							+ clazz.getCanonicalName() + "'.");
				}
			}
		}
		catch (ClassNotFoundException e) {
			// class not present at all, so cannot be that type info
			// ignore
		}
	}
static void validateIfWritable ( TypeInformation < ? > typeInfo , Type type ) { try { Class < ? > writableTypeInfoClass = Class . forName ( HADOOP_WRITABLE_TYPEINFO_CLASS , false , typeInfo . getClass ( ) . getClassLoader ( ) ) ; if ( writableTypeInfoClass . isAssignableFrom ( typeInfo . getClass ( ) ) ) { if ( ! ( type instanceof Class && isHadoopWritable ( ( Class < ? > ) type ) ) ) { throw new InvalidTypesException ( HADOOP_WRITABLE_CLASS + " type expected." ) ; } Class < ? > clazz = ( Class < ? > ) type ; if ( typeInfo . getTypeClass ( ) != clazz ) { throw new InvalidTypesException ( "Writable type '" + typeInfo . getTypeClass ( ) . getCanonicalName ( ) + "' expected but was '" + clazz . getCanonicalName ( ) + "'." ) ; } } } catch ( ClassNotFoundException e ) { } }
visible for testing